Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f75b130e authored by Josef Bacik's avatar Josef Bacik
Browse files

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: default avatarJosef Bacik <josef@redhat.com>
parent 73bc1876
Loading
Loading
Loading
Loading
+6 −4
Original line number Original line Diff line number Diff line
@@ -575,10 +575,6 @@ int __btrfs_write_out_cache(struct btrfs_root *root, struct inode *inode,


	INIT_LIST_HEAD(&bitmap_list);
	INIT_LIST_HEAD(&bitmap_list);


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

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


@@ -639,6 +635,12 @@ int __btrfs_write_out_cache(struct btrfs_root *root, struct inode *inode,
	if (block_group)
	if (block_group)
		start = block_group->key.objectid;
		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 */
	/* Write out the extent entries */
	do {
	do {
		struct btrfs_free_space_entry *entry;
		struct btrfs_free_space_entry *entry;