diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-01-11 10:28:19 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-01-11 10:28:19 -0500 |
commit | 734d1ece37fbf3d2ddfc71bc6c69e0fe35f02542 (patch) | |
tree | c4805dd7e746b1feb9e09e9849f3245d0b2c0c6b /fs/btrfs/extent_io.c | |
parent | 216c82c6aba63eeb49d7654b448e0d47bea255bb (diff) | |
parent | 9931faca02c604c22335f5a935a501bb2ace6e20 (diff) |
Merge tag 'v3.8-rc3' into v4l_for_linus
Linux 3.8-rc3
* tag 'v3.8-rc3': (11110 commits)
Linux 3.8-rc3
mm: reinstante dropped pmd_trans_splitting() check
cred: Remove tgcred pointer from struct cred
drm/ttm: fix fence locking in ttm_buffer_object_transfer
ARM: clps711x: Fix bad merge of clockevents setup
ARM: highbank: save and restore L2 cache and GIC on suspend
ARM: highbank: add a power request clear
ARM: highbank: fix secondary boot and hotplug
ARM: highbank: fix typos with hignbank in power request functions
ARM: dts: fix highbank cpu mpidr values
ARM: dts: add device_type prop to cpu nodes on Calxeda platforms
drm/prime: drop reference on imported dma-buf come from gem
xen/netfront: improve truesize tracking
ARM: mx5: Fix MX53 flexcan2 clock
ARM: OMAP2+: am33xx-hwmod: Fix wrongly terminated am33xx_usbss_mpu_irqs array
sctp: fix Kconfig bug in default cookie hmac selection
EDAC: Cleanup device deregistering path
EDAC: Fix EDAC Kconfig menu
EDAC: Fix kernel panic on module unloading
ALSA: hda - add mute LED for HP Pavilion 17 (Realtek codec)
...
Diffstat (limited to 'fs/btrfs/extent_io.c')
-rw-r--r-- | fs/btrfs/extent_io.c | 37 |
1 files changed, 14 insertions, 23 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 472873a94d96..1b319df29eee 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
@@ -341,12 +341,10 @@ static int insert_state(struct extent_io_tree *tree, | |||
341 | { | 341 | { |
342 | struct rb_node *node; | 342 | struct rb_node *node; |
343 | 343 | ||
344 | if (end < start) { | 344 | if (end < start) |
345 | printk(KERN_ERR "btrfs end < start %llu %llu\n", | 345 | WARN(1, KERN_ERR "btrfs end < start %llu %llu\n", |
346 | (unsigned long long)end, | 346 | (unsigned long long)end, |
347 | (unsigned long long)start); | 347 | (unsigned long long)start); |
348 | WARN_ON(1); | ||
349 | } | ||
350 | state->start = start; | 348 | state->start = start; |
351 | state->end = end; | 349 | state->end = end; |
352 | 350 | ||
@@ -1919,12 +1917,12 @@ static void repair_io_failure_callback(struct bio *bio, int err) | |||
1919 | * the standard behavior is to write all copies in a raid setup. here we only | 1917 | * the standard behavior is to write all copies in a raid setup. here we only |
1920 | * want to write the one bad copy. so we do the mapping for ourselves and issue | 1918 | * want to write the one bad copy. so we do the mapping for ourselves and issue |
1921 | * submit_bio directly. | 1919 | * submit_bio directly. |
1922 | * to avoid any synchonization issues, wait for the data after writing, which | 1920 | * to avoid any synchronization issues, wait for the data after writing, which |
1923 | * actually prevents the read that triggered the error from finishing. | 1921 | * actually prevents the read that triggered the error from finishing. |
1924 | * currently, there can be no more than two copies of every data bit. thus, | 1922 | * currently, there can be no more than two copies of every data bit. thus, |
1925 | * exactly one rewrite is required. | 1923 | * exactly one rewrite is required. |
1926 | */ | 1924 | */ |
1927 | int repair_io_failure(struct btrfs_mapping_tree *map_tree, u64 start, | 1925 | int repair_io_failure(struct btrfs_fs_info *fs_info, u64 start, |
1928 | u64 length, u64 logical, struct page *page, | 1926 | u64 length, u64 logical, struct page *page, |
1929 | int mirror_num) | 1927 | int mirror_num) |
1930 | { | 1928 | { |
@@ -1946,7 +1944,7 @@ int repair_io_failure(struct btrfs_mapping_tree *map_tree, u64 start, | |||
1946 | bio->bi_size = 0; | 1944 | bio->bi_size = 0; |
1947 | map_length = length; | 1945 | map_length = length; |
1948 | 1946 | ||
1949 | ret = btrfs_map_block(map_tree, WRITE, logical, | 1947 | ret = btrfs_map_block(fs_info, WRITE, logical, |
1950 | &map_length, &bbio, mirror_num); | 1948 | &map_length, &bbio, mirror_num); |
1951 | if (ret) { | 1949 | if (ret) { |
1952 | bio_put(bio); | 1950 | bio_put(bio); |
@@ -1984,14 +1982,13 @@ int repair_io_failure(struct btrfs_mapping_tree *map_tree, u64 start, | |||
1984 | int repair_eb_io_failure(struct btrfs_root *root, struct extent_buffer *eb, | 1982 | int repair_eb_io_failure(struct btrfs_root *root, struct extent_buffer *eb, |
1985 | int mirror_num) | 1983 | int mirror_num) |
1986 | { | 1984 | { |
1987 | struct btrfs_mapping_tree *map_tree = &root->fs_info->mapping_tree; | ||
1988 | u64 start = eb->start; | 1985 | u64 start = eb->start; |
1989 | unsigned long i, num_pages = num_extent_pages(eb->start, eb->len); | 1986 | unsigned long i, num_pages = num_extent_pages(eb->start, eb->len); |
1990 | int ret = 0; | 1987 | int ret = 0; |
1991 | 1988 | ||
1992 | for (i = 0; i < num_pages; i++) { | 1989 | for (i = 0; i < num_pages; i++) { |
1993 | struct page *p = extent_buffer_page(eb, i); | 1990 | struct page *p = extent_buffer_page(eb, i); |
1994 | ret = repair_io_failure(map_tree, start, PAGE_CACHE_SIZE, | 1991 | ret = repair_io_failure(root->fs_info, start, PAGE_CACHE_SIZE, |
1995 | start, p, mirror_num); | 1992 | start, p, mirror_num); |
1996 | if (ret) | 1993 | if (ret) |
1997 | break; | 1994 | break; |
@@ -2010,7 +2007,7 @@ static int clean_io_failure(u64 start, struct page *page) | |||
2010 | u64 private; | 2007 | u64 private; |
2011 | u64 private_failure; | 2008 | u64 private_failure; |
2012 | struct io_failure_record *failrec; | 2009 | struct io_failure_record *failrec; |
2013 | struct btrfs_mapping_tree *map_tree; | 2010 | struct btrfs_fs_info *fs_info; |
2014 | struct extent_state *state; | 2011 | struct extent_state *state; |
2015 | int num_copies; | 2012 | int num_copies; |
2016 | int did_repair = 0; | 2013 | int did_repair = 0; |
@@ -2046,11 +2043,11 @@ static int clean_io_failure(u64 start, struct page *page) | |||
2046 | spin_unlock(&BTRFS_I(inode)->io_tree.lock); | 2043 | spin_unlock(&BTRFS_I(inode)->io_tree.lock); |
2047 | 2044 | ||
2048 | if (state && state->start == failrec->start) { | 2045 | if (state && state->start == failrec->start) { |
2049 | map_tree = &BTRFS_I(inode)->root->fs_info->mapping_tree; | 2046 | fs_info = BTRFS_I(inode)->root->fs_info; |
2050 | num_copies = btrfs_num_copies(map_tree, failrec->logical, | 2047 | num_copies = btrfs_num_copies(fs_info, failrec->logical, |
2051 | failrec->len); | 2048 | failrec->len); |
2052 | if (num_copies > 1) { | 2049 | if (num_copies > 1) { |
2053 | ret = repair_io_failure(map_tree, start, failrec->len, | 2050 | ret = repair_io_failure(fs_info, start, failrec->len, |
2054 | failrec->logical, page, | 2051 | failrec->logical, page, |
2055 | failrec->failed_mirror); | 2052 | failrec->failed_mirror); |
2056 | did_repair = !ret; | 2053 | did_repair = !ret; |
@@ -2159,9 +2156,8 @@ static int bio_readpage_error(struct bio *failed_bio, struct page *page, | |||
2159 | * clean_io_failure() clean all those errors at once. | 2156 | * clean_io_failure() clean all those errors at once. |
2160 | */ | 2157 | */ |
2161 | } | 2158 | } |
2162 | num_copies = btrfs_num_copies( | 2159 | num_copies = btrfs_num_copies(BTRFS_I(inode)->root->fs_info, |
2163 | &BTRFS_I(inode)->root->fs_info->mapping_tree, | 2160 | failrec->logical, failrec->len); |
2164 | failrec->logical, failrec->len); | ||
2165 | if (num_copies == 1) { | 2161 | if (num_copies == 1) { |
2166 | /* | 2162 | /* |
2167 | * we only have a single copy of the data, so don't bother with | 2163 | * we only have a single copy of the data, so don't bother with |
@@ -2466,10 +2462,6 @@ btrfs_bio_alloc(struct block_device *bdev, u64 first_sector, int nr_vecs, | |||
2466 | return bio; | 2462 | return bio; |
2467 | } | 2463 | } |
2468 | 2464 | ||
2469 | /* | ||
2470 | * Since writes are async, they will only return -ENOMEM. | ||
2471 | * Reads can return the full range of I/O error conditions. | ||
2472 | */ | ||
2473 | static int __must_check submit_one_bio(int rw, struct bio *bio, | 2465 | static int __must_check submit_one_bio(int rw, struct bio *bio, |
2474 | int mirror_num, unsigned long bio_flags) | 2466 | int mirror_num, unsigned long bio_flags) |
2475 | { | 2467 | { |
@@ -4721,10 +4713,9 @@ int map_private_extent_buffer(struct extent_buffer *eb, unsigned long start, | |||
4721 | } | 4713 | } |
4722 | 4714 | ||
4723 | if (start + min_len > eb->len) { | 4715 | if (start + min_len > eb->len) { |
4724 | printk(KERN_ERR "btrfs bad mapping eb start %llu len %lu, " | 4716 | WARN(1, KERN_ERR "btrfs bad mapping eb start %llu len %lu, " |
4725 | "wanted %lu %lu\n", (unsigned long long)eb->start, | 4717 | "wanted %lu %lu\n", (unsigned long long)eb->start, |
4726 | eb->len, start, min_len); | 4718 | eb->len, start, min_len); |
4727 | WARN_ON(1); | ||
4728 | return -EINVAL; | 4719 | return -EINVAL; |
4729 | } | 4720 | } |
4730 | 4721 | ||