drbd: code cleanups without semantic changes
This contains various cosmetic fixes ranging from simple typos to const-ifying, and using booleans properly. Original commit messages from Fabian's patch set: drbd: debugfs: constify drbd_version_fops drbd: use seq_put instead of seq_print where possible drbd: include linux/uaccess.h instead of asm/uaccess.h drbd: use const char * const for drbd strings drbd: kerneldoc warning fix in w_e_end_data_req() drbd: use unsigned for one bit fields drbd: use bool for peer is_ states drbd: fix typo drbd: use | for bitmask combination drbd: use true/false for bool drbd: fix drbd_bm_init() comments drbd: introduce peer state union drbd: fix maybe_pull_ahead() locking comments drbd: use bool for growing drbd: remove redundant declarations drbd: replace if/BUG by BUG_ON Signed-off-by: Fabian Frederick <fabf@skynet.be> Signed-off-by: Roland Kammerer <roland.kammerer@linbit.com> Signed-off-by: Jens Axboe <axboe@fb.com>
This commit is contained in:
parent
20004e2435
commit
7e5fec3168
14 changed files with 59 additions and 54 deletions
|
@ -427,8 +427,7 @@ static struct page **bm_realloc_pages(struct drbd_bitmap *b, unsigned long want)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* called on driver init only. TODO call when a device is created.
|
* allocates the drbd_bitmap and stores it in device->bitmap.
|
||||||
* allocates the drbd_bitmap, and stores it in device->bitmap.
|
|
||||||
*/
|
*/
|
||||||
int drbd_bm_init(struct drbd_device *device)
|
int drbd_bm_init(struct drbd_device *device)
|
||||||
{
|
{
|
||||||
|
@ -633,7 +632,8 @@ int drbd_bm_resize(struct drbd_device *device, sector_t capacity, int set_new_bi
|
||||||
unsigned long bits, words, owords, obits;
|
unsigned long bits, words, owords, obits;
|
||||||
unsigned long want, have, onpages; /* number of pages */
|
unsigned long want, have, onpages; /* number of pages */
|
||||||
struct page **npages, **opages = NULL;
|
struct page **npages, **opages = NULL;
|
||||||
int err = 0, growing;
|
int err = 0;
|
||||||
|
bool growing;
|
||||||
|
|
||||||
if (!expect(b))
|
if (!expect(b))
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
|
@ -903,7 +903,7 @@ static int drbd_version_open(struct inode *inode, struct file *file)
|
||||||
return single_open(file, drbd_version_show, NULL);
|
return single_open(file, drbd_version_show, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct file_operations drbd_version_fops = {
|
static const struct file_operations drbd_version_fops = {
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
.open = drbd_version_open,
|
.open = drbd_version_open,
|
||||||
.llseek = seq_lseek,
|
.llseek = seq_lseek,
|
||||||
|
|
|
@ -1499,7 +1499,7 @@ extern enum drbd_state_rv drbd_set_role(struct drbd_device *device,
|
||||||
int force);
|
int force);
|
||||||
extern bool conn_try_outdate_peer(struct drbd_connection *connection);
|
extern bool conn_try_outdate_peer(struct drbd_connection *connection);
|
||||||
extern void conn_try_outdate_peer_async(struct drbd_connection *connection);
|
extern void conn_try_outdate_peer_async(struct drbd_connection *connection);
|
||||||
extern int conn_khelper(struct drbd_connection *connection, char *cmd);
|
extern enum drbd_peer_state conn_khelper(struct drbd_connection *connection, char *cmd);
|
||||||
extern int drbd_khelper(struct drbd_device *device, char *cmd);
|
extern int drbd_khelper(struct drbd_device *device, char *cmd);
|
||||||
|
|
||||||
/* drbd_worker.c */
|
/* drbd_worker.c */
|
||||||
|
@ -1648,8 +1648,6 @@ void drbd_bump_write_ordering(struct drbd_resource *resource, struct drbd_backin
|
||||||
/* drbd_proc.c */
|
/* drbd_proc.c */
|
||||||
extern struct proc_dir_entry *drbd_proc;
|
extern struct proc_dir_entry *drbd_proc;
|
||||||
extern const struct file_operations drbd_proc_fops;
|
extern const struct file_operations drbd_proc_fops;
|
||||||
extern const char *drbd_conn_str(enum drbd_conns s);
|
|
||||||
extern const char *drbd_role_str(enum drbd_role s);
|
|
||||||
|
|
||||||
/* drbd_actlog.c */
|
/* drbd_actlog.c */
|
||||||
extern bool drbd_al_begin_io_prepare(struct drbd_device *device, struct drbd_interval *i);
|
extern bool drbd_al_begin_io_prepare(struct drbd_device *device, struct drbd_interval *i);
|
||||||
|
|
|
@ -6,13 +6,13 @@
|
||||||
|
|
||||||
struct drbd_interval {
|
struct drbd_interval {
|
||||||
struct rb_node rb;
|
struct rb_node rb;
|
||||||
sector_t sector; /* start sector of the interval */
|
sector_t sector; /* start sector of the interval */
|
||||||
unsigned int size; /* size in bytes */
|
unsigned int size; /* size in bytes */
|
||||||
sector_t end; /* highest interval end in subtree */
|
sector_t end; /* highest interval end in subtree */
|
||||||
int local:1 /* local or remote request? */;
|
unsigned int local:1 /* local or remote request? */;
|
||||||
int waiting:1; /* someone is waiting for this to complete */
|
unsigned int waiting:1; /* someone is waiting for completion */
|
||||||
int completed:1; /* this has been completed already;
|
unsigned int completed:1; /* this has been completed already;
|
||||||
* ignore for conflict detection */
|
* ignore for conflict detection */
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline void drbd_clear_interval(struct drbd_interval *i)
|
static inline void drbd_clear_interval(struct drbd_interval *i)
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/jiffies.h>
|
#include <linux/jiffies.h>
|
||||||
#include <linux/drbd.h>
|
#include <linux/drbd.h>
|
||||||
#include <asm/uaccess.h>
|
#include <linux/uaccess.h>
|
||||||
#include <asm/types.h>
|
#include <asm/types.h>
|
||||||
#include <net/sock.h>
|
#include <net/sock.h>
|
||||||
#include <linux/ctype.h>
|
#include <linux/ctype.h>
|
||||||
|
|
|
@ -387,7 +387,7 @@ int drbd_khelper(struct drbd_device *device, char *cmd)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int conn_khelper(struct drbd_connection *connection, char *cmd)
|
enum drbd_peer_state conn_khelper(struct drbd_connection *connection, char *cmd)
|
||||||
{
|
{
|
||||||
char *envp[] = { "HOME=/",
|
char *envp[] = { "HOME=/",
|
||||||
"TERM=linux",
|
"TERM=linux",
|
||||||
|
@ -503,17 +503,17 @@ bool conn_try_outdate_peer(struct drbd_connection *connection)
|
||||||
r = conn_khelper(connection, "fence-peer");
|
r = conn_khelper(connection, "fence-peer");
|
||||||
|
|
||||||
switch ((r>>8) & 0xff) {
|
switch ((r>>8) & 0xff) {
|
||||||
case 3: /* peer is inconsistent */
|
case P_INCONSISTENT: /* peer is inconsistent */
|
||||||
ex_to_string = "peer is inconsistent or worse";
|
ex_to_string = "peer is inconsistent or worse";
|
||||||
mask.pdsk = D_MASK;
|
mask.pdsk = D_MASK;
|
||||||
val.pdsk = D_INCONSISTENT;
|
val.pdsk = D_INCONSISTENT;
|
||||||
break;
|
break;
|
||||||
case 4: /* peer got outdated, or was already outdated */
|
case P_OUTDATED: /* peer got outdated, or was already outdated */
|
||||||
ex_to_string = "peer was fenced";
|
ex_to_string = "peer was fenced";
|
||||||
mask.pdsk = D_MASK;
|
mask.pdsk = D_MASK;
|
||||||
val.pdsk = D_OUTDATED;
|
val.pdsk = D_OUTDATED;
|
||||||
break;
|
break;
|
||||||
case 5: /* peer was down */
|
case P_DOWN: /* peer was down */
|
||||||
if (conn_highest_disk(connection) == D_UP_TO_DATE) {
|
if (conn_highest_disk(connection) == D_UP_TO_DATE) {
|
||||||
/* we will(have) create(d) a new UUID anyways... */
|
/* we will(have) create(d) a new UUID anyways... */
|
||||||
ex_to_string = "peer is unreachable, assumed to be dead";
|
ex_to_string = "peer is unreachable, assumed to be dead";
|
||||||
|
@ -523,7 +523,7 @@ bool conn_try_outdate_peer(struct drbd_connection *connection)
|
||||||
ex_to_string = "peer unreachable, doing nothing since disk != UpToDate";
|
ex_to_string = "peer unreachable, doing nothing since disk != UpToDate";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 6: /* Peer is primary, voluntarily outdate myself.
|
case P_PRIMARY: /* Peer is primary, voluntarily outdate myself.
|
||||||
* This is useful when an unconnected R_SECONDARY is asked to
|
* This is useful when an unconnected R_SECONDARY is asked to
|
||||||
* become R_PRIMARY, but finds the other peer being active. */
|
* become R_PRIMARY, but finds the other peer being active. */
|
||||||
ex_to_string = "peer is active";
|
ex_to_string = "peer is active";
|
||||||
|
@ -531,7 +531,9 @@ bool conn_try_outdate_peer(struct drbd_connection *connection)
|
||||||
mask.disk = D_MASK;
|
mask.disk = D_MASK;
|
||||||
val.disk = D_OUTDATED;
|
val.disk = D_OUTDATED;
|
||||||
break;
|
break;
|
||||||
case 7:
|
case P_FENCING:
|
||||||
|
/* THINK: do we need to handle this
|
||||||
|
* like case 4, or more like case 5? */
|
||||||
if (fp != FP_STONITH)
|
if (fp != FP_STONITH)
|
||||||
drbd_err(connection, "fence-peer() = 7 && fencing != Stonith !!!\n");
|
drbd_err(connection, "fence-peer() = 7 && fencing != Stonith !!!\n");
|
||||||
ex_to_string = "peer was stonithed";
|
ex_to_string = "peer was stonithed";
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
|
|
||||||
#include <asm/uaccess.h>
|
#include <linux/uaccess.h>
|
||||||
#include <linux/fs.h>
|
#include <linux/fs.h>
|
||||||
#include <linux/file.h>
|
#include <linux/file.h>
|
||||||
#include <linux/proc_fs.h>
|
#include <linux/proc_fs.h>
|
||||||
|
@ -122,18 +122,18 @@ static void drbd_syncer_progress(struct drbd_device *device, struct seq_file *se
|
||||||
|
|
||||||
x = res/50;
|
x = res/50;
|
||||||
y = 20-x;
|
y = 20-x;
|
||||||
seq_printf(seq, "\t[");
|
seq_puts(seq, "\t[");
|
||||||
for (i = 1; i < x; i++)
|
for (i = 1; i < x; i++)
|
||||||
seq_printf(seq, "=");
|
seq_putc(seq, '=');
|
||||||
seq_printf(seq, ">");
|
seq_putc(seq, '>');
|
||||||
for (i = 0; i < y; i++)
|
for (i = 0; i < y; i++)
|
||||||
seq_printf(seq, ".");
|
seq_printf(seq, ".");
|
||||||
seq_printf(seq, "] ");
|
seq_puts(seq, "] ");
|
||||||
|
|
||||||
if (state.conn == C_VERIFY_S || state.conn == C_VERIFY_T)
|
if (state.conn == C_VERIFY_S || state.conn == C_VERIFY_T)
|
||||||
seq_printf(seq, "verified:");
|
seq_puts(seq, "verified:");
|
||||||
else
|
else
|
||||||
seq_printf(seq, "sync'ed:");
|
seq_puts(seq, "sync'ed:");
|
||||||
seq_printf(seq, "%3u.%u%% ", res / 10, res % 10);
|
seq_printf(seq, "%3u.%u%% ", res / 10, res % 10);
|
||||||
|
|
||||||
/* if more than a few GB, display in MB */
|
/* if more than a few GB, display in MB */
|
||||||
|
@ -146,7 +146,7 @@ static void drbd_syncer_progress(struct drbd_device *device, struct seq_file *se
|
||||||
(unsigned long) Bit2KB(rs_left),
|
(unsigned long) Bit2KB(rs_left),
|
||||||
(unsigned long) Bit2KB(rs_total));
|
(unsigned long) Bit2KB(rs_total));
|
||||||
|
|
||||||
seq_printf(seq, "\n\t");
|
seq_puts(seq, "\n\t");
|
||||||
|
|
||||||
/* see drivers/md/md.c
|
/* see drivers/md/md.c
|
||||||
* We do not want to overflow, so the order of operands and
|
* We do not want to overflow, so the order of operands and
|
||||||
|
@ -175,9 +175,9 @@ static void drbd_syncer_progress(struct drbd_device *device, struct seq_file *se
|
||||||
rt / 3600, (rt % 3600) / 60, rt % 60);
|
rt / 3600, (rt % 3600) / 60, rt % 60);
|
||||||
|
|
||||||
dbdt = Bit2KB(db/dt);
|
dbdt = Bit2KB(db/dt);
|
||||||
seq_printf(seq, " speed: ");
|
seq_puts(seq, " speed: ");
|
||||||
seq_printf_with_thousands_grouping(seq, dbdt);
|
seq_printf_with_thousands_grouping(seq, dbdt);
|
||||||
seq_printf(seq, " (");
|
seq_puts(seq, " (");
|
||||||
/* ------------------------- ~3s average ------------------------ */
|
/* ------------------------- ~3s average ------------------------ */
|
||||||
if (proc_details >= 1) {
|
if (proc_details >= 1) {
|
||||||
/* this is what drbd_rs_should_slow_down() uses */
|
/* this is what drbd_rs_should_slow_down() uses */
|
||||||
|
@ -188,7 +188,7 @@ static void drbd_syncer_progress(struct drbd_device *device, struct seq_file *se
|
||||||
db = device->rs_mark_left[i] - rs_left;
|
db = device->rs_mark_left[i] - rs_left;
|
||||||
dbdt = Bit2KB(db/dt);
|
dbdt = Bit2KB(db/dt);
|
||||||
seq_printf_with_thousands_grouping(seq, dbdt);
|
seq_printf_with_thousands_grouping(seq, dbdt);
|
||||||
seq_printf(seq, " -- ");
|
seq_puts(seq, " -- ");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------- long term average ---------------------- */
|
/* --------------------- long term average ---------------------- */
|
||||||
|
@ -200,11 +200,11 @@ static void drbd_syncer_progress(struct drbd_device *device, struct seq_file *se
|
||||||
db = rs_total - rs_left;
|
db = rs_total - rs_left;
|
||||||
dbdt = Bit2KB(db/dt);
|
dbdt = Bit2KB(db/dt);
|
||||||
seq_printf_with_thousands_grouping(seq, dbdt);
|
seq_printf_with_thousands_grouping(seq, dbdt);
|
||||||
seq_printf(seq, ")");
|
seq_putc(seq, ')');
|
||||||
|
|
||||||
if (state.conn == C_SYNC_TARGET ||
|
if (state.conn == C_SYNC_TARGET ||
|
||||||
state.conn == C_VERIFY_S) {
|
state.conn == C_VERIFY_S) {
|
||||||
seq_printf(seq, " want: ");
|
seq_puts(seq, " want: ");
|
||||||
seq_printf_with_thousands_grouping(seq, device->c_sync_rate);
|
seq_printf_with_thousands_grouping(seq, device->c_sync_rate);
|
||||||
}
|
}
|
||||||
seq_printf(seq, " K/sec%s\n", stalled ? " (stalled)" : "");
|
seq_printf(seq, " K/sec%s\n", stalled ? " (stalled)" : "");
|
||||||
|
@ -231,7 +231,7 @@ static void drbd_syncer_progress(struct drbd_device *device, struct seq_file *se
|
||||||
(unsigned long long)bm_bits * BM_SECT_PER_BIT);
|
(unsigned long long)bm_bits * BM_SECT_PER_BIT);
|
||||||
if (stop_sector != 0 && stop_sector != ULLONG_MAX)
|
if (stop_sector != 0 && stop_sector != ULLONG_MAX)
|
||||||
seq_printf(seq, " stop sector: %llu", stop_sector);
|
seq_printf(seq, " stop sector: %llu", stop_sector);
|
||||||
seq_printf(seq, "\n");
|
seq_putc(seq, '\n');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,7 +276,7 @@ static int drbd_seq_show(struct seq_file *seq, void *v)
|
||||||
rcu_read_lock();
|
rcu_read_lock();
|
||||||
idr_for_each_entry(&drbd_devices, device, i) {
|
idr_for_each_entry(&drbd_devices, device, i) {
|
||||||
if (prev_i != i - 1)
|
if (prev_i != i - 1)
|
||||||
seq_printf(seq, "\n");
|
seq_putc(seq, '\n');
|
||||||
prev_i = i;
|
prev_i = i;
|
||||||
|
|
||||||
state = device->state;
|
state = device->state;
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
|
|
||||||
#include <asm/uaccess.h>
|
#include <linux/uaccess.h>
|
||||||
#include <net/sock.h>
|
#include <net/sock.h>
|
||||||
|
|
||||||
#include <linux/drbd.h>
|
#include <linux/drbd.h>
|
||||||
|
@ -2289,13 +2289,13 @@ static inline int overlaps(sector_t s1, int l1, sector_t s2, int l2)
|
||||||
static bool overlapping_resync_write(struct drbd_device *device, struct drbd_peer_request *peer_req)
|
static bool overlapping_resync_write(struct drbd_device *device, struct drbd_peer_request *peer_req)
|
||||||
{
|
{
|
||||||
struct drbd_peer_request *rs_req;
|
struct drbd_peer_request *rs_req;
|
||||||
bool rv = 0;
|
bool rv = false;
|
||||||
|
|
||||||
spin_lock_irq(&device->resource->req_lock);
|
spin_lock_irq(&device->resource->req_lock);
|
||||||
list_for_each_entry(rs_req, &device->sync_ee, w.list) {
|
list_for_each_entry(rs_req, &device->sync_ee, w.list) {
|
||||||
if (overlaps(peer_req->i.sector, peer_req->i.size,
|
if (overlaps(peer_req->i.sector, peer_req->i.size,
|
||||||
rs_req->i.sector, rs_req->i.size)) {
|
rs_req->i.sector, rs_req->i.size)) {
|
||||||
rv = 1;
|
rv = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2678,7 +2678,7 @@ static int receive_Data(struct drbd_connection *connection, struct packet_info *
|
||||||
}
|
}
|
||||||
|
|
||||||
out_interrupted:
|
out_interrupted:
|
||||||
drbd_may_finish_epoch(connection, peer_req->epoch, EV_PUT + EV_CLEANUP);
|
drbd_may_finish_epoch(connection, peer_req->epoch, EV_PUT | EV_CLEANUP);
|
||||||
put_ldev(device);
|
put_ldev(device);
|
||||||
drbd_free_peer_req(device, peer_req);
|
drbd_free_peer_req(device, peer_req);
|
||||||
return err;
|
return err;
|
||||||
|
|
|
@ -1000,7 +1000,7 @@ static void complete_conflicting_writes(struct drbd_request *req)
|
||||||
finish_wait(&device->misc_wait, &wait);
|
finish_wait(&device->misc_wait, &wait);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* called within req_lock and rcu_read_lock() */
|
/* called within req_lock */
|
||||||
static void maybe_pull_ahead(struct drbd_device *device)
|
static void maybe_pull_ahead(struct drbd_device *device)
|
||||||
{
|
{
|
||||||
struct drbd_connection *connection = first_peer_device(device)->connection;
|
struct drbd_connection *connection = first_peer_device(device)->connection;
|
||||||
|
|
|
@ -2196,9 +2196,7 @@ conn_set_state(struct drbd_connection *connection, union drbd_state mask, union
|
||||||
ns.disk = os.disk;
|
ns.disk = os.disk;
|
||||||
|
|
||||||
rv = _drbd_set_state(device, ns, flags, NULL);
|
rv = _drbd_set_state(device, ns, flags, NULL);
|
||||||
if (rv < SS_SUCCESS)
|
BUG_ON(rv < SS_SUCCESS);
|
||||||
BUG();
|
|
||||||
|
|
||||||
ns.i = device->state.i;
|
ns.i = device->state.i;
|
||||||
ns_max.role = max_role(ns.role, ns_max.role);
|
ns_max.role = max_role(ns.role, ns_max.role);
|
||||||
ns_max.peer = max_role(ns.peer, ns_max.peer);
|
ns_max.peer = max_role(ns.peer, ns_max.peer);
|
||||||
|
|
|
@ -140,7 +140,7 @@ extern void drbd_resume_al(struct drbd_device *device);
|
||||||
extern bool conn_all_vols_unconf(struct drbd_connection *connection);
|
extern bool conn_all_vols_unconf(struct drbd_connection *connection);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* drbd_request_state() - Reqest a state change
|
* drbd_request_state() - Request a state change
|
||||||
* @device: DRBD device.
|
* @device: DRBD device.
|
||||||
* @mask: mask of state bits to change.
|
* @mask: mask of state bits to change.
|
||||||
* @val: value of new state bits.
|
* @val: value of new state bits.
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#include <linux/drbd.h>
|
#include <linux/drbd.h>
|
||||||
#include "drbd_strings.h"
|
#include "drbd_strings.h"
|
||||||
|
|
||||||
static const char *drbd_conn_s_names[] = {
|
static const char * const drbd_conn_s_names[] = {
|
||||||
[C_STANDALONE] = "StandAlone",
|
[C_STANDALONE] = "StandAlone",
|
||||||
[C_DISCONNECTING] = "Disconnecting",
|
[C_DISCONNECTING] = "Disconnecting",
|
||||||
[C_UNCONNECTED] = "Unconnected",
|
[C_UNCONNECTED] = "Unconnected",
|
||||||
|
@ -53,13 +53,13 @@ static const char *drbd_conn_s_names[] = {
|
||||||
[C_BEHIND] = "Behind",
|
[C_BEHIND] = "Behind",
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *drbd_role_s_names[] = {
|
static const char * const drbd_role_s_names[] = {
|
||||||
[R_PRIMARY] = "Primary",
|
[R_PRIMARY] = "Primary",
|
||||||
[R_SECONDARY] = "Secondary",
|
[R_SECONDARY] = "Secondary",
|
||||||
[R_UNKNOWN] = "Unknown"
|
[R_UNKNOWN] = "Unknown"
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *drbd_disk_s_names[] = {
|
static const char * const drbd_disk_s_names[] = {
|
||||||
[D_DISKLESS] = "Diskless",
|
[D_DISKLESS] = "Diskless",
|
||||||
[D_ATTACHING] = "Attaching",
|
[D_ATTACHING] = "Attaching",
|
||||||
[D_FAILED] = "Failed",
|
[D_FAILED] = "Failed",
|
||||||
|
@ -71,7 +71,7 @@ static const char *drbd_disk_s_names[] = {
|
||||||
[D_UP_TO_DATE] = "UpToDate",
|
[D_UP_TO_DATE] = "UpToDate",
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *drbd_state_sw_errors[] = {
|
static const char * const drbd_state_sw_errors[] = {
|
||||||
[-SS_TWO_PRIMARIES] = "Multiple primaries not allowed by config",
|
[-SS_TWO_PRIMARIES] = "Multiple primaries not allowed by config",
|
||||||
[-SS_NO_UP_TO_DATE_DISK] = "Need access to UpToDate data",
|
[-SS_NO_UP_TO_DATE_DISK] = "Need access to UpToDate data",
|
||||||
[-SS_NO_LOCAL_DISK] = "Can not resync without local disk",
|
[-SS_NO_LOCAL_DISK] = "Can not resync without local disk",
|
||||||
|
|
|
@ -173,8 +173,8 @@ void drbd_peer_request_endio(struct bio *bio)
|
||||||
{
|
{
|
||||||
struct drbd_peer_request *peer_req = bio->bi_private;
|
struct drbd_peer_request *peer_req = bio->bi_private;
|
||||||
struct drbd_device *device = peer_req->peer_device->device;
|
struct drbd_device *device = peer_req->peer_device->device;
|
||||||
int is_write = bio_data_dir(bio) == WRITE;
|
bool is_write = bio_data_dir(bio) == WRITE;
|
||||||
int is_discard = !!(bio_op(bio) == REQ_OP_DISCARD);
|
bool is_discard = !!(bio_op(bio) == REQ_OP_DISCARD);
|
||||||
|
|
||||||
if (bio->bi_error && __ratelimit(&drbd_ratelimit_state))
|
if (bio->bi_error && __ratelimit(&drbd_ratelimit_state))
|
||||||
drbd_warn(device, "%s: error=%d s=%llus\n",
|
drbd_warn(device, "%s: error=%d s=%llus\n",
|
||||||
|
@ -1039,7 +1039,6 @@ static void move_to_net_ee_or_free(struct drbd_device *device, struct drbd_peer_
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* w_e_end_data_req() - Worker callback, to send a P_DATA_REPLY packet in response to a P_DATA_REQUEST
|
* w_e_end_data_req() - Worker callback, to send a P_DATA_REPLY packet in response to a P_DATA_REQUEST
|
||||||
* @device: DRBD device.
|
|
||||||
* @w: work object.
|
* @w: work object.
|
||||||
* @cancel: The connection will be closed anyways
|
* @cancel: The connection will be closed anyways
|
||||||
*/
|
*/
|
||||||
|
@ -1700,7 +1699,7 @@ static bool use_checksum_based_resync(struct drbd_connection *connection, struct
|
||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
return connection->agreed_pro_version >= 89 && /* supported? */
|
return connection->agreed_pro_version >= 89 && /* supported? */
|
||||||
connection->csums_tfm && /* configured? */
|
connection->csums_tfm && /* configured? */
|
||||||
(csums_after_crash_only == 0 /* use for each resync? */
|
(csums_after_crash_only == false /* use for each resync? */
|
||||||
|| test_bit(CRASHED_PRIMARY, &device->flags)); /* or only after Primary crash? */
|
|| test_bit(CRASHED_PRIMARY, &device->flags)); /* or only after Primary crash? */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1835,7 +1834,7 @@ void drbd_start_resync(struct drbd_device *device, enum drbd_conns side)
|
||||||
device->bm_resync_fo = 0;
|
device->bm_resync_fo = 0;
|
||||||
device->use_csums = use_checksum_based_resync(connection, device);
|
device->use_csums = use_checksum_based_resync(connection, device);
|
||||||
} else {
|
} else {
|
||||||
device->use_csums = 0;
|
device->use_csums = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Since protocol 96, we must serialize drbd_gen_and_send_sync_uuid
|
/* Since protocol 96, we must serialize drbd_gen_and_send_sync_uuid
|
||||||
|
|
|
@ -370,6 +370,14 @@ enum drbd_notification_type {
|
||||||
NOTIFY_FLAGS = NOTIFY_CONTINUES,
|
NOTIFY_FLAGS = NOTIFY_CONTINUES,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum drbd_peer_state {
|
||||||
|
P_INCONSISTENT = 3,
|
||||||
|
P_OUTDATED = 4,
|
||||||
|
P_DOWN = 5,
|
||||||
|
P_PRIMARY = 6,
|
||||||
|
P_FENCING = 7,
|
||||||
|
};
|
||||||
|
|
||||||
#define UUID_JUST_CREATED ((__u64)4)
|
#define UUID_JUST_CREATED ((__u64)4)
|
||||||
|
|
||||||
enum write_ordering_e {
|
enum write_ordering_e {
|
||||||
|
|
Loading…
Reference in a new issue