From: Filipe Manana Date: Tue, 10 Feb 2026 12:18:50 +0000 (+0000) Subject: btrfs: pass literal booleans to functions that take boolean arguments X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6fa972956830b17b0bf905a5b3da87517300dc0b;p=thirdparty%2Fkernel%2Flinux.git btrfs: pass literal booleans to functions that take boolean arguments We have several functions with parameters defined as booleans but then we have callers passing integers, 0 or 1, instead of false and true. While this isn't a bug since 0 and 1 are converted to false and true, it is odd and less readable. Change the callers to pass true and false literals instead. Signed-off-by: Filipe Manana Reviewed-by: David Sterba Signed-off-by: David Sterba --- diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index f2c925e90a878..b9004345cf3ca 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c @@ -3887,7 +3887,7 @@ static noinline int setup_leaf_for_split(struct btrfs_trans_handle *trans, goto err; } - ret = split_leaf(trans, root, &key, path, ins_len, 1); + ret = split_leaf(trans, root, &key, path, ins_len, true); if (ret) goto err; diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c index b6c7da8e1bc8b..8f8fa14886ded 100644 --- a/fs/btrfs/dev-replace.c +++ b/fs/btrfs/dev-replace.c @@ -697,7 +697,7 @@ static int btrfs_dev_replace_start(struct btrfs_fs_info *fs_info, /* the disk copy procedure reuses the scrub code */ ret = btrfs_scrub_dev(fs_info, src_device->devid, 0, btrfs_device_get_total_bytes(src_device), - &dev_replace->scrub_progress, 0, 1); + &dev_replace->scrub_progress, false, true); ret = btrfs_dev_replace_finishing(fs_info, ret); if (ret == -EINPROGRESS) @@ -1255,7 +1255,7 @@ static int btrfs_dev_replace_kthread(void *data) ret = btrfs_scrub_dev(fs_info, dev_replace->srcdev->devid, dev_replace->committed_cursor_left, btrfs_device_get_total_bytes(dev_replace->srcdev), - &dev_replace->scrub_progress, 0, 1); + &dev_replace->scrub_progress, false, true); ret = btrfs_dev_replace_finishing(fs_info, ret); WARN_ON(ret && ret != -ECANCELED); diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index a4cb9d3cfc4e8..06cc6e13cb621 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -3316,8 +3316,8 @@ static bool find_delalloc_subrange(struct btrfs_inode *inode, u64 start, u64 end *delalloc_start_ret = start; delalloc_len = btrfs_count_range_bits(&inode->io_tree, delalloc_start_ret, end, - len, EXTENT_DELALLOC, 1, - cached_state); + len, EXTENT_DELALLOC, + true, cached_state); } else { spin_unlock(&inode->lock); } diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 47318fce7a9ed..8c2e4472332f5 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -1854,7 +1854,7 @@ static int fallback_to_cow(struct btrfs_inode *inode, */ btrfs_lock_extent(io_tree, start, end, &cached_state); count = btrfs_count_range_bits(io_tree, &range_start, end, range_bytes, - EXTENT_NORESERVE, 0, NULL); + EXTENT_NORESERVE, false, NULL); if (count > 0 || is_space_ino || is_reloc_ino) { u64 bytes = count; struct btrfs_fs_info *fs_info = inode->root->fs_info; @@ -6862,7 +6862,7 @@ int btrfs_create_new_inode(struct btrfs_trans_handle *trans, } } else { ret = btrfs_add_link(trans, BTRFS_I(dir), BTRFS_I(inode), name, - 0, BTRFS_I(inode)->dir_index); + false, BTRFS_I(inode)->dir_index); if (unlikely(ret)) { btrfs_abort_transaction(trans, ret); goto discard; @@ -7078,7 +7078,7 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir, inode_set_ctime_current(inode); ret = btrfs_add_link(trans, BTRFS_I(dir), BTRFS_I(inode), - &fname.disk_name, 1, index); + &fname.disk_name, true, index); if (ret) goto fail; @@ -8498,14 +8498,14 @@ static int btrfs_rename_exchange(struct inode *old_dir, } ret = btrfs_add_link(trans, BTRFS_I(new_dir), BTRFS_I(old_inode), - new_name, 0, old_idx); + new_name, false, old_idx); if (unlikely(ret)) { btrfs_abort_transaction(trans, ret); goto out_fail; } ret = btrfs_add_link(trans, BTRFS_I(old_dir), BTRFS_I(new_inode), - old_name, 0, new_idx); + old_name, false, new_idx); if (unlikely(ret)) { btrfs_abort_transaction(trans, ret); goto out_fail; @@ -8796,7 +8796,7 @@ static int btrfs_rename(struct mnt_idmap *idmap, } ret = btrfs_add_link(trans, BTRFS_I(new_dir), BTRFS_I(old_inode), - &new_fname.disk_name, 0, index); + &new_fname.disk_name, false, index); if (unlikely(ret)) { btrfs_abort_transaction(trans, ret); goto out_fail; diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index d75d31b606e49..f2503668ce9de 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -3038,7 +3038,7 @@ static long btrfs_ioctl_scrub(struct file *file, void __user *arg) ret = btrfs_scrub_dev(fs_info, sa->devid, sa->start, sa->end, &sa->progress, sa->flags & BTRFS_SCRUB_READONLY, - 0); + false); /* * Copy scrub args to user space even if btrfs_scrub_dev() returned an diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index b3107b2278c74..65ec458595071 100644 --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c @@ -2740,8 +2740,6 @@ static void qgroup_iterator_nested_clean(struct list_head *head) } } -#define UPDATE_NEW 0 -#define UPDATE_OLD 1 /* * Walk all of the roots that points to the bytenr and adjust their refcnts. */ @@ -2980,10 +2978,10 @@ int btrfs_qgroup_account_extent(struct btrfs_trans_handle *trans, u64 bytenr, seq = fs_info->qgroup_seq; /* Update old refcnts using old_roots */ - qgroup_update_refcnt(fs_info, old_roots, &qgroups, seq, UPDATE_OLD); + qgroup_update_refcnt(fs_info, old_roots, &qgroups, seq, true); /* Update new refcnts using new_roots */ - qgroup_update_refcnt(fs_info, new_roots, &qgroups, seq, UPDATE_NEW); + qgroup_update_refcnt(fs_info, new_roots, &qgroups, seq, false); qgroup_update_counters(fs_info, &qgroups, nr_old_roots, nr_new_roots, num_bytes, seq); diff --git a/fs/btrfs/reflink.c b/fs/btrfs/reflink.c index 314cb95ba846d..fca00c0f53874 100644 --- a/fs/btrfs/reflink.c +++ b/fs/btrfs/reflink.c @@ -646,7 +646,7 @@ static int btrfs_extent_same_range(struct btrfs_inode *src, u64 loff, u64 len, */ btrfs_lock_extent(&dst->io_tree, dst_loff, end, &cached_state); ret = btrfs_clone(&src->vfs_inode, &dst->vfs_inode, loff, len, - ALIGN(len, bs), dst_loff, 1); + ALIGN(len, bs), dst_loff, true); btrfs_unlock_extent(&dst->io_tree, dst_loff, end, &cached_state); btrfs_btree_balance_dirty(fs_info); @@ -747,7 +747,7 @@ static noinline int btrfs_clone_files(struct file *file, struct file *file_src, */ end = destoff + len - 1; btrfs_lock_extent(&BTRFS_I(inode)->io_tree, destoff, end, &cached_state); - ret = btrfs_clone(src, inode, off, olen, len, destoff, 0); + ret = btrfs_clone(src, inode, off, olen, len, destoff, false); btrfs_unlock_extent(&BTRFS_I(inode)->io_tree, destoff, end, &cached_state); if (ret < 0) return ret; diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c index 904a2f57f86dc..89d72d8cb85fd 100644 --- a/fs/btrfs/send.c +++ b/fs/btrfs/send.c @@ -7201,7 +7201,7 @@ static int changed_cb(struct btrfs_path *left_path, sctx->right_path = right_path; sctx->cmp_key = key; - ret = finish_inode_if_needed(sctx, 0); + ret = finish_inode_if_needed(sctx, false); if (ret < 0) return ret; @@ -7328,7 +7328,7 @@ static int full_send_tree(struct send_ctx *sctx) } out_finish: - return finish_inode_if_needed(sctx, 1); + return finish_inode_if_needed(sctx, true); } static int replace_node_with_clone(struct btrfs_path *path, int level) @@ -7879,7 +7879,7 @@ static int send_subvol(struct send_ctx *sctx) ret = btrfs_compare_trees(sctx->send_root, sctx->parent_root, sctx); if (ret < 0) goto out; - ret = finish_inode_if_needed(sctx, 1); + ret = finish_inode_if_needed(sctx, true); if (ret < 0) goto out; } else { diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 2df80452b0b74..ca780e332a5bf 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c @@ -503,7 +503,7 @@ int btrfs_record_root_in_trans(struct btrfs_trans_handle *trans, return 0; mutex_lock(&fs_info->reloc_mutex); - ret = record_root_in_trans(trans, root, 0); + ret = record_root_in_trans(trans, root, false); mutex_unlock(&fs_info->reloc_mutex); return ret; @@ -1579,7 +1579,7 @@ static int qgroup_account_snapshot(struct btrfs_trans_handle *trans, * recorded root will never be updated again, causing an outdated root * item. */ - ret = record_root_in_trans(trans, src, 1); + ret = record_root_in_trans(trans, src, true); if (ret) return ret; @@ -1642,7 +1642,7 @@ static int qgroup_account_snapshot(struct btrfs_trans_handle *trans, * Or it won't be committed again onto disk after later * insert_dir_item() */ - return record_root_in_trans(trans, parent, 1); + return record_root_in_trans(trans, parent, true); } /* @@ -1726,7 +1726,7 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans, trans->transid, trans->bytes_reserved, 1); parent_root = parent_inode->root; - ret = record_root_in_trans(trans, parent_root, 0); + ret = record_root_in_trans(trans, parent_root, false); if (unlikely(ret)) goto fail; cur_time = current_time(&parent_inode->vfs_inode); @@ -1774,7 +1774,7 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans, goto fail; } - ret = record_root_in_trans(trans, root, 0); + ret = record_root_in_trans(trans, root, false); if (unlikely(ret)) { btrfs_abort_transaction(trans, ret); goto fail; diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index 340f572c357d0..187e07a277bfc 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c @@ -1711,7 +1711,7 @@ static noinline int add_inode_ref(struct walk_control *wc) } /* insert our name */ - ret = btrfs_add_link(trans, dir, inode, &name, 0, ref_index); + ret = btrfs_add_link(trans, dir, inode, &name, false, ref_index); if (ret) { btrfs_abort_log_replay(wc, ret, "failed to add link for inode %llu in dir %llu ref_index %llu name %.*s root %llu", @@ -2059,7 +2059,7 @@ static noinline int insert_one_name(struct btrfs_trans_handle *trans, return PTR_ERR(dir); } - ret = btrfs_add_link(trans, dir, inode, name, 1, index); + ret = btrfs_add_link(trans, dir, inode, name, true, index); /* FIXME, put inode into FIXUP list */