Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 345695
b: refs/heads/master
c: 06f10ad
h: refs/heads/master
i:
  345693: cf7128d
  345691: 08dd3b4
  345687: f858a56
  345679: 722b57b
  345663: 6245e8e
v: v3
  • Loading branch information
Lars Ellenberg authored and Jens Axboe committed Oct 30, 2012
1 parent e106179 commit b62eb19
Show file tree
Hide file tree
Showing 9 changed files with 172 additions and 144 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: 44edfb0d785ea06712b5a717fa2c1ae34e300845
refs/heads/master: 06f10adbdb027b225fd51584a218fa8344169514
4 changes: 2 additions & 2 deletions trunk/drivers/block/drbd/drbd_actlog.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ void wait_until_done_or_force_detached(struct drbd_conf *mdev, struct drbd_backi
dt = MAX_SCHEDULE_TIMEOUT;

dt = wait_event_timeout(mdev->misc_wait,
*done || test_bit(FORCE_DETACH, &mdev->flags), dt);
*done || drbd_test_flag(mdev, FORCE_DETACH), dt);
if (dt == 0) {
dev_err(DEV, "meta-data IO operation timed out\n");
drbd_chk_io_error(mdev, 1, DRBD_FORCE_DETACH);
Expand All @@ -108,7 +108,7 @@ static int _drbd_md_sync_page_io(struct drbd_conf *mdev,
mdev->md_io.done = 0;
mdev->md_io.error = -ENODEV;

if ((rw & WRITE) && !test_bit(MD_NO_FUA, &mdev->flags))
if ((rw & WRITE) && !drbd_test_flag(mdev, MD_NO_FUA))
rw |= REQ_FUA | REQ_FLUSH;
rw |= REQ_SYNC;

Expand Down
60 changes: 44 additions & 16 deletions trunk/drivers/block/drbd/drbd_int.h
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ enum {
#define EE_HAS_DIGEST (1<<__EE_HAS_DIGEST)

/* global flag bits */
enum {
enum drbd_flag {
CREATE_BARRIER, /* next P_DATA is preceded by a P_BARRIER */
SIGNAL_ASENDER, /* whether asender wants to be interrupted */
SEND_PING, /* whether asender should send a ping asap */
Expand Down Expand Up @@ -858,6 +858,9 @@ enum {
* and potentially deadlock on, this drbd worker.
*/
DISCONNECT_SENT, /* Currently the last bit in this 32bit word */

/* keep last */
DRBD_N_FLAGS,
};

struct drbd_bitmap; /* opaque for drbd_conf */
Expand Down Expand Up @@ -970,8 +973,7 @@ struct fifo_buffer {
};

struct drbd_conf {
/* things that are stored as / read from meta data on disk */
unsigned long flags;
unsigned long drbd_flags[(DRBD_N_FLAGS + BITS_PER_LONG -1)/BITS_PER_LONG];

/* configured by drbdsetup */
struct net_conf *net_conf; /* protected by get_net_conf() and put_net_conf() */
Expand Down Expand Up @@ -1143,6 +1145,31 @@ struct drbd_conf {
unsigned int local_max_bio_size;
};

static inline void drbd_set_flag(struct drbd_conf *mdev, enum drbd_flag f)
{
set_bit(f, &mdev->drbd_flags[0]);
}

static inline void drbd_clear_flag(struct drbd_conf *mdev, enum drbd_flag f)
{
clear_bit(f, &mdev->drbd_flags[0]);
}

static inline int drbd_test_flag(struct drbd_conf *mdev, enum drbd_flag f)
{
return test_bit(f, &mdev->drbd_flags[0]);
}

static inline int drbd_test_and_set_flag(struct drbd_conf *mdev, enum drbd_flag f)
{
return test_and_set_bit(f, &mdev->drbd_flags[0]);
}

static inline int drbd_test_and_clear_flag(struct drbd_conf *mdev, enum drbd_flag f)
{
return test_and_clear_bit(f, &mdev->drbd_flags[0]);
}

static inline struct drbd_conf *minor_to_mdev(unsigned int minor)
{
struct drbd_conf *mdev;
Expand Down Expand Up @@ -1812,12 +1839,12 @@ static inline int drbd_ee_has_active_page(struct drbd_epoch_entry *e)
static inline void drbd_state_lock(struct drbd_conf *mdev)
{
wait_event(mdev->misc_wait,
!test_and_set_bit(CLUSTER_ST_CHANGE, &mdev->flags));
!drbd_test_and_set_flag(mdev, CLUSTER_ST_CHANGE));
}

static inline void drbd_state_unlock(struct drbd_conf *mdev)
{
clear_bit(CLUSTER_ST_CHANGE, &mdev->flags);
drbd_clear_flag(mdev, CLUSTER_ST_CHANGE);
wake_up(&mdev->misc_wait);
}

Expand Down Expand Up @@ -1874,9 +1901,9 @@ static inline void __drbd_chk_io_error_(struct drbd_conf *mdev,
/* NOTE fall through to detach case if forcedetach set */
case EP_DETACH:
case EP_CALL_HELPER:
set_bit(WAS_IO_ERROR, &mdev->flags);
drbd_set_flag(mdev, WAS_IO_ERROR);
if (forcedetach == DRBD_FORCE_DETACH)
set_bit(FORCE_DETACH, &mdev->flags);
drbd_set_flag(mdev, FORCE_DETACH);
if (mdev->state.disk > D_FAILED) {
_drbd_set_state(_NS(mdev, disk, D_FAILED), CS_HARD, NULL);
dev_err(DEV,
Expand Down Expand Up @@ -2037,13 +2064,13 @@ drbd_queue_work(struct drbd_work_queue *q, struct drbd_work *w)

static inline void wake_asender(struct drbd_conf *mdev)
{
if (test_bit(SIGNAL_ASENDER, &mdev->flags))
if (drbd_test_flag(mdev, SIGNAL_ASENDER))
force_sig(DRBD_SIG, mdev->asender.task);
}

static inline void request_ping(struct drbd_conf *mdev)
{
set_bit(SEND_PING, &mdev->flags);
drbd_set_flag(mdev, SEND_PING);
wake_asender(mdev);
}

Expand Down Expand Up @@ -2374,7 +2401,7 @@ static inline bool may_inc_ap_bio(struct drbd_conf *mdev)

if (is_susp(mdev->state))
return false;
if (test_bit(SUSPEND_IO, &mdev->flags))
if (drbd_test_flag(mdev, SUSPEND_IO))
return false;

/* to avoid potential deadlock or bitmap corruption,
Expand All @@ -2389,7 +2416,7 @@ static inline bool may_inc_ap_bio(struct drbd_conf *mdev)
* and we are within the spinlock anyways, we have this workaround. */
if (atomic_read(&mdev->ap_bio_cnt) > mxb)
return false;
if (test_bit(BITMAP_IO, &mdev->flags))
if (drbd_test_flag(mdev, BITMAP_IO))
return false;
return true;
}
Expand Down Expand Up @@ -2427,8 +2454,8 @@ static inline void dec_ap_bio(struct drbd_conf *mdev)

D_ASSERT(ap_bio >= 0);

if (ap_bio == 0 && test_bit(BITMAP_IO, &mdev->flags)) {
if (!test_and_set_bit(BITMAP_IO_QUEUED, &mdev->flags))
if (ap_bio == 0 && drbd_test_flag(mdev, BITMAP_IO)) {
if (!drbd_test_and_set_flag(mdev, BITMAP_IO_QUEUED))
drbd_queue_work(&mdev->data.work, &mdev->bm_io_work.w);
}

Expand Down Expand Up @@ -2477,7 +2504,7 @@ static inline void drbd_update_congested(struct drbd_conf *mdev)
{
struct sock *sk = mdev->data.socket->sk;
if (sk->sk_wmem_queued > sk->sk_sndbuf * 4 / 5)
set_bit(NET_CONGESTED, &mdev->flags);
drbd_set_flag(mdev, NET_CONGESTED);
}

static inline int drbd_queue_order_type(struct drbd_conf *mdev)
Expand All @@ -2494,14 +2521,15 @@ static inline void drbd_md_flush(struct drbd_conf *mdev)
{
int r;

if (test_bit(MD_NO_FUA, &mdev->flags))
if (drbd_test_flag(mdev, MD_NO_FUA))
return;

r = blkdev_issue_flush(mdev->ldev->md_bdev, GFP_NOIO, NULL);
if (r) {
set_bit(MD_NO_FUA, &mdev->flags);
drbd_set_flag(mdev, MD_NO_FUA);
dev_err(DEV, "meta data flush failed with status %d, disabling md-flushes\n", r);
}
}


#endif
Loading

0 comments on commit b62eb19

Please sign in to comment.