diff options
Diffstat (limited to 'drivers/block/drbd/drbd_bitmap.c')
-rw-r--r-- | drivers/block/drbd/drbd_bitmap.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/block/drbd/drbd_bitmap.c b/drivers/block/drbd/drbd_bitmap.c index b61057e77882..3390716898d5 100644 --- a/drivers/block/drbd/drbd_bitmap.c +++ b/drivers/block/drbd/drbd_bitmap.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/vmalloc.h> | 26 | #include <linux/vmalloc.h> |
27 | #include <linux/string.h> | 27 | #include <linux/string.h> |
28 | #include <linux/drbd.h> | 28 | #include <linux/drbd.h> |
29 | #include <linux/slab.h> | ||
29 | #include <asm/kmap_types.h> | 30 | #include <asm/kmap_types.h> |
30 | #include "drbd_int.h" | 31 | #include "drbd_int.h" |
31 | 32 | ||
@@ -66,7 +67,7 @@ struct drbd_bitmap { | |||
66 | size_t bm_words; | 67 | size_t bm_words; |
67 | size_t bm_number_of_pages; | 68 | size_t bm_number_of_pages; |
68 | sector_t bm_dev_capacity; | 69 | sector_t bm_dev_capacity; |
69 | struct semaphore bm_change; /* serializes resize operations */ | 70 | struct mutex bm_change; /* serializes resize operations */ |
70 | 71 | ||
71 | atomic_t bm_async_io; | 72 | atomic_t bm_async_io; |
72 | wait_queue_head_t bm_io_wait; | 73 | wait_queue_head_t bm_io_wait; |
@@ -114,7 +115,7 @@ void drbd_bm_lock(struct drbd_conf *mdev, char *why) | |||
114 | return; | 115 | return; |
115 | } | 116 | } |
116 | 117 | ||
117 | trylock_failed = down_trylock(&b->bm_change); | 118 | trylock_failed = !mutex_trylock(&b->bm_change); |
118 | 119 | ||
119 | if (trylock_failed) { | 120 | if (trylock_failed) { |
120 | dev_warn(DEV, "%s going to '%s' but bitmap already locked for '%s' by %s\n", | 121 | dev_warn(DEV, "%s going to '%s' but bitmap already locked for '%s' by %s\n", |
@@ -125,7 +126,7 @@ void drbd_bm_lock(struct drbd_conf *mdev, char *why) | |||
125 | b->bm_task == mdev->receiver.task ? "receiver" : | 126 | b->bm_task == mdev->receiver.task ? "receiver" : |
126 | b->bm_task == mdev->asender.task ? "asender" : | 127 | b->bm_task == mdev->asender.task ? "asender" : |
127 | b->bm_task == mdev->worker.task ? "worker" : "?"); | 128 | b->bm_task == mdev->worker.task ? "worker" : "?"); |
128 | down(&b->bm_change); | 129 | mutex_lock(&b->bm_change); |
129 | } | 130 | } |
130 | if (__test_and_set_bit(BM_LOCKED, &b->bm_flags)) | 131 | if (__test_and_set_bit(BM_LOCKED, &b->bm_flags)) |
131 | dev_err(DEV, "FIXME bitmap already locked in bm_lock\n"); | 132 | dev_err(DEV, "FIXME bitmap already locked in bm_lock\n"); |
@@ -147,7 +148,7 @@ void drbd_bm_unlock(struct drbd_conf *mdev) | |||
147 | 148 | ||
148 | b->bm_why = NULL; | 149 | b->bm_why = NULL; |
149 | b->bm_task = NULL; | 150 | b->bm_task = NULL; |
150 | up(&b->bm_change); | 151 | mutex_unlock(&b->bm_change); |
151 | } | 152 | } |
152 | 153 | ||
153 | /* word offset to long pointer */ | 154 | /* word offset to long pointer */ |
@@ -295,7 +296,7 @@ int drbd_bm_init(struct drbd_conf *mdev) | |||
295 | if (!b) | 296 | if (!b) |
296 | return -ENOMEM; | 297 | return -ENOMEM; |
297 | spin_lock_init(&b->bm_lock); | 298 | spin_lock_init(&b->bm_lock); |
298 | init_MUTEX(&b->bm_change); | 299 | mutex_init(&b->bm_change); |
299 | init_waitqueue_head(&b->bm_io_wait); | 300 | init_waitqueue_head(&b->bm_io_wait); |
300 | 301 | ||
301 | mdev->bitmap = b; | 302 | mdev->bitmap = b; |