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/block | |
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/block')
-rw-r--r-- | drivers/block/drbd/drbd_int.h | 2 | ||||
-rw-r--r-- | drivers/block/drbd/drbd_main.c | 7 | ||||
-rw-r--r-- | drivers/block/drbd/drbd_nl.c | 103 | ||||
-rw-r--r-- | drivers/block/loop.c | 6 | ||||
-rw-r--r-- | drivers/block/pktcdvd.c | 22 |
5 files changed, 47 insertions, 93 deletions
diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h index 1ea1a34e78b2..3803a0348937 100644 --- a/drivers/block/drbd/drbd_int.h +++ b/drivers/block/drbd/drbd_int.h | |||
@@ -911,8 +911,6 @@ struct drbd_md { | |||
911 | struct drbd_backing_dev { | 911 | struct drbd_backing_dev { |
912 | struct block_device *backing_bdev; | 912 | struct block_device *backing_bdev; |
913 | struct block_device *md_bdev; | 913 | struct block_device *md_bdev; |
914 | struct file *lo_file; | ||
915 | struct file *md_file; | ||
916 | struct drbd_md md; | 914 | struct drbd_md md; |
917 | struct disk_conf dc; /* The user provided config... */ | 915 | struct disk_conf dc; /* The user provided config... */ |
918 | sector_t known_size; /* last known size of that backing device */ | 916 | sector_t known_size; /* last known size of that backing device */ |
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c index 6be5401d0e88..29cd0dc9fe4f 100644 --- a/drivers/block/drbd/drbd_main.c +++ b/drivers/block/drbd/drbd_main.c | |||
@@ -3372,11 +3372,8 @@ void drbd_free_bc(struct drbd_backing_dev *ldev) | |||
3372 | if (ldev == NULL) | 3372 | if (ldev == NULL) |
3373 | return; | 3373 | return; |
3374 | 3374 | ||
3375 | bd_release(ldev->backing_bdev); | 3375 | blkdev_put(ldev->backing_bdev, FMODE_READ | FMODE_WRITE | FMODE_EXCL); |
3376 | bd_release(ldev->md_bdev); | 3376 | blkdev_put(ldev->md_bdev, FMODE_READ | FMODE_WRITE | FMODE_EXCL); |
3377 | |||
3378 | fput(ldev->lo_file); | ||
3379 | fput(ldev->md_file); | ||
3380 | 3377 | ||
3381 | kfree(ldev); | 3378 | kfree(ldev); |
3382 | } | 3379 | } |
diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c index 29e5c70e4e26..8cbfaa687d72 100644 --- a/drivers/block/drbd/drbd_nl.c +++ b/drivers/block/drbd/drbd_nl.c | |||
@@ -855,7 +855,7 @@ static int drbd_nl_disk_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp | |||
855 | sector_t max_possible_sectors; | 855 | sector_t max_possible_sectors; |
856 | sector_t min_md_device_sectors; | 856 | sector_t min_md_device_sectors; |
857 | struct drbd_backing_dev *nbc = NULL; /* new_backing_conf */ | 857 | struct drbd_backing_dev *nbc = NULL; /* new_backing_conf */ |
858 | struct inode *inode, *inode2; | 858 | struct block_device *bdev; |
859 | struct lru_cache *resync_lru = NULL; | 859 | struct lru_cache *resync_lru = NULL; |
860 | union drbd_state ns, os; | 860 | union drbd_state ns, os; |
861 | unsigned int max_seg_s; | 861 | unsigned int max_seg_s; |
@@ -907,46 +907,40 @@ static int drbd_nl_disk_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp | |||
907 | } | 907 | } |
908 | } | 908 | } |
909 | 909 | ||
910 | nbc->lo_file = filp_open(nbc->dc.backing_dev, O_RDWR, 0); | 910 | bdev = blkdev_get_by_path(nbc->dc.backing_dev, |
911 | if (IS_ERR(nbc->lo_file)) { | 911 | FMODE_READ | FMODE_WRITE | FMODE_EXCL, mdev); |
912 | if (IS_ERR(bdev)) { | ||
912 | dev_err(DEV, "open(\"%s\") failed with %ld\n", nbc->dc.backing_dev, | 913 | dev_err(DEV, "open(\"%s\") failed with %ld\n", nbc->dc.backing_dev, |
913 | PTR_ERR(nbc->lo_file)); | 914 | PTR_ERR(bdev)); |
914 | nbc->lo_file = NULL; | ||
915 | retcode = ERR_OPEN_DISK; | 915 | retcode = ERR_OPEN_DISK; |
916 | goto fail; | 916 | goto fail; |
917 | } | 917 | } |
918 | nbc->backing_bdev = bdev; | ||
918 | 919 | ||
919 | inode = nbc->lo_file->f_dentry->d_inode; | 920 | /* |
920 | 921 | * meta_dev_idx >= 0: external fixed size, possibly multiple | |
921 | if (!S_ISBLK(inode->i_mode)) { | 922 | * drbd sharing one meta device. TODO in that case, paranoia |
922 | retcode = ERR_DISK_NOT_BDEV; | 923 | * check that [md_bdev, meta_dev_idx] is not yet used by some |
923 | goto fail; | 924 | * other drbd minor! (if you use drbd.conf + drbdadm, that |
924 | } | 925 | * should check it for you already; but if you don't, or |
925 | 926 | * someone fooled it, we need to double check here) | |
926 | nbc->md_file = filp_open(nbc->dc.meta_dev, O_RDWR, 0); | 927 | */ |
927 | if (IS_ERR(nbc->md_file)) { | 928 | bdev = blkdev_get_by_path(nbc->dc.meta_dev, |
929 | FMODE_READ | FMODE_WRITE | FMODE_EXCL, | ||
930 | (nbc->dc.meta_dev_idx < 0) ? | ||
931 | (void *)mdev : (void *)drbd_m_holder); | ||
932 | if (IS_ERR(bdev)) { | ||
928 | dev_err(DEV, "open(\"%s\") failed with %ld\n", nbc->dc.meta_dev, | 933 | dev_err(DEV, "open(\"%s\") failed with %ld\n", nbc->dc.meta_dev, |
929 | PTR_ERR(nbc->md_file)); | 934 | PTR_ERR(bdev)); |
930 | nbc->md_file = NULL; | ||
931 | retcode = ERR_OPEN_MD_DISK; | 935 | retcode = ERR_OPEN_MD_DISK; |
932 | goto fail; | 936 | goto fail; |
933 | } | 937 | } |
938 | nbc->md_bdev = bdev; | ||
934 | 939 | ||
935 | inode2 = nbc->md_file->f_dentry->d_inode; | 940 | if ((nbc->backing_bdev == nbc->md_bdev) != |
936 | 941 | (nbc->dc.meta_dev_idx == DRBD_MD_INDEX_INTERNAL || | |
937 | if (!S_ISBLK(inode2->i_mode)) { | 942 | nbc->dc.meta_dev_idx == DRBD_MD_INDEX_FLEX_INT)) { |
938 | retcode = ERR_MD_NOT_BDEV; | 943 | retcode = ERR_MD_IDX_INVALID; |
939 | goto fail; | ||
940 | } | ||
941 | |||
942 | nbc->backing_bdev = inode->i_bdev; | ||
943 | if (bd_claim(nbc->backing_bdev, mdev)) { | ||
944 | printk(KERN_ERR "drbd: bd_claim(%p,%p); failed [%p;%p;%u]\n", | ||
945 | nbc->backing_bdev, mdev, | ||
946 | nbc->backing_bdev->bd_holder, | ||
947 | nbc->backing_bdev->bd_contains->bd_holder, | ||
948 | nbc->backing_bdev->bd_holders); | ||
949 | retcode = ERR_BDCLAIM_DISK; | ||
950 | goto fail; | 944 | goto fail; |
951 | } | 945 | } |
952 | 946 | ||
@@ -955,28 +949,7 @@ static int drbd_nl_disk_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp | |||
955 | offsetof(struct bm_extent, lce)); | 949 | offsetof(struct bm_extent, lce)); |
956 | if (!resync_lru) { | 950 | if (!resync_lru) { |
957 | retcode = ERR_NOMEM; | 951 | retcode = ERR_NOMEM; |
958 | goto release_bdev_fail; | 952 | goto fail; |
959 | } | ||
960 | |||
961 | /* meta_dev_idx >= 0: external fixed size, | ||
962 | * possibly multiple drbd sharing one meta device. | ||
963 | * TODO in that case, paranoia check that [md_bdev, meta_dev_idx] is | ||
964 | * not yet used by some other drbd minor! | ||
965 | * (if you use drbd.conf + drbdadm, | ||
966 | * that should check it for you already; but if you don't, or someone | ||
967 | * fooled it, we need to double check here) */ | ||
968 | nbc->md_bdev = inode2->i_bdev; | ||
969 | if (bd_claim(nbc->md_bdev, (nbc->dc.meta_dev_idx < 0) ? (void *)mdev | ||
970 | : (void *) drbd_m_holder)) { | ||
971 | retcode = ERR_BDCLAIM_MD_DISK; | ||
972 | goto release_bdev_fail; | ||
973 | } | ||
974 | |||
975 | if ((nbc->backing_bdev == nbc->md_bdev) != | ||
976 | (nbc->dc.meta_dev_idx == DRBD_MD_INDEX_INTERNAL || | ||
977 | nbc->dc.meta_dev_idx == DRBD_MD_INDEX_FLEX_INT)) { | ||
978 | retcode = ERR_MD_IDX_INVALID; | ||
979 | goto release_bdev2_fail; | ||
980 | } | 953 | } |
981 | 954 | ||
982 | /* RT - for drbd_get_max_capacity() DRBD_MD_INDEX_FLEX_INT */ | 955 | /* RT - for drbd_get_max_capacity() DRBD_MD_INDEX_FLEX_INT */ |
@@ -987,7 +960,7 @@ static int drbd_nl_disk_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp | |||
987 | (unsigned long long) drbd_get_max_capacity(nbc), | 960 | (unsigned long long) drbd_get_max_capacity(nbc), |
988 | (unsigned long long) nbc->dc.disk_size); | 961 | (unsigned long long) nbc->dc.disk_size); |
989 | retcode = ERR_DISK_TO_SMALL; | 962 | retcode = ERR_DISK_TO_SMALL; |
990 | goto release_bdev2_fail; | 963 | goto fail; |
991 | } | 964 | } |
992 | 965 | ||
993 | if (nbc->dc.meta_dev_idx < 0) { | 966 | if (nbc->dc.meta_dev_idx < 0) { |
@@ -1004,7 +977,7 @@ static int drbd_nl_disk_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp | |||
1004 | dev_warn(DEV, "refusing attach: md-device too small, " | 977 | dev_warn(DEV, "refusing attach: md-device too small, " |
1005 | "at least %llu sectors needed for this meta-disk type\n", | 978 | "at least %llu sectors needed for this meta-disk type\n", |
1006 | (unsigned long long) min_md_device_sectors); | 979 | (unsigned long long) min_md_device_sectors); |
1007 | goto release_bdev2_fail; | 980 | goto fail; |
1008 | } | 981 | } |
1009 | 982 | ||
1010 | /* Make sure the new disk is big enough | 983 | /* Make sure the new disk is big enough |
@@ -1012,7 +985,7 @@ static int drbd_nl_disk_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp | |||
1012 | if (drbd_get_max_capacity(nbc) < | 985 | if (drbd_get_max_capacity(nbc) < |
1013 | drbd_get_capacity(mdev->this_bdev)) { | 986 | drbd_get_capacity(mdev->this_bdev)) { |
1014 | retcode = ERR_DISK_TO_SMALL; | 987 | retcode = ERR_DISK_TO_SMALL; |
1015 | goto release_bdev2_fail; | 988 | goto fail; |
1016 | } | 989 | } |
1017 | 990 | ||
1018 | nbc->known_size = drbd_get_capacity(nbc->backing_bdev); | 991 | nbc->known_size = drbd_get_capacity(nbc->backing_bdev); |
@@ -1035,7 +1008,7 @@ static int drbd_nl_disk_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp | |||
1035 | retcode = _drbd_request_state(mdev, NS(disk, D_ATTACHING), CS_VERBOSE); | 1008 | retcode = _drbd_request_state(mdev, NS(disk, D_ATTACHING), CS_VERBOSE); |
1036 | drbd_resume_io(mdev); | 1009 | drbd_resume_io(mdev); |
1037 | if (retcode < SS_SUCCESS) | 1010 | if (retcode < SS_SUCCESS) |
1038 | goto release_bdev2_fail; | 1011 | goto fail; |
1039 | 1012 | ||
1040 | if (!get_ldev_if_state(mdev, D_ATTACHING)) | 1013 | if (!get_ldev_if_state(mdev, D_ATTACHING)) |
1041 | goto force_diskless; | 1014 | goto force_diskless; |
@@ -1269,18 +1242,14 @@ static int drbd_nl_disk_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp | |||
1269 | force_diskless: | 1242 | force_diskless: |
1270 | drbd_force_state(mdev, NS(disk, D_FAILED)); | 1243 | drbd_force_state(mdev, NS(disk, D_FAILED)); |
1271 | drbd_md_sync(mdev); | 1244 | drbd_md_sync(mdev); |
1272 | release_bdev2_fail: | ||
1273 | if (nbc) | ||
1274 | bd_release(nbc->md_bdev); | ||
1275 | release_bdev_fail: | ||
1276 | if (nbc) | ||
1277 | bd_release(nbc->backing_bdev); | ||
1278 | fail: | 1245 | fail: |
1279 | if (nbc) { | 1246 | if (nbc) { |
1280 | if (nbc->lo_file) | 1247 | if (nbc->backing_bdev) |
1281 | fput(nbc->lo_file); | 1248 | blkdev_put(nbc->backing_bdev, |
1282 | if (nbc->md_file) | 1249 | FMODE_READ | FMODE_WRITE | FMODE_EXCL); |
1283 | fput(nbc->md_file); | 1250 | if (nbc->md_bdev) |
1251 | blkdev_put(nbc->md_bdev, | ||
1252 | FMODE_READ | FMODE_WRITE | FMODE_EXCL); | ||
1284 | kfree(nbc); | 1253 | kfree(nbc); |
1285 | } | 1254 | } |
1286 | lc_destroy(resync_lru); | 1255 | lc_destroy(resync_lru); |
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index 7ea0bea2f7e3..44e18c073c44 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c | |||
@@ -395,11 +395,7 @@ lo_splice_actor(struct pipe_inode_info *pipe, struct pipe_buffer *buf, | |||
395 | struct loop_device *lo = p->lo; | 395 | struct loop_device *lo = p->lo; |
396 | struct page *page = buf->page; | 396 | struct page *page = buf->page; |
397 | sector_t IV; | 397 | sector_t IV; |
398 | int size, ret; | 398 | int size; |
399 | |||
400 | ret = buf->ops->confirm(pipe, buf); | ||
401 | if (unlikely(ret)) | ||
402 | return ret; | ||
403 | 399 | ||
404 | IV = ((sector_t) page->index << (PAGE_CACHE_SHIFT - 9)) + | 400 | IV = ((sector_t) page->index << (PAGE_CACHE_SHIFT - 9)) + |
405 | (buf->offset >> 9); | 401 | (buf->offset >> 9); |
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index 19b3568e9326..77d70eebb6b2 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c | |||
@@ -2296,15 +2296,12 @@ static int pkt_open_dev(struct pktcdvd_device *pd, fmode_t write) | |||
2296 | * so bdget() can't fail. | 2296 | * so bdget() can't fail. |
2297 | */ | 2297 | */ |
2298 | bdget(pd->bdev->bd_dev); | 2298 | bdget(pd->bdev->bd_dev); |
2299 | if ((ret = blkdev_get(pd->bdev, FMODE_READ))) | 2299 | if ((ret = blkdev_get(pd->bdev, FMODE_READ | FMODE_EXCL, pd))) |
2300 | goto out; | 2300 | goto out; |
2301 | 2301 | ||
2302 | if ((ret = bd_claim(pd->bdev, pd))) | ||
2303 | goto out_putdev; | ||
2304 | |||
2305 | if ((ret = pkt_get_last_written(pd, &lba))) { | 2302 | if ((ret = pkt_get_last_written(pd, &lba))) { |
2306 | printk(DRIVER_NAME": pkt_get_last_written failed\n"); | 2303 | printk(DRIVER_NAME": pkt_get_last_written failed\n"); |
2307 | goto out_unclaim; | 2304 | goto out_putdev; |
2308 | } | 2305 | } |
2309 | 2306 | ||
2310 | set_capacity(pd->disk, lba << 2); | 2307 | set_capacity(pd->disk, lba << 2); |
@@ -2314,7 +2311,7 @@ static int pkt_open_dev(struct pktcdvd_device *pd, fmode_t write) | |||
2314 | q = bdev_get_queue(pd->bdev); | 2311 | q = bdev_get_queue(pd->bdev); |
2315 | if (write) { | 2312 | if (write) { |
2316 | if ((ret = pkt_open_write(pd))) | 2313 | if ((ret = pkt_open_write(pd))) |
2317 | goto out_unclaim; | 2314 | goto out_putdev; |
2318 | /* | 2315 | /* |
2319 | * Some CDRW drives can not handle writes larger than one packet, | 2316 | * Some CDRW drives can not handle writes larger than one packet, |
2320 | * even if the size is a multiple of the packet size. | 2317 | * even if the size is a multiple of the packet size. |
@@ -2329,23 +2326,21 @@ static int pkt_open_dev(struct pktcdvd_device *pd, fmode_t write) | |||
2329 | } | 2326 | } |
2330 | 2327 | ||
2331 | if ((ret = pkt_set_segment_merging(pd, q))) | 2328 | if ((ret = pkt_set_segment_merging(pd, q))) |
2332 | goto out_unclaim; | 2329 | goto out_putdev; |
2333 | 2330 | ||
2334 | if (write) { | 2331 | if (write) { |
2335 | if (!pkt_grow_pktlist(pd, CONFIG_CDROM_PKTCDVD_BUFFERS)) { | 2332 | if (!pkt_grow_pktlist(pd, CONFIG_CDROM_PKTCDVD_BUFFERS)) { |
2336 | printk(DRIVER_NAME": not enough memory for buffers\n"); | 2333 | printk(DRIVER_NAME": not enough memory for buffers\n"); |
2337 | ret = -ENOMEM; | 2334 | ret = -ENOMEM; |
2338 | goto out_unclaim; | 2335 | goto out_putdev; |
2339 | } | 2336 | } |
2340 | printk(DRIVER_NAME": %lukB available on disc\n", lba << 1); | 2337 | printk(DRIVER_NAME": %lukB available on disc\n", lba << 1); |
2341 | } | 2338 | } |
2342 | 2339 | ||
2343 | return 0; | 2340 | return 0; |
2344 | 2341 | ||
2345 | out_unclaim: | ||
2346 | bd_release(pd->bdev); | ||
2347 | out_putdev: | 2342 | out_putdev: |
2348 | blkdev_put(pd->bdev, FMODE_READ); | 2343 | blkdev_put(pd->bdev, FMODE_READ | FMODE_EXCL); |
2349 | out: | 2344 | out: |
2350 | return ret; | 2345 | return ret; |
2351 | } | 2346 | } |
@@ -2362,8 +2357,7 @@ static void pkt_release_dev(struct pktcdvd_device *pd, int flush) | |||
2362 | pkt_lock_door(pd, 0); | 2357 | pkt_lock_door(pd, 0); |
2363 | 2358 | ||
2364 | pkt_set_speed(pd, MAX_SPEED, MAX_SPEED); | 2359 | pkt_set_speed(pd, MAX_SPEED, MAX_SPEED); |
2365 | bd_release(pd->bdev); | 2360 | blkdev_put(pd->bdev, FMODE_READ | FMODE_EXCL); |
2366 | blkdev_put(pd->bdev, FMODE_READ); | ||
2367 | 2361 | ||
2368 | pkt_shrink_pktlist(pd); | 2362 | pkt_shrink_pktlist(pd); |
2369 | } | 2363 | } |
@@ -2733,7 +2727,7 @@ static int pkt_new_dev(struct pktcdvd_device *pd, dev_t dev) | |||
2733 | bdev = bdget(dev); | 2727 | bdev = bdget(dev); |
2734 | if (!bdev) | 2728 | if (!bdev) |
2735 | return -ENOMEM; | 2729 | return -ENOMEM; |
2736 | ret = blkdev_get(bdev, FMODE_READ | FMODE_NDELAY); | 2730 | ret = blkdev_get(bdev, FMODE_READ | FMODE_NDELAY, NULL); |
2737 | if (ret) | 2731 | if (ret) |
2738 | return ret; | 2732 | return ret; |
2739 | 2733 | ||