aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent_io.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2008-09-05 16:09:51 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:04:07 -0400
commita1b32a5932cfac7c38b442582285f3da2a09dfd8 (patch)
treed468c51c7391ee1a0cfcc6ff1e76e11c01646efe /fs/btrfs/extent_io.c
parent95819c05732c511338b43c115ffbcee978c02888 (diff)
Btrfs: Add debugging checks to track down corrupted metadata
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/extent_io.c')
-rw-r--r--fs/btrfs/extent_io.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 83ba0c328722..7ca89c45d401 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -1811,6 +1811,7 @@ printk("2bad mapping end %Lu cur %Lu\n", end, cur);
1811 } 1811 }
1812 /* the get_extent function already copied into the page */ 1812 /* the get_extent function already copied into the page */
1813 if (test_range_bit(tree, cur, cur_end, EXTENT_UPTODATE, 1)) { 1813 if (test_range_bit(tree, cur, cur_end, EXTENT_UPTODATE, 1)) {
1814 check_page_uptodate(tree, page);
1814 unlock_extent(tree, cur, cur + iosize - 1, GFP_NOFS); 1815 unlock_extent(tree, cur, cur + iosize - 1, GFP_NOFS);
1815 cur = cur + iosize; 1816 cur = cur + iosize;
1816 page_offset += iosize; 1817 page_offset += iosize;
@@ -2785,21 +2786,20 @@ int set_extent_buffer_dirty(struct extent_io_tree *tree,
2785 * properly set. releasepage may drop page->private 2786 * properly set. releasepage may drop page->private
2786 * on us if the page isn't already dirty. 2787 * on us if the page isn't already dirty.
2787 */ 2788 */
2789 lock_page(page);
2788 if (i == 0) { 2790 if (i == 0) {
2789 lock_page(page);
2790 set_page_extent_head(page, eb->len); 2791 set_page_extent_head(page, eb->len);
2791 } else if (PagePrivate(page) && 2792 } else if (PagePrivate(page) &&
2792 page->private != EXTENT_PAGE_PRIVATE) { 2793 page->private != EXTENT_PAGE_PRIVATE) {
2793 lock_page(page);
2794 set_page_extent_mapped(page); 2794 set_page_extent_mapped(page);
2795 unlock_page(page);
2796 } 2795 }
2797 __set_page_dirty_nobuffers(extent_buffer_page(eb, i)); 2796 __set_page_dirty_nobuffers(extent_buffer_page(eb, i));
2798 if (i == 0) 2797 set_extent_dirty(tree, page_offset(page),
2799 unlock_page(page); 2798 page_offset(page) + PAGE_CACHE_SIZE -1,
2799 GFP_NOFS);
2800 unlock_page(page);
2800 } 2801 }
2801 return set_extent_dirty(tree, eb->start, 2802 return 0;
2802 eb->start + eb->len - 1, GFP_NOFS);
2803} 2803}
2804EXPORT_SYMBOL(set_extent_buffer_dirty); 2804EXPORT_SYMBOL(set_extent_buffer_dirty);
2805 2805
@@ -2952,6 +2952,9 @@ int read_extent_buffer_pages(struct extent_io_tree *tree,
2952 if (all_uptodate) { 2952 if (all_uptodate) {
2953 if (start_i == 0) 2953 if (start_i == 0)
2954 eb->flags |= EXTENT_UPTODATE; 2954 eb->flags |= EXTENT_UPTODATE;
2955 if (ret) {
2956 printk("all up to date but ret is %d\n", ret);
2957 }
2955 goto unlock_exit; 2958 goto unlock_exit;
2956 } 2959 }
2957 2960
@@ -2968,6 +2971,7 @@ int read_extent_buffer_pages(struct extent_io_tree *tree,
2968 mirror_num); 2971 mirror_num);
2969 if (err) { 2972 if (err) {
2970 ret = err; 2973 ret = err;
2974 printk("err %d from __extent_read_full_page\n", ret);
2971 } 2975 }
2972 } else { 2976 } else {
2973 unlock_page(page); 2977 unlock_page(page);
@@ -2978,12 +2982,15 @@ int read_extent_buffer_pages(struct extent_io_tree *tree,
2978 submit_one_bio(READ, bio, mirror_num); 2982 submit_one_bio(READ, bio, mirror_num);
2979 2983
2980 if (ret || !wait) { 2984 if (ret || !wait) {
2985 if (ret)
2986 printk("ret %d wait %d returning\n", ret, wait);
2981 return ret; 2987 return ret;
2982 } 2988 }
2983 for (i = start_i; i < num_pages; i++) { 2989 for (i = start_i; i < num_pages; i++) {
2984 page = extent_buffer_page(eb, i); 2990 page = extent_buffer_page(eb, i);
2985 wait_on_page_locked(page); 2991 wait_on_page_locked(page);
2986 if (!PageUptodate(page)) { 2992 if (!PageUptodate(page)) {
2993 printk("page not uptodate after wait_on_page_locked\n");
2987 ret = -EIO; 2994 ret = -EIO;
2988 } 2995 }
2989 } 2996 }