From: Thomas Gleixner <tglx@linutronix.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Christoph Hellwig <hch@infradead.org>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@elte.hu>,
Lars Ellenberg <drbd-dev@lists.linbit.com>,
Philipp Reisner <philipp.reisner@linbit.com>,
Jens Axboe <axboe@kernel.dk>,
drbd-user@lists.linbit.com
Subject: [patch 09/10] block: drbd: Convert semaphore to mutex
Date: Fri, 29 Jan 2010 20:39:07 -0000 [thread overview]
Message-ID: <20100129203613.703416262@linutronix.de> (raw)
In-Reply-To: 20100129203549.526478432@linutronix.de
[-- Attachment #1: drivers-block-drbd-use-mutex.patch --]
[-- Type: text/plain, Size: 2055 bytes --]
The bm_change semaphore is semantically a mutex. Convert it to a real
mutex.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Lars Ellenberg <drbd-dev@lists.linbit.com>
Cc: Philipp Reisner <philipp.reisner@linbit.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: drbd-user@lists.linbit.com
---
drivers/block/drbd/drbd_bitmap.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
Index: linux-2.6-tip/drivers/block/drbd/drbd_bitmap.c
===================================================================
--- linux-2.6-tip.orig/drivers/block/drbd/drbd_bitmap.c
+++ linux-2.6-tip/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
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
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 *md
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;
next prev parent reply other threads:[~2010-01-29 20:39 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-29 20:38 [patch 00/10] semaphore to mutex conversions Thomas Gleixner
2010-01-29 20:38 ` [patch 01/10] smbfs: Convert server->sem to mutex Thomas Gleixner
2010-01-29 22:14 ` Christoph Hellwig
2010-01-29 20:38 ` [patch 02/10] hpfs: Convert sbi->hpfs_creation_de " Thomas Gleixner
2010-01-29 22:20 ` Christoph Hellwig
2010-01-29 20:38 ` [patch 03/10] hpfsplus: Convert tree_lock " Thomas Gleixner
2010-01-29 22:23 ` Christoph Hellwig
2010-01-29 20:38 ` [patch 04/10] hfs: " Thomas Gleixner
2010-01-29 22:26 ` Christoph Hellwig
2010-01-29 20:38 ` [patch 05/10] cifs: convert semaphore " Thomas Gleixner
2010-01-29 22:29 ` Christoph Hellwig
2010-01-29 20:38 ` [patch 06/10] affs: Convert semaphores to mutexes Thomas Gleixner
2010-01-29 22:25 ` Al Viro
2010-01-29 22:36 ` Christoph Hellwig
2010-01-29 23:03 ` Thomas Gleixner
2010-01-29 23:41 ` Al Viro
2010-01-29 20:38 ` [patch 07/10] usb: gadgetfs: Convert semaphore to mutex Thomas Gleixner
2010-01-29 21:14 ` Greg KH
2010-01-29 21:48 ` Thomas Gleixner
2010-01-29 22:07 ` Greg KH
2010-01-29 23:04 ` Thomas Gleixner
2010-01-30 5:27 ` Greg KH
2010-01-29 20:39 ` [patch 08/10] drivers/base: Convert dev->sem " Thomas Gleixner
2010-01-29 21:13 ` Greg KH
2010-01-29 21:48 ` Thomas Gleixner
2010-01-30 5:26 ` Greg KH
2010-01-29 20:39 ` Thomas Gleixner [this message]
2010-01-29 20:39 ` [patch 10/10] hwmon: s3c-hwmon: Convert semaphore " Thomas Gleixner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100129203613.703416262@linutronix.de \
--to=tglx@linutronix.de \
--cc=axboe@kernel.dk \
--cc=drbd-dev@lists.linbit.com \
--cc=drbd-user@lists.linbit.com \
--cc=hch@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=philipp.reisner@linbit.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox