diff options
| author | Sun YangKai <sunk67188@gmail.com> | 2025-11-22 14:00:43 +0800 |
|---|---|---|
| committer | David Sterba <dsterba@suse.com> | 2026-02-03 06:38:31 +0100 |
| commit | 8bfee251b7f5e54437e893c6daa964caded8a860 (patch) | |
| tree | 9d5c880c01cc0d2d1dd59b034a16a91a19b84c3c | |
| parent | 53e83031494715482d11d3e1394058a10d96f486 (diff) | |
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>
| -rw-r--r-- | fs/btrfs/ctree.c | 20 | ||||
| -rw-r--r-- | fs/btrfs/extent-tree.c | 8 |
2 files changed, 14 insertions, 14 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index a48b4befbee7..4b06c3c74ad4 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c @@ -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; } diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 432e1de4436d..cc9f8a32f67b 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -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; |
