aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/free-space-cache.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/free-space-cache.c')
-rw-r--r--fs/btrfs/free-space-cache.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index 0a8ccdbdd464..b81556ca75ea 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -575,10 +575,6 @@ int __btrfs_write_out_cache(struct btrfs_root *root, struct inode *inode,
575 575
576 INIT_LIST_HEAD(&bitmap_list); 576 INIT_LIST_HEAD(&bitmap_list);
577 577
578 node = rb_first(&ctl->free_space_offset);
579 if (!node)
580 return -1;
581
582 if (!i_size_read(inode)) 578 if (!i_size_read(inode))
583 return -1; 579 return -1;
584 580
@@ -639,6 +635,12 @@ int __btrfs_write_out_cache(struct btrfs_root *root, struct inode *inode,
639 if (block_group) 635 if (block_group)
640 start = block_group->key.objectid; 636 start = block_group->key.objectid;
641 637
638 node = rb_first(&ctl->free_space_offset);
639 if (!node && cluster) {
640 node = rb_first(&cluster->root);
641 cluster = NULL;
642 }
643
642 /* Write out the extent entries */ 644 /* Write out the extent entries */
643 do { 645 do {
644 struct btrfs_free_space_entry *entry; 646 struct btrfs_free_space_entry *entry;