mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 00:53:34 +02:00
btrfs: use true/false for boolean parameters in btrfs_inc_ref()/btrfs_dec_ref()
Replace integer literals 0/1 with true/false when calling btrfs_inc_ref() and btrfs_dec_ref() to make the code self-documenting and avoid mixing bool/integer types. Signed-off-by: Sun YangKai <sunk67188@gmail.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
53e8303149
commit
8bfee251b7
|
|
@ -292,11 +292,11 @@ int btrfs_copy_root(struct btrfs_trans_handle *trans,
|
|||
}
|
||||
|
||||
if (new_root_objectid == BTRFS_TREE_RELOC_OBJECTID) {
|
||||
ret = btrfs_inc_ref(trans, root, cow, 1);
|
||||
ret = btrfs_inc_ref(trans, root, cow, true);
|
||||
if (unlikely(ret))
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
} else {
|
||||
ret = btrfs_inc_ref(trans, root, cow, 0);
|
||||
ret = btrfs_inc_ref(trans, root, cow, false);
|
||||
if (unlikely(ret))
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
}
|
||||
|
|
@ -420,15 +420,15 @@ static noinline int update_ref_for_cow(struct btrfs_trans_handle *trans,
|
|||
if ((owner == btrfs_root_id(root) ||
|
||||
btrfs_root_id(root) == BTRFS_TREE_RELOC_OBJECTID) &&
|
||||
!(flags & BTRFS_BLOCK_FLAG_FULL_BACKREF)) {
|
||||
ret = btrfs_inc_ref(trans, root, buf, 1);
|
||||
ret = btrfs_inc_ref(trans, root, buf, true);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (btrfs_root_id(root) == BTRFS_TREE_RELOC_OBJECTID) {
|
||||
ret = btrfs_dec_ref(trans, root, buf, 0);
|
||||
ret = btrfs_dec_ref(trans, root, buf, false);
|
||||
if (ret)
|
||||
return ret;
|
||||
ret = btrfs_inc_ref(trans, root, cow, 1);
|
||||
ret = btrfs_inc_ref(trans, root, cow, true);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -439,21 +439,21 @@ static noinline int update_ref_for_cow(struct btrfs_trans_handle *trans,
|
|||
} else {
|
||||
|
||||
if (btrfs_root_id(root) == BTRFS_TREE_RELOC_OBJECTID)
|
||||
ret = btrfs_inc_ref(trans, root, cow, 1);
|
||||
ret = btrfs_inc_ref(trans, root, cow, true);
|
||||
else
|
||||
ret = btrfs_inc_ref(trans, root, cow, 0);
|
||||
ret = btrfs_inc_ref(trans, root, cow, false);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
} else {
|
||||
if (flags & BTRFS_BLOCK_FLAG_FULL_BACKREF) {
|
||||
if (btrfs_root_id(root) == BTRFS_TREE_RELOC_OBJECTID)
|
||||
ret = btrfs_inc_ref(trans, root, cow, 1);
|
||||
ret = btrfs_inc_ref(trans, root, cow, true);
|
||||
else
|
||||
ret = btrfs_inc_ref(trans, root, cow, 0);
|
||||
ret = btrfs_inc_ref(trans, root, cow, false);
|
||||
if (ret)
|
||||
return ret;
|
||||
ret = btrfs_dec_ref(trans, root, buf, 1);
|
||||
ret = btrfs_dec_ref(trans, root, buf, true);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5457,12 +5457,12 @@ static noinline int walk_down_proc(struct btrfs_trans_handle *trans,
|
|||
/* wc->stage == UPDATE_BACKREF */
|
||||
if (!(wc->flags[level] & flag)) {
|
||||
ASSERT(path->locks[level]);
|
||||
ret = btrfs_inc_ref(trans, root, eb, 1);
|
||||
ret = btrfs_inc_ref(trans, root, eb, true);
|
||||
if (unlikely(ret)) {
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
return ret;
|
||||
}
|
||||
ret = btrfs_dec_ref(trans, root, eb, 0);
|
||||
ret = btrfs_dec_ref(trans, root, eb, false);
|
||||
if (unlikely(ret)) {
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
return ret;
|
||||
|
|
@ -5864,13 +5864,13 @@ static noinline int walk_up_proc(struct btrfs_trans_handle *trans,
|
|||
if (wc->refs[level] == 1) {
|
||||
if (level == 0) {
|
||||
if (wc->flags[level] & BTRFS_BLOCK_FLAG_FULL_BACKREF) {
|
||||
ret = btrfs_dec_ref(trans, root, eb, 1);
|
||||
ret = btrfs_dec_ref(trans, root, eb, true);
|
||||
if (ret) {
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
return ret;
|
||||
}
|
||||
} else {
|
||||
ret = btrfs_dec_ref(trans, root, eb, 0);
|
||||
ret = btrfs_dec_ref(trans, root, eb, false);
|
||||
if (unlikely(ret)) {
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
return ret;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user