diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2010-01-29 15:39:07 -0500 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2010-03-11 07:30:16 -0500 |
commit | 8a03ae2a5baed3df09e5643615bdd853fc142a09 (patch) | |
tree | f0e46a5479cc3f2e668207df20ce2cef73976dd3 | |
parent | 881245dcff29df992d8431392a41fb81549129f9 (diff) |
block: drbd: Convert semaphore to mutex
The bm_change semaphore is semantically a mutex. Convert it to a real
mutex.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
-rw-r--r-- | drivers/block/drbd/drbd_bitmap.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/block/drbd/drbd_bitmap.c b/drivers/block/drbd/drbd_bitmap.c index b61057e77882..f58e76581c4b 100644 --- a/drivers/block/drbd/drbd_bitmap.c +++ b/drivers/block/drbd/drbd_bitmap.c | |||
@@ -66,7 +66,7 @@ struct drbd_bitmap { | |||
66 | size_t bm_words; | 66 | size_t bm_words; |
67 | size_t bm_number_of_pages; | 67 | size_t bm_number_of_pages; |
68 | sector_t bm_dev_capacity; | 68 | sector_t bm_dev_capacity; |
69 | struct semaphore bm_change; /* serializes resize operations */ | 69 | struct mutex bm_change; /* serializes resize operations */ |
70 | 70 | ||
71 | atomic_t bm_async_io; | 71 | atomic_t bm_async_io; |
72 | wait_queue_head_t bm_io_wait; | 72 | wait_queue_head_t bm_io_wait; |
@@ -114,7 +114,7 @@ void drbd_bm_lock(struct drbd_conf *mdev, char *why) | |||
114 | return; | 114 | return; |
115 | } | 115 | } |
116 | 116 | ||
117 | trylock_failed = down_trylock(&b->bm_change); | 117 | trylock_failed = !mutex_trylock(&b->bm_change); |
118 | 118 | ||
119 | if (trylock_failed) { | 119 | if (trylock_failed) { |
120 | dev_warn(DEV, "%s going to '%s' but bitmap already locked for '%s' by %s\n", | 120 | dev_warn(DEV, "%s going to '%s' but bitmap already locked for '%s' by %s\n", |
@@ -125,7 +125,7 @@ void drbd_bm_lock(struct drbd_conf *mdev, char *why) | |||
125 | b->bm_task == mdev->receiver.task ? "receiver" : | 125 | b->bm_task == mdev->receiver.task ? "receiver" : |
126 | b->bm_task == mdev->asender.task ? "asender" : | 126 | b->bm_task == mdev->asender.task ? "asender" : |
127 | b->bm_task == mdev->worker.task ? "worker" : "?"); | 127 | b->bm_task == mdev->worker.task ? "worker" : "?"); |
128 | down(&b->bm_change); | 128 | mutex_lock(&b->bm_change); |
129 | } | 129 | } |
130 | if (__test_and_set_bit(BM_LOCKED, &b->bm_flags)) | 130 | if (__test_and_set_bit(BM_LOCKED, &b->bm_flags)) |
131 | dev_err(DEV, "FIXME bitmap already locked in bm_lock\n"); | 131 | dev_err(DEV, "FIXME bitmap already locked in bm_lock\n"); |
@@ -147,7 +147,7 @@ void drbd_bm_unlock(struct drbd_conf *mdev) | |||
147 | 147 | ||
148 | b->bm_why = NULL; | 148 | b->bm_why = NULL; |
149 | b->bm_task = NULL; | 149 | b->bm_task = NULL; |
150 | up(&b->bm_change); | 150 | mutex_unlock(&b->bm_change); |
151 | } | 151 | } |
152 | 152 | ||
153 | /* word offset to long pointer */ | 153 | /* word offset to long pointer */ |
@@ -295,7 +295,7 @@ int drbd_bm_init(struct drbd_conf *mdev) | |||
295 | if (!b) | 295 | if (!b) |
296 | return -ENOMEM; | 296 | return -ENOMEM; |
297 | spin_lock_init(&b->bm_lock); | 297 | spin_lock_init(&b->bm_lock); |
298 | init_MUTEX(&b->bm_change); | 298 | mutex_init(&b->bm_change); |
299 | init_waitqueue_head(&b->bm_io_wait); | 299 | init_waitqueue_head(&b->bm_io_wait); |
300 | 300 | ||
301 | mdev->bitmap = b; | 301 | mdev->bitmap = b; |