Skip to content

Commit

Permalink
Btrfs: don't skip writing out a empty block groups cache
Browse files Browse the repository at this point in the history
I noticed a slight bug where we will not bother writing out the block group
cache's space cache if it's space tree is empty.  Since it could have a cluster
or pinned extents that need to be written out this is just not a valid test.
Thanks,

Signed-off-by: Josef Bacik <josef@redhat.com>
  • Loading branch information
Josef Bacik committed Oct 19, 2011
1 parent 73bc187 commit f75b130
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions fs/btrfs/free-space-cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -575,10 +575,6 @@ int __btrfs_write_out_cache(struct btrfs_root *root, struct inode *inode,

INIT_LIST_HEAD(&bitmap_list);

node = rb_first(&ctl->free_space_offset);
if (!node)
return -1;

if (!i_size_read(inode))
return -1;

Expand Down Expand Up @@ -639,6 +635,12 @@ int __btrfs_write_out_cache(struct btrfs_root *root, struct inode *inode,
if (block_group)
start = block_group->key.objectid;

node = rb_first(&ctl->free_space_offset);
if (!node && cluster) {
node = rb_first(&cluster->root);
cluster = NULL;
}

/* Write out the extent entries */
do {
struct btrfs_free_space_entry *entry;
Expand Down

0 comments on commit f75b130

Please sign in to comment.