diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-13 13:45:01 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-13 13:45:01 -0500 |
commit | 275220f0fcff1adf28a717076e00f575edf05fda (patch) | |
tree | d249bccc80c64443dab211639050c4fb14332648 /drivers/md | |
parent | fe3c560b8a22cb28e54fe8950abef38e88d75831 (diff) | |
parent | 81c5e2ae33c4b19e53966b427e33646bf6811830 (diff) |
Merge branch 'for-2.6.38/core' of git://git.kernel.dk/linux-2.6-block
* 'for-2.6.38/core' of git://git.kernel.dk/linux-2.6-block: (43 commits)
block: ensure that completion error gets properly traced
blktrace: add missing probe argument to block_bio_complete
block cfq: don't use atomic_t for cfq_group
block cfq: don't use atomic_t for cfq_queue
block: trace event block fix unassigned field
block: add internal hd part table references
block: fix accounting bug on cross partition merges
kref: add kref_test_and_get
bio-integrity: mark kintegrityd_wq highpri and CPU intensive
block: make kblockd_workqueue smarter
Revert "sd: implement sd_check_events()"
block: Clean up exit_io_context() source code.
Fix compile warnings due to missing removal of a 'ret' variable
fs/block: type signature of major_to_index(int) to major_to_index(unsigned)
block: convert !IS_ERR(p) && p to !IS_ERR_NOR_NULL(p)
cfq-iosched: don't check cfqg in choose_service_tree()
fs/splice: Pull buf->ops->confirm() from splice_from_pipe actors
cdrom: export cdrom_check_events()
sd: implement sd_check_events()
sr: implement sr_check_events()
...
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/dm-table.c | 20 | ||||
-rw-r--r-- | drivers/md/dm.c | 6 | ||||
-rw-r--r-- | drivers/md/md.c | 16 |
3 files changed, 18 insertions, 24 deletions
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index 4d705cea0f8c..985c20a4f30e 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, | |||
325 | 325 | ||
326 | BUG_ON(d->dm_dev.bdev); | 326 | BUG_ON(d->dm_dev.bdev); |
327 | 327 | ||
328 | bdev = open_by_devnum(dev, d->dm_dev.mode); | 328 | bdev = blkdev_get_by_dev(dev, d->dm_dev.mode | FMODE_EXCL, _claim_ptr); |
329 | if (IS_ERR(bdev)) | 329 | if (IS_ERR(bdev)) |
330 | return PTR_ERR(bdev); | 330 | return PTR_ERR(bdev); |
331 | r = bd_claim_by_disk(bdev, _claim_ptr, dm_disk(md)); | 331 | |
332 | if (r) | 332 | r = bd_link_disk_holder(bdev, dm_disk(md)); |
333 | blkdev_put(bdev, d->dm_dev.mode); | 333 | if (r) { |
334 | else | 334 | blkdev_put(bdev, d->dm_dev.mode | FMODE_EXCL); |
335 | d->dm_dev.bdev = bdev; | 335 | return r; |
336 | return r; | 336 | } |
337 | |||
338 | d->dm_dev.bdev = bdev; | ||
339 | return 0; | ||
337 | } | 340 | } |
338 | 341 | ||
339 | /* | 342 | /* |
@@ -344,8 +347,7 @@ static void close_dev(struct dm_dev_internal *d, struct mapped_device *md) | |||
344 | if (!d->dm_dev.bdev) | 347 | if (!d->dm_dev.bdev) |
345 | return; | 348 | return; |
346 | 349 | ||
347 | bd_release_from_disk(d->dm_dev.bdev, dm_disk(md)); | 350 | blkdev_put(d->dm_dev.bdev, d->dm_dev.mode | FMODE_EXCL); |
348 | blkdev_put(d->dm_dev.bdev, d->dm_dev.mode); | ||
349 | d->dm_dev.bdev = NULL; | 351 | d->dm_dev.bdev = NULL; |
350 | } | 352 | } |
351 | 353 | ||
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 7cb1352f7e7a..f48a2f359ac4 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
@@ -630,7 +630,7 @@ static void dec_pending(struct dm_io *io, int error) | |||
630 | queue_io(md, bio); | 630 | queue_io(md, bio); |
631 | } else { | 631 | } else { |
632 | /* done with normal IO or empty flush */ | 632 | /* done with normal IO or empty flush */ |
633 | trace_block_bio_complete(md->queue, bio); | 633 | trace_block_bio_complete(md->queue, bio, io_error); |
634 | bio_endio(bio, io_error); | 634 | bio_endio(bio, io_error); |
635 | } | 635 | } |
636 | } | 636 | } |
@@ -990,8 +990,8 @@ static void __map_bio(struct dm_target *ti, struct bio *clone, | |||
990 | if (r == DM_MAPIO_REMAPPED) { | 990 | if (r == DM_MAPIO_REMAPPED) { |
991 | /* the bio has been remapped so dispatch it */ | 991 | /* the bio has been remapped so dispatch it */ |
992 | 992 | ||
993 | trace_block_remap(bdev_get_queue(clone->bi_bdev), clone, | 993 | trace_block_bio_remap(bdev_get_queue(clone->bi_bdev), clone, |
994 | tio->io->bio->bi_bdev->bd_dev, sector); | 994 | tio->io->bio->bi_bdev->bd_dev, sector); |
995 | 995 | ||
996 | generic_make_request(clone); | 996 | generic_make_request(clone); |
997 | } else if (r < 0 || r == DM_MAPIO_REQUEUE) { | 997 | } else if (r < 0 || r == DM_MAPIO_REQUEUE) { |
diff --git a/drivers/md/md.c b/drivers/md/md.c index 175c424f201f..7fc090ac9e28 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -1879,7 +1879,7 @@ static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev) | |||
1879 | rdev->sysfs_state = sysfs_get_dirent_safe(rdev->kobj.sd, "state"); | 1879 | rdev->sysfs_state = sysfs_get_dirent_safe(rdev->kobj.sd, "state"); |
1880 | 1880 | ||
1881 | list_add_rcu(&rdev->same_set, &mddev->disks); | 1881 | list_add_rcu(&rdev->same_set, &mddev->disks); |
1882 | bd_claim_by_disk(rdev->bdev, rdev->bdev->bd_holder, mddev->gendisk); | 1882 | bd_link_disk_holder(rdev->bdev, mddev->gendisk); |
1883 | 1883 | ||
1884 | /* May as well allow recovery to be retried once */ | 1884 | /* May as well allow recovery to be retried once */ |
1885 | mddev->recovery_disabled = 0; | 1885 | mddev->recovery_disabled = 0; |
@@ -1906,7 +1906,6 @@ static void unbind_rdev_from_array(mdk_rdev_t * rdev) | |||
1906 | MD_BUG(); | 1906 | MD_BUG(); |
1907 | return; | 1907 | return; |
1908 | } | 1908 | } |
1909 | bd_release_from_disk(rdev->bdev, rdev->mddev->gendisk); | ||
1910 | list_del_rcu(&rdev->same_set); | 1909 | list_del_rcu(&rdev->same_set); |
1911 | printk(KERN_INFO "md: unbind<%s>\n", bdevname(rdev->bdev,b)); | 1910 | printk(KERN_INFO "md: unbind<%s>\n", bdevname(rdev->bdev,b)); |
1912 | rdev->mddev = NULL; | 1911 | rdev->mddev = NULL; |
@@ -1934,19 +1933,13 @@ static int lock_rdev(mdk_rdev_t *rdev, dev_t dev, int shared) | |||
1934 | struct block_device *bdev; | 1933 | struct block_device *bdev; |
1935 | char b[BDEVNAME_SIZE]; | 1934 | char b[BDEVNAME_SIZE]; |
1936 | 1935 | ||
1937 | bdev = open_by_devnum(dev, FMODE_READ|FMODE_WRITE); | 1936 | bdev = blkdev_get_by_dev(dev, FMODE_READ|FMODE_WRITE|FMODE_EXCL, |
1937 | shared ? (mdk_rdev_t *)lock_rdev : rdev); | ||
1938 | if (IS_ERR(bdev)) { | 1938 | if (IS_ERR(bdev)) { |
1939 | printk(KERN_ERR "md: could not open %s.\n", | 1939 | printk(KERN_ERR "md: could not open %s.\n", |
1940 | __bdevname(dev, b)); | 1940 | __bdevname(dev, b)); |
1941 | return PTR_ERR(bdev); | 1941 | return PTR_ERR(bdev); |
1942 | } | 1942 | } |
1943 | err = bd_claim(bdev, shared ? (mdk_rdev_t *)lock_rdev : rdev); | ||
1944 | if (err) { | ||
1945 | printk(KERN_ERR "md: could not bd_claim %s.\n", | ||
1946 | bdevname(bdev, b)); | ||
1947 | blkdev_put(bdev, FMODE_READ|FMODE_WRITE); | ||
1948 | return err; | ||
1949 | } | ||
1950 | if (!shared) | 1943 | if (!shared) |
1951 | set_bit(AllReserved, &rdev->flags); | 1944 | set_bit(AllReserved, &rdev->flags); |
1952 | rdev->bdev = bdev; | 1945 | rdev->bdev = bdev; |
@@ -1959,8 +1952,7 @@ static void unlock_rdev(mdk_rdev_t *rdev) | |||
1959 | rdev->bdev = NULL; | 1952 | rdev->bdev = NULL; |
1960 | if (!bdev) | 1953 | if (!bdev) |
1961 | MD_BUG(); | 1954 | MD_BUG(); |
1962 | bd_release(bdev); | 1955 | blkdev_put(bdev, FMODE_READ|FMODE_WRITE|FMODE_EXCL); |
1963 | blkdev_put(bdev, FMODE_READ|FMODE_WRITE); | ||
1964 | } | 1956 | } |
1965 | 1957 | ||
1966 | void md_autodetect_dev(dev_t dev); | 1958 | void md_autodetect_dev(dev_t dev); |