Skip to content

Commit

Permalink
dm: remove dm_mutex after bkl conversion
Browse files Browse the repository at this point in the history
This patch replaces dm_mutex with _minor_lock in dm_blk_close()
and then removes it.

During the BKL conversion, commit 6e9624b
(block: push down BKL into .open and .release) pushed lock_kernel()
down into dm_blk_open/close calls.
Commit 2a48fc0
(block: autoconvert trivial BKL users to private mutex) converted it to a
local mutex, but _minor_lock is sufficient.

Signed-off-by: Milan Broz <mbroz@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
  • Loading branch information
Milan Broz authored and Alasdair G Kergon committed Jan 13, 2011
1 parent 5fc2ffe commit 4a1aeb9
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions drivers/md/dm.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#define DM_COOKIE_ENV_VAR_NAME "DM_COOKIE"
#define DM_COOKIE_LENGTH 24

static DEFINE_MUTEX(dm_mutex);
static const char *_name = DM_NAME;

static unsigned int major = 0;
Expand Down Expand Up @@ -328,7 +327,6 @@ static int dm_blk_open(struct block_device *bdev, fmode_t mode)
{
struct mapped_device *md;

mutex_lock(&dm_mutex);
spin_lock(&_minor_lock);

md = bdev->bd_disk->private_data;
Expand All @@ -346,7 +344,6 @@ static int dm_blk_open(struct block_device *bdev, fmode_t mode)

out:
spin_unlock(&_minor_lock);
mutex_unlock(&dm_mutex);

return md ? 0 : -ENXIO;
}
Expand All @@ -355,10 +352,12 @@ static int dm_blk_close(struct gendisk *disk, fmode_t mode)
{
struct mapped_device *md = disk->private_data;

mutex_lock(&dm_mutex);
spin_lock(&_minor_lock);

atomic_dec(&md->open_count);
dm_put(md);
mutex_unlock(&dm_mutex);

spin_unlock(&_minor_lock);

return 0;
}
Expand Down

0 comments on commit 4a1aeb9

Please sign in to comment.