aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-table.c
diff options
context:
space:
mode:
authorJens Axboe <jaxboe@fusionio.com>2010-11-27 19:49:18 +0100
committerJens Axboe <jaxboe@fusionio.com>2010-11-27 19:49:18 +0100
commitf30195c50245d8ace628e1978b1daa8df86e7224 (patch)
treeedf4f91c4356c41d50fb07f15cebd1e6442538ad /drivers/md/dm-table.c
parentd07335e51df0c6dec202d315fc4f1f7e100eec4e (diff)
parentd4d77629953eabd3c14f6fa5746f6b28babfc55f (diff)
downloadkernel_samsung_smdk4412-f30195c50245d8ace628e1978b1daa8df86e7224.zip
kernel_samsung_smdk4412-f30195c50245d8ace628e1978b1daa8df86e7224.tar.gz
kernel_samsung_smdk4412-f30195c50245d8ace628e1978b1daa8df86e7224.tar.bz2
Merge branch 'cleanup-bd_claim' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/misc into for-2.6.38/core
Diffstat (limited to 'drivers/md/dm-table.c')
-rw-r--r--drivers/md/dm-table.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 90267f8..67150c3 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -325,15 +325,18 @@ static int open_dev(struct dm_dev_internal *d, dev_t dev,
BUG_ON(d->dm_dev.bdev);
- bdev = open_by_devnum(dev, d->dm_dev.mode);
+ bdev = blkdev_get_by_dev(dev, d->dm_dev.mode | FMODE_EXCL, _claim_ptr);
if (IS_ERR(bdev))
return PTR_ERR(bdev);
- r = bd_claim_by_disk(bdev, _claim_ptr, dm_disk(md));
- if (r)
- blkdev_put(bdev, d->dm_dev.mode);
- else
- d->dm_dev.bdev = bdev;
- return r;
+
+ r = bd_link_disk_holder(bdev, dm_disk(md));
+ if (r) {
+ blkdev_put(bdev, d->dm_dev.mode | FMODE_EXCL);
+ return r;
+ }
+
+ d->dm_dev.bdev = bdev;
+ return 0;
}
/*
@@ -344,8 +347,7 @@ static void close_dev(struct dm_dev_internal *d, struct mapped_device *md)
if (!d->dm_dev.bdev)
return;
- bd_release_from_disk(d->dm_dev.bdev, dm_disk(md));
- blkdev_put(d->dm_dev.bdev, d->dm_dev.mode);
+ blkdev_put(d->dm_dev.bdev, d->dm_dev.mode | FMODE_EXCL);
d->dm_dev.bdev = NULL;
}