Skip to content

Commit

Permalink
drbd: use test_and_set_bit() to decide if bm_io_work should be queued
Browse files Browse the repository at this point in the history
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
  • Loading branch information
Philipp Reisner committed Mar 10, 2011
1 parent aeda1cd commit 127b317
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions drivers/block/drbd/drbd_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3772,6 +3772,7 @@ static int w_bitmap_io(struct drbd_conf *mdev, struct drbd_work *w, int unused)
drbd_bm_unlock(mdev);

clear_bit(BITMAP_IO, &mdev->flags);
smp_mb__after_clear_bit();
wake_up(&mdev->misc_wait);

if (work->done)
Expand Down Expand Up @@ -3850,11 +3851,8 @@ void drbd_queue_bitmap_io(struct drbd_conf *mdev,

set_bit(BITMAP_IO, &mdev->flags);
if (atomic_read(&mdev->ap_bio_cnt) == 0) {
if (list_empty(&mdev->bm_io_work.w.list)) {
set_bit(BITMAP_IO_QUEUED, &mdev->flags);
if (!test_and_set_bit(BITMAP_IO_QUEUED, &mdev->flags))
drbd_queue_work(&mdev->data.work, &mdev->bm_io_work.w);
} else
dev_err(DEV, "FIXME avoided double queuing bm_io_work\n");
}
}

Expand Down

0 comments on commit 127b317

Please sign in to comment.