aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/free-space-cache.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index 181760f9d2ab..8f792f41feab 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -2453,11 +2453,23 @@ setup_cluster_bitmap(struct btrfs_block_group_cache *block_group,
2453 struct btrfs_free_space *entry; 2453 struct btrfs_free_space *entry;
2454 struct rb_node *node; 2454 struct rb_node *node;
2455 int ret = -ENOSPC; 2455 int ret = -ENOSPC;
2456 u64 bitmap_offset = offset_to_bitmap(ctl, offset);
2456 2457
2457 if (ctl->total_bitmaps == 0) 2458 if (ctl->total_bitmaps == 0)
2458 return -ENOSPC; 2459 return -ENOSPC;
2459 2460
2460 /* 2461 /*
2462 * The bitmap that covers offset won't be in the list unless offset
2463 * is just its start offset.
2464 */
2465 entry = list_first_entry(bitmaps, struct btrfs_free_space, list);
2466 if (entry->offset != bitmap_offset) {
2467 entry = tree_search_offset(ctl, bitmap_offset, 1, 0);
2468 if (entry && list_empty(&entry->list))
2469 list_add(&entry->list, bitmaps);
2470 }
2471
2472 /*
2461 * First check our cached list of bitmaps and see if there is an entry 2473 * First check our cached list of bitmaps and see if there is an entry
2462 * here that will work. 2474 * here that will work.
2463 */ 2475 */