| From 085043eb5bfd10eb0866ced0983f66b7f3548260 Mon Sep 17 00:00:00 2001 |
| From: Paul Gortmaker <paul.gortmaker@windriver.com> |
| Date: Sun, 23 Jan 2011 16:12:49 -0500 |
| Subject: [PATCH] drbd: convert bitmap from semaphore to mutex |
| |
| This is one of several extractions from the merge up to 33-rc8. |
| |
| See it in a git tip repo with: |
| |
| git diff 5f854cfc024622e4aae14d7cf422f6ff86278688^2 \ |
| 5f854cfc024622e4aae14d7cf422f6ff86278688 \ |
| drivers/block/drbd/drbd_bitmap.c |
| |
| You can find the origin of this change in the tip merge commit: |
| |
| commit 5f854cfc024622e4aae14d7cf422f6ff86278688 |
| Merge: cc24da0 4ec62b2 |
| Author: Thomas Gleixner <tglx@linutronix.de> |
| Date: Sun Feb 21 20:17:22 2010 +0100 |
| |
| Forward to 2.6.33-rc8 |
| |
| Merge branch 'linus' into rt/head with a pile of conflicts. |
| |
| Signed-off-by: Thomas Gleixner <tglx@linutronix.de> |
| |
| Normally there are not significant changes/additions in a merge commit that |
| are not from any other "normal" commit. But in this case there are, so |
| break them out into separate explicit commits. |
| |
| Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> |
| |
| diff --git a/drivers/block/drbd/drbd_bitmap.c b/drivers/block/drbd/drbd_bitmap.c |
| index b61057e..f58e765 100644 |
| --- a/drivers/block/drbd/drbd_bitmap.c |
| +++ b/drivers/block/drbd/drbd_bitmap.c |
| @@ -66,7 +66,7 @@ struct drbd_bitmap { |
| size_t bm_words; |
| size_t bm_number_of_pages; |
| sector_t bm_dev_capacity; |
| - struct semaphore bm_change; /* serializes resize operations */ |
| + struct mutex bm_change; /* serializes resize operations */ |
| |
| atomic_t bm_async_io; |
| wait_queue_head_t bm_io_wait; |
| @@ -114,7 +114,7 @@ void drbd_bm_lock(struct drbd_conf *mdev, char *why) |
| return; |
| } |
| |
| - trylock_failed = down_trylock(&b->bm_change); |
| + trylock_failed = !mutex_trylock(&b->bm_change); |
| |
| if (trylock_failed) { |
| 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) |
| b->bm_task == mdev->receiver.task ? "receiver" : |
| b->bm_task == mdev->asender.task ? "asender" : |
| b->bm_task == mdev->worker.task ? "worker" : "?"); |
| - down(&b->bm_change); |
| + mutex_lock(&b->bm_change); |
| } |
| if (__test_and_set_bit(BM_LOCKED, &b->bm_flags)) |
| dev_err(DEV, "FIXME bitmap already locked in bm_lock\n"); |
| @@ -147,7 +147,7 @@ void drbd_bm_unlock(struct drbd_conf *mdev) |
| |
| b->bm_why = NULL; |
| b->bm_task = NULL; |
| - up(&b->bm_change); |
| + mutex_unlock(&b->bm_change); |
| } |
| |
| /* word offset to long pointer */ |
| @@ -295,7 +295,7 @@ int drbd_bm_init(struct drbd_conf *mdev) |
| if (!b) |
| return -ENOMEM; |
| spin_lock_init(&b->bm_lock); |
| - init_MUTEX(&b->bm_change); |
| + mutex_init(&b->bm_change); |
| init_waitqueue_head(&b->bm_io_wait); |
| |
| mdev->bitmap = b; |
| -- |
| 1.7.1.1 |
| |