Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 345973
b: refs/heads/master
c: da9fbc2
h: refs/heads/master
i:
  345971: f55cf72
v: v3
  • Loading branch information
Philipp Reisner committed Nov 8, 2012
1 parent cbb4035 commit a95e2f9
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8e0af25fa85c9efe393128b0a0dd874981edb22f
refs/heads/master: da9fbc276e9d42638df68e8515d06750695612ca
6 changes: 3 additions & 3 deletions trunk/drivers/block/drbd/drbd_int.h
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,7 @@ struct drbd_conf {
/* Used after attach while negotiating new disk state. */
union drbd_state new_state_tmp;

union drbd_state state;
union drbd_dev_state state;
wait_queue_head_t misc_wait;
wait_queue_head_t state_wait; /* upon each state change. */
unsigned int send_cnt;
Expand Down Expand Up @@ -1689,7 +1689,7 @@ static inline union drbd_state drbd_read_state(struct drbd_conf *mdev)
{
union drbd_state rv;

rv = mdev->state;
rv.i = mdev->state.i;
rv.susp = mdev->tconn->susp;
rv.susp_nod = mdev->tconn->susp_nod;
rv.susp_fen = mdev->tconn->susp_fen;
Expand Down Expand Up @@ -2155,7 +2155,7 @@ static inline int drbd_get_max_buffers(struct drbd_conf *mdev)

static inline int drbd_state_is_stable(struct drbd_conf *mdev)
{
union drbd_state s = mdev->state;
union drbd_dev_state s = mdev->state;

/* DO NOT add a default clause, we want the compiler to warn us
* for any newly introduced state we may have forgotten to add here */
Expand Down
5 changes: 1 addition & 4 deletions trunk/drivers/block/drbd/drbd_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1821,15 +1821,12 @@ static void drbd_set_defaults(struct drbd_conf *mdev)
{
/* Beware! The actual layout differs
* between big endian and little endian */
mdev->state = (union drbd_state) {
mdev->state = (union drbd_dev_state) {
{ .role = R_SECONDARY,
.peer = R_UNKNOWN,
.conn = C_STANDALONE,
.disk = D_DISKLESS,
.pdsk = D_UNKNOWN,
.susp = 0,
.susp_nod = 0,
.susp_fen = 0
} };
}

Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/block/drbd/drbd_nl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1435,7 +1435,7 @@ int drbd_adm_attach(struct sk_buff *skb, struct genl_info *info)
clear_bit(CRASHED_PRIMARY, &mdev->flags);

if (drbd_md_test_flag(mdev->ldev, MDF_PRIMARY_IND) &&
!(mdev->state.role == R_PRIMARY && mdev->state.susp_nod)) {
!(mdev->state.role == R_PRIMARY && mdev->tconn->susp_nod)) {
set_bit(CRASHED_PRIMARY, &mdev->flags);
cp_discovered = 1;
}
Expand Down Expand Up @@ -2348,7 +2348,7 @@ int drbd_adm_pause_sync(struct sk_buff *skb, struct genl_info *info)

int drbd_adm_resume_sync(struct sk_buff *skb, struct genl_info *info)
{
union drbd_state s;
union drbd_dev_state s;
enum drbd_ret_code retcode;

retcode = drbd_adm_prepare(skb, info, DRBD_ADM_NEED_MINOR);
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/block/drbd/drbd_req.h
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ static inline int req_mod(struct drbd_request *req,
return rv;
}

static inline bool drbd_should_do_remote(union drbd_state s)
static inline bool drbd_should_do_remote(union drbd_dev_state s)
{
return s.pdsk == D_UP_TO_DATE ||
(s.pdsk >= D_INCONSISTENT &&
Expand All @@ -305,7 +305,7 @@ static inline bool drbd_should_do_remote(union drbd_state s)
That is equivalent since before 96 IO was frozen in the C_WF_BITMAP*
states. */
}
static inline bool drbd_should_send_out_of_sync(union drbd_state s)
static inline bool drbd_should_send_out_of_sync(union drbd_dev_state s)
{
return s.conn == C_AHEAD || s.conn == C_WF_BITMAP_S;
/* pdsk = D_INCONSISTENT as a consequence. Protocol 96 check not necessary
Expand Down
6 changes: 3 additions & 3 deletions trunk/drivers/block/drbd/drbd_state.c
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,7 @@ __drbd_set_state(struct drbd_conf *mdev, union drbd_state ns,
(os.disk != D_DISKLESS && ns.disk == D_DISKLESS))
atomic_inc(&mdev->local_cnt);

mdev->state = ns;
mdev->state.i = ns.i;
mdev->tconn->susp = ns.susp;
mdev->tconn->susp_nod = ns.susp_nod;
mdev->tconn->susp_fen = ns.susp_fen;
Expand Down Expand Up @@ -1393,7 +1393,7 @@ static int w_after_conn_state_ch(struct drbd_work *w, int unused)
void conn_old_common_state(struct drbd_tconn *tconn, union drbd_state *pcs, enum chg_state_flags *pf)
{
enum chg_state_flags flags = ~0;
union drbd_state os, cs = {}; /* old_state, common_state */
union drbd_dev_state os, cs = {}; /* old_state, common_state */
struct drbd_conf *mdev;
int vnr, first_vol = 1;

Expand Down Expand Up @@ -1424,7 +1424,7 @@ void conn_old_common_state(struct drbd_tconn *tconn, union drbd_state *pcs, enum

*pf |= CS_DC_MASK;
*pf &= flags;
*pcs = cs;
(*pcs).i = cs.i;
}

static enum drbd_state_rv
Expand Down
34 changes: 34 additions & 0 deletions trunk/drivers/block/drbd/drbd_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,40 @@ enum chg_state_flags {
CS_IGN_OUTD_FAIL = 1 << 10,
};

/* drbd_dev_state and drbd_state are different types. This is to stress the
small difference. There is no suspended flag (.susp), and no suspended
while fence handler runs flas (susp_fen). */
union drbd_dev_state {
struct {
#if defined(__LITTLE_ENDIAN_BITFIELD)
unsigned role:2 ; /* 3/4 primary/secondary/unknown */
unsigned peer:2 ; /* 3/4 primary/secondary/unknown */
unsigned conn:5 ; /* 17/32 cstates */
unsigned disk:4 ; /* 8/16 from D_DISKLESS to D_UP_TO_DATE */
unsigned pdsk:4 ; /* 8/16 from D_DISKLESS to D_UP_TO_DATE */
unsigned _unused:1 ;
unsigned aftr_isp:1 ; /* isp .. imposed sync pause */
unsigned peer_isp:1 ;
unsigned user_isp:1 ;
unsigned _pad:11; /* 0 unused */
#elif defined(__BIG_ENDIAN_BITFIELD)
unsigned _pad:11;
unsigned user_isp:1 ;
unsigned peer_isp:1 ;
unsigned aftr_isp:1 ; /* isp .. imposed sync pause */
unsigned _unused:1 ;
unsigned pdsk:4 ; /* 8/16 from D_DISKLESS to D_UP_TO_DATE */
unsigned disk:4 ; /* 8/16 from D_DISKLESS to D_UP_TO_DATE */
unsigned conn:5 ; /* 17/32 cstates */
unsigned peer:2 ; /* 3/4 primary/secondary/unknown */
unsigned role:2 ; /* 3/4 primary/secondary/unknown */
#else
# error "this endianess is not supported"
#endif
};
unsigned int i;
};

extern enum drbd_state_rv drbd_change_state(struct drbd_conf *mdev,
enum chg_state_flags f,
union drbd_state mask,
Expand Down

0 comments on commit a95e2f9

Please sign in to comment.