aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/md.c
diff options
context:
space:
mode:
authorJens Axboe <jaxboe@fusionio.com>2010-11-27 13:49:18 -0500
committerJens Axboe <jaxboe@fusionio.com>2010-11-27 13:49:18 -0500
commitf30195c50245d8ace628e1978b1daa8df86e7224 (patch)
treeedf4f91c4356c41d50fb07f15cebd1e6442538ad /drivers/md/md.c
parentd07335e51df0c6dec202d315fc4f1f7e100eec4e (diff)
parentd4d77629953eabd3c14f6fa5746f6b28babfc55f (diff)
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/md.c')
-rw-r--r--drivers/md/md.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 324a3663fcda..3bacccab1b8c 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -1880,7 +1880,7 @@ static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev)
1880 rdev->sysfs_state = sysfs_get_dirent_safe(rdev->kobj.sd, "state"); 1880 rdev->sysfs_state = sysfs_get_dirent_safe(rdev->kobj.sd, "state");
1881 1881
1882 list_add_rcu(&rdev->same_set, &mddev->disks); 1882 list_add_rcu(&rdev->same_set, &mddev->disks);
1883 bd_claim_by_disk(rdev->bdev, rdev->bdev->bd_holder, mddev->gendisk); 1883 bd_link_disk_holder(rdev->bdev, mddev->gendisk);
1884 1884
1885 /* May as well allow recovery to be retried once */ 1885 /* May as well allow recovery to be retried once */
1886 mddev->recovery_disabled = 0; 1886 mddev->recovery_disabled = 0;
@@ -1907,7 +1907,6 @@ static void unbind_rdev_from_array(mdk_rdev_t * rdev)
1907 MD_BUG(); 1907 MD_BUG();
1908 return; 1908 return;
1909 } 1909 }
1910 bd_release_from_disk(rdev->bdev, rdev->mddev->gendisk);
1911 list_del_rcu(&rdev->same_set); 1910 list_del_rcu(&rdev->same_set);
1912 printk(KERN_INFO "md: unbind<%s>\n", bdevname(rdev->bdev,b)); 1911 printk(KERN_INFO "md: unbind<%s>\n", bdevname(rdev->bdev,b));
1913 rdev->mddev = NULL; 1912 rdev->mddev = NULL;
@@ -1935,19 +1934,13 @@ static int lock_rdev(mdk_rdev_t *rdev, dev_t dev, int shared)
1935 struct block_device *bdev; 1934 struct block_device *bdev;
1936 char b[BDEVNAME_SIZE]; 1935 char b[BDEVNAME_SIZE];
1937 1936
1938 bdev = open_by_devnum(dev, FMODE_READ|FMODE_WRITE); 1937 bdev = blkdev_get_by_dev(dev, FMODE_READ|FMODE_WRITE|FMODE_EXCL,
1938 shared ? (mdk_rdev_t *)lock_rdev : rdev);
1939 if (IS_ERR(bdev)) { 1939 if (IS_ERR(bdev)) {
1940 printk(KERN_ERR "md: could not open %s.\n", 1940 printk(KERN_ERR "md: could not open %s.\n",
1941 __bdevname(dev, b)); 1941 __bdevname(dev, b));
1942 return PTR_ERR(bdev); 1942 return PTR_ERR(bdev);
1943 } 1943 }
1944 err = bd_claim(bdev, shared ? (mdk_rdev_t *)lock_rdev : rdev);
1945 if (err) {
1946 printk(KERN_ERR "md: could not bd_claim %s.\n",
1947 bdevname(bdev, b));
1948 blkdev_put(bdev, FMODE_READ|FMODE_WRITE);
1949 return err;
1950 }
1951 if (!shared) 1944 if (!shared)
1952 set_bit(AllReserved, &rdev->flags); 1945 set_bit(AllReserved, &rdev->flags);
1953 rdev->bdev = bdev; 1946 rdev->bdev = bdev;
@@ -1960,8 +1953,7 @@ static void unlock_rdev(mdk_rdev_t *rdev)
1960 rdev->bdev = NULL; 1953 rdev->bdev = NULL;
1961 if (!bdev) 1954 if (!bdev)
1962 MD_BUG(); 1955 MD_BUG();
1963 bd_release(bdev); 1956 blkdev_put(bdev, FMODE_READ|FMODE_WRITE|FMODE_EXCL);
1964 blkdev_put(bdev, FMODE_READ|FMODE_WRITE);
1965} 1957}
1966 1958
1967void md_autodetect_dev(dev_t dev); 1959void md_autodetect_dev(dev_t dev);