summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/free-space-cache.c
diff options
context:
space:
mode:
authorJosef Bacik <josef@redhat.com>2011-10-05 16:00:18 +0200
committerJosef Bacik <josef@redhat.com>2011-10-19 21:12:51 +0200
commitf75b130e9bb361850787e156c79311adb84f551e (patch)
tree6bc2fdf8c19f36124583774f07550e26b85de7e5 /fs/btrfs/free-space-cache.c
parentBtrfs: introduce mount option no_space_cache (diff)
downloadlinux-f75b130e9bb361850787e156c79311adb84f551e.tar.xz
linux-f75b130e9bb361850787e156c79311adb84f551e.zip
Btrfs: don't skip writing out a empty block groups cache
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>
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,
INIT_LIST_HEAD(&bitmap_list);
- node = rb_first(&ctl->free_space_offset);
- if (!node)
- return -1;
-
if (!i_size_read(inode))
return -1;
@@ -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;