diff options
author | Josef Bacik <jbacik@fb.com> | 2013-12-13 10:02:44 -0500 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2014-01-28 16:19:54 -0500 |
commit | a5dee37d390f3713f06e286a33b262f0fdb2b0ff (patch) | |
tree | b8d97aa8300cca3658f0238085d4d13433ba83be /fs/btrfs/extent_io.c | |
parent | 2ef1fed285d58e77ce777d9a525fed4788b5a6d0 (diff) |
Btrfs: deal with io_tree->mapping being NULL
I need to add infrastructure to allocate dummy extent buffers for running sanity
tests, and to do this I need to not have to worry about having an
address_mapping for an io_tree, so just fix up the places where we assume that
all io_tree's have a non-NULL ->mapping. Thanks,
Signed-off-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs/extent_io.c')
-rw-r--r-- | fs/btrfs/extent_io.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 5fc9481515f3..1d8244d39b66 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
@@ -77,13 +77,19 @@ void btrfs_leak_debug_check(void) | |||
77 | } | 77 | } |
78 | } | 78 | } |
79 | 79 | ||
80 | #define btrfs_debug_check_extent_io_range(inode, start, end) \ | 80 | #define btrfs_debug_check_extent_io_range(tree, start, end) \ |
81 | __btrfs_debug_check_extent_io_range(__func__, (inode), (start), (end)) | 81 | __btrfs_debug_check_extent_io_range(__func__, (tree), (start), (end)) |
82 | static inline void __btrfs_debug_check_extent_io_range(const char *caller, | 82 | static inline void __btrfs_debug_check_extent_io_range(const char *caller, |
83 | struct inode *inode, u64 start, u64 end) | 83 | struct extent_io_tree *tree, u64 start, u64 end) |
84 | { | 84 | { |
85 | u64 isize = i_size_read(inode); | 85 | struct inode *inode; |
86 | u64 isize; | ||
86 | 87 | ||
88 | if (!tree->mapping) | ||
89 | return; | ||
90 | |||
91 | inode = tree->mapping->host; | ||
92 | isize = i_size_read(inode); | ||
87 | if (end >= PAGE_SIZE && (end % 2) == 0 && end != isize - 1) { | 93 | if (end >= PAGE_SIZE && (end % 2) == 0 && end != isize - 1) { |
88 | printk_ratelimited(KERN_DEBUG | 94 | printk_ratelimited(KERN_DEBUG |
89 | "btrfs: %s: ino %llu isize %llu odd range [%llu,%llu]\n", | 95 | "btrfs: %s: ino %llu isize %llu odd range [%llu,%llu]\n", |
@@ -124,6 +130,8 @@ static noinline void flush_write_bio(void *data); | |||
124 | static inline struct btrfs_fs_info * | 130 | static inline struct btrfs_fs_info * |
125 | tree_fs_info(struct extent_io_tree *tree) | 131 | tree_fs_info(struct extent_io_tree *tree) |
126 | { | 132 | { |
133 | if (!tree->mapping) | ||
134 | return NULL; | ||
127 | return btrfs_sb(tree->mapping->host->i_sb); | 135 | return btrfs_sb(tree->mapping->host->i_sb); |
128 | } | 136 | } |
129 | 137 | ||
@@ -570,7 +578,7 @@ int clear_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, | |||
570 | int err; | 578 | int err; |
571 | int clear = 0; | 579 | int clear = 0; |
572 | 580 | ||
573 | btrfs_debug_check_extent_io_range(tree->mapping->host, start, end); | 581 | btrfs_debug_check_extent_io_range(tree, start, end); |
574 | 582 | ||
575 | if (bits & EXTENT_DELALLOC) | 583 | if (bits & EXTENT_DELALLOC) |
576 | bits |= EXTENT_NORESERVE; | 584 | bits |= EXTENT_NORESERVE; |
@@ -730,7 +738,7 @@ static void wait_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, | |||
730 | struct extent_state *state; | 738 | struct extent_state *state; |
731 | struct rb_node *node; | 739 | struct rb_node *node; |
732 | 740 | ||
733 | btrfs_debug_check_extent_io_range(tree->mapping->host, start, end); | 741 | btrfs_debug_check_extent_io_range(tree, start, end); |
734 | 742 | ||
735 | spin_lock(&tree->lock); | 743 | spin_lock(&tree->lock); |
736 | again: | 744 | again: |
@@ -817,7 +825,7 @@ __set_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, | |||
817 | u64 last_start; | 825 | u64 last_start; |
818 | u64 last_end; | 826 | u64 last_end; |
819 | 827 | ||
820 | btrfs_debug_check_extent_io_range(tree->mapping->host, start, end); | 828 | btrfs_debug_check_extent_io_range(tree, start, end); |
821 | 829 | ||
822 | bits |= EXTENT_FIRST_DELALLOC; | 830 | bits |= EXTENT_FIRST_DELALLOC; |
823 | again: | 831 | again: |
@@ -1043,7 +1051,7 @@ int convert_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, | |||
1043 | u64 last_start; | 1051 | u64 last_start; |
1044 | u64 last_end; | 1052 | u64 last_end; |
1045 | 1053 | ||
1046 | btrfs_debug_check_extent_io_range(tree->mapping->host, start, end); | 1054 | btrfs_debug_check_extent_io_range(tree, start, end); |
1047 | 1055 | ||
1048 | again: | 1056 | again: |
1049 | if (!prealloc && (mask & __GFP_WAIT)) { | 1057 | if (!prealloc && (mask & __GFP_WAIT)) { |