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 <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Filipe Manana
2026-02-10 12:18:50 +00:00
committed by David Sterba
parent 521f8672b6
commit 6fa9729568
10 changed files with 26 additions and 28 deletions

View File

@@ -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;

View File

@@ -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);

View File

@@ -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);
}

View File

@@ -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;

View File

@@ -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

View File

@@ -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);

View File

@@ -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;

View File

@@ -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 {

View File

@@ -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;

View File

@@ -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 */