diff options
-rw-r--r-- | fs/btrfs/extent-tree.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index e5340677d6c4..6a7a9ba75fd9 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -150,12 +150,9 @@ struct btrfs_block_group_cache *btrfs_lookup_block_group(struct | |||
150 | return NULL; | 150 | return NULL; |
151 | 151 | ||
152 | block_group = (struct btrfs_block_group_cache *)(unsigned long)ptr; | 152 | block_group = (struct btrfs_block_group_cache *)(unsigned long)ptr; |
153 | 153 | if (block_group->key.objectid <= bytenr && bytenr < | |
154 | |||
155 | if (block_group->key.objectid <= bytenr && bytenr <= | ||
156 | block_group->key.objectid + block_group->key.offset) | 154 | block_group->key.objectid + block_group->key.offset) |
157 | return block_group; | 155 | return block_group; |
158 | |||
159 | return NULL; | 156 | return NULL; |
160 | } | 157 | } |
161 | static u64 find_search_start(struct btrfs_root *root, | 158 | static u64 find_search_start(struct btrfs_root *root, |
@@ -195,7 +192,7 @@ again: | |||
195 | continue; | 192 | continue; |
196 | } | 193 | } |
197 | if (data != BTRFS_BLOCK_GROUP_MIXED && | 194 | if (data != BTRFS_BLOCK_GROUP_MIXED && |
198 | start + num >= cache->key.objectid + cache->key.offset) | 195 | start + num > cache->key.objectid + cache->key.offset) |
199 | goto new_group; | 196 | goto new_group; |
200 | return start; | 197 | return start; |
201 | } | 198 | } |
@@ -1088,9 +1085,8 @@ check_pending: | |||
1088 | 1085 | ||
1089 | if (ins->objectid + num_bytes >= search_end) | 1086 | if (ins->objectid + num_bytes >= search_end) |
1090 | goto enospc; | 1087 | goto enospc; |
1091 | |||
1092 | if (!full_scan && data != BTRFS_BLOCK_GROUP_MIXED && | 1088 | if (!full_scan && data != BTRFS_BLOCK_GROUP_MIXED && |
1093 | ins->objectid + num_bytes >= block_group-> | 1089 | ins->objectid + num_bytes > block_group-> |
1094 | key.objectid + block_group->key.offset) { | 1090 | key.objectid + block_group->key.offset) { |
1095 | search_start = block_group->key.objectid + | 1091 | search_start = block_group->key.objectid + |
1096 | block_group->key.offset; | 1092 | block_group->key.offset; |