]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
btrfs: use true/false for boolean parameters in btrfs_inc_ref()/btrfs_dec_ref()
authorSun YangKai <sunk67188@gmail.com>
Sat, 22 Nov 2025 06:00:43 +0000 (14:00 +0800)
committerDavid Sterba <dsterba@suse.com>
Tue, 3 Feb 2026 05:38:31 +0000 (06:38 +0100)
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>
fs/btrfs/ctree.c
fs/btrfs/extent-tree.c

index a48b4befbee7672321a6bec7322deeebafed9e7e..4b06c3c74ad4c062b166aa0068cf2e4808c78904 100644 (file)
@@ -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;
                }
index 432e1de4436d5dac24445707b17255f49352a006..cc9f8a32f67b25cf5e9042d9daa14b02ec09c710 100644 (file)
@@ -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;