Commit 32f2abca authored by David Sterba's avatar David Sterba

btrfs: relocation: return bool from btrfs_should_ignore_reloc_root

btrfs_should_ignore_reloc_root() is a predicate so it should return
bool.
Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: default avatarQu Wenruo <wqu@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent c71d3c69
...@@ -325,31 +325,30 @@ static bool have_reloc_root(struct btrfs_root *root) ...@@ -325,31 +325,30 @@ static bool have_reloc_root(struct btrfs_root *root)
return true; return true;
} }
int btrfs_should_ignore_reloc_root(struct btrfs_root *root) bool btrfs_should_ignore_reloc_root(struct btrfs_root *root)
{ {
struct btrfs_root *reloc_root; struct btrfs_root *reloc_root;
if (!test_bit(BTRFS_ROOT_SHAREABLE, &root->state)) if (!test_bit(BTRFS_ROOT_SHAREABLE, &root->state))
return 0; return false;
/* This root has been merged with its reloc tree, we can ignore it */ /* This root has been merged with its reloc tree, we can ignore it */
if (reloc_root_is_dead(root)) if (reloc_root_is_dead(root))
return 1; return true;
reloc_root = root->reloc_root; reloc_root = root->reloc_root;
if (!reloc_root) if (!reloc_root)
return 0; return false;
if (btrfs_header_generation(reloc_root->commit_root) == if (btrfs_header_generation(reloc_root->commit_root) ==
root->fs_info->running_transaction->transid) root->fs_info->running_transaction->transid)
return 0; return false;
/* /*
* if there is reloc tree and it was created in previous * If there is reloc tree and it was created in previous transaction
* transaction backref lookup can find the reloc tree, * backref lookup can find the reloc tree, so backref node for the fs
* so backref node for the fs tree root is useless for * tree root is useless for relocation.
* relocation.
*/ */
return 1; return true;
} }
/* /*
......
...@@ -18,7 +18,7 @@ int btrfs_reloc_post_snapshot(struct btrfs_trans_handle *trans, ...@@ -18,7 +18,7 @@ int btrfs_reloc_post_snapshot(struct btrfs_trans_handle *trans,
struct btrfs_pending_snapshot *pending); struct btrfs_pending_snapshot *pending);
int btrfs_should_cancel_balance(struct btrfs_fs_info *fs_info); int btrfs_should_cancel_balance(struct btrfs_fs_info *fs_info);
struct btrfs_root *find_reloc_root(struct btrfs_fs_info *fs_info, u64 bytenr); struct btrfs_root *find_reloc_root(struct btrfs_fs_info *fs_info, u64 bytenr);
int btrfs_should_ignore_reloc_root(struct btrfs_root *root); bool btrfs_should_ignore_reloc_root(struct btrfs_root *root);
u64 btrfs_get_reloc_bg_bytenr(struct btrfs_fs_info *fs_info); u64 btrfs_get_reloc_bg_bytenr(struct btrfs_fs_info *fs_info);
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment