Commit 6e5de50f authored by Filipe Manana's avatar Filipe Manana Committed by David Sterba

btrfs: use bool for return type of btrfs_block_can_be_shared()

Currently btrfs_block_can_be_shared() returns an int that is used as a
boolean. Since it all it needs is to return true or false, and it can't
return errors for example, change the return type from int to bool to
make it a bit more readable and obvious.
Reviewed-by: default avatarAnand Jain <anand.jain@oracle.com>
Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 6000d931
...@@ -370,7 +370,7 @@ int btrfs_copy_root(struct btrfs_trans_handle *trans, ...@@ -370,7 +370,7 @@ int btrfs_copy_root(struct btrfs_trans_handle *trans,
/* /*
* check if the tree block can be shared by multiple trees * check if the tree block can be shared by multiple trees
*/ */
int btrfs_block_can_be_shared(struct btrfs_trans_handle *trans, bool btrfs_block_can_be_shared(struct btrfs_trans_handle *trans,
struct btrfs_root *root, struct btrfs_root *root,
struct extent_buffer *buf) struct extent_buffer *buf)
{ {
...@@ -385,7 +385,7 @@ int btrfs_block_can_be_shared(struct btrfs_trans_handle *trans, ...@@ -385,7 +385,7 @@ int btrfs_block_can_be_shared(struct btrfs_trans_handle *trans,
btrfs_root_last_snapshot(&root->root_item) || btrfs_root_last_snapshot(&root->root_item) ||
btrfs_header_flag(buf, BTRFS_HEADER_FLAG_RELOC))) { btrfs_header_flag(buf, BTRFS_HEADER_FLAG_RELOC))) {
if (buf != root->commit_root) if (buf != root->commit_root)
return 1; return true;
/* /*
* An extent buffer that used to be the commit root may still be * An extent buffer that used to be the commit root may still be
* shared because the tree height may have increased and it * shared because the tree height may have increased and it
...@@ -393,10 +393,10 @@ int btrfs_block_can_be_shared(struct btrfs_trans_handle *trans, ...@@ -393,10 +393,10 @@ int btrfs_block_can_be_shared(struct btrfs_trans_handle *trans,
* snapshotting a subvolume created in the current transaction. * snapshotting a subvolume created in the current transaction.
*/ */
if (btrfs_header_generation(buf) == trans->transid) if (btrfs_header_generation(buf) == trans->transid)
return 1; return true;
} }
return 0; return false;
} }
static noinline int update_ref_for_cow(struct btrfs_trans_handle *trans, static noinline int update_ref_for_cow(struct btrfs_trans_handle *trans,
......
...@@ -558,7 +558,7 @@ int btrfs_copy_root(struct btrfs_trans_handle *trans, ...@@ -558,7 +558,7 @@ int btrfs_copy_root(struct btrfs_trans_handle *trans,
struct btrfs_root *root, struct btrfs_root *root,
struct extent_buffer *buf, struct extent_buffer *buf,
struct extent_buffer **cow_ret, u64 new_root_objectid); struct extent_buffer **cow_ret, u64 new_root_objectid);
int btrfs_block_can_be_shared(struct btrfs_trans_handle *trans, bool btrfs_block_can_be_shared(struct btrfs_trans_handle *trans,
struct btrfs_root *root, struct btrfs_root *root,
struct extent_buffer *buf); struct extent_buffer *buf);
int btrfs_del_ptr(struct btrfs_trans_handle *trans, struct btrfs_root *root, int btrfs_del_ptr(struct btrfs_trans_handle *trans, struct btrfs_root *root,
......
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