Skip to content

Commit 1a0c72e

Browse files
committed
btrfs: convert several int parameters to bool
We're almost done cleaning misused int/bool parameters. Convert a bunch of them, found by manual grepping. Note that btrfs_sync_fs() needs an int as it's mandated by the struct super_operations prototype. Reviewed-by: Boris Burkov <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent b63aa0f commit 1a0c72e

22 files changed

+72
-76
lines changed

fs/btrfs/block-group.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1358,7 +1358,7 @@ struct btrfs_trans_handle *btrfs_start_trans_remove_block_group(
13581358
* data in this block group. That check should be done by relocation routine,
13591359
* not this function.
13601360
*/
1361-
static int inc_block_group_ro(struct btrfs_block_group *cache, int force)
1361+
static int inc_block_group_ro(struct btrfs_block_group *cache, bool force)
13621362
{
13631363
struct btrfs_space_info *sinfo = cache->space_info;
13641364
u64 num_bytes;

fs/btrfs/btrfs_inode.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ int btrfs_unlink_inode(struct btrfs_trans_handle *trans,
558558
const struct fscrypt_str *name);
559559
int btrfs_add_link(struct btrfs_trans_handle *trans,
560560
struct btrfs_inode *parent_inode, struct btrfs_inode *inode,
561-
const struct fscrypt_str *name, int add_backref, u64 index);
561+
const struct fscrypt_str *name, bool add_backref, u64 index);
562562
int btrfs_delete_subvolume(struct btrfs_inode *dir, struct dentry *dentry);
563563
int btrfs_truncate_block(struct btrfs_inode *inode, u64 offset, u64 start, u64 end);
564564

fs/btrfs/ctree.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ static int split_node(struct btrfs_trans_handle *trans, struct btrfs_root
3030
*root, struct btrfs_path *path, int level);
3131
static int split_leaf(struct btrfs_trans_handle *trans, struct btrfs_root *root,
3232
const struct btrfs_key *ins_key, struct btrfs_path *path,
33-
int data_size, int extend);
33+
int data_size, bool extend);
3434
static int push_node_left(struct btrfs_trans_handle *trans,
3535
struct extent_buffer *dst,
36-
struct extent_buffer *src, int empty);
36+
struct extent_buffer *src, bool empty);
3737
static int balance_node_right(struct btrfs_trans_handle *trans,
3838
struct extent_buffer *dst_buf,
3939
struct extent_buffer *src_buf);
@@ -1484,7 +1484,7 @@ read_block_for_search(struct btrfs_root *root, struct btrfs_path *p,
14841484
reada_for_search(fs_info, p, parent_level, slot, key->objectid);
14851485

14861486
/* first we do an atomic uptodate check */
1487-
if (btrfs_buffer_uptodate(tmp, check.transid, 1) > 0) {
1487+
if (btrfs_buffer_uptodate(tmp, check.transid, true) > 0) {
14881488
/*
14891489
* Do extra check for first_key, eb can be stale due to
14901490
* being cached, read from scrub, or have multiple
@@ -2686,7 +2686,7 @@ static bool check_sibling_keys(const struct extent_buffer *left,
26862686
*/
26872687
static int push_node_left(struct btrfs_trans_handle *trans,
26882688
struct extent_buffer *dst,
2689-
struct extent_buffer *src, int empty)
2689+
struct extent_buffer *src, bool empty)
26902690
{
26912691
struct btrfs_fs_info *fs_info = trans->fs_info;
26922692
int push_items = 0;
@@ -3102,7 +3102,7 @@ int btrfs_leaf_free_space(const struct extent_buffer *leaf)
31023102
*/
31033103
static noinline int __push_leaf_right(struct btrfs_trans_handle *trans,
31043104
struct btrfs_path *path,
3105-
int data_size, int empty,
3105+
int data_size, bool empty,
31063106
struct extent_buffer *right,
31073107
int free_space, u32 left_nritems,
31083108
u32 min_slot)
@@ -3239,7 +3239,7 @@ static noinline int __push_leaf_right(struct btrfs_trans_handle *trans,
32393239
static int push_leaf_right(struct btrfs_trans_handle *trans, struct btrfs_root
32403240
*root, struct btrfs_path *path,
32413241
int min_data_size, int data_size,
3242-
int empty, u32 min_slot)
3242+
bool empty, u32 min_slot)
32433243
{
32443244
struct extent_buffer *left = path->nodes[0];
32453245
struct extent_buffer *right;
@@ -3316,7 +3316,7 @@ static int push_leaf_right(struct btrfs_trans_handle *trans, struct btrfs_root
33163316
*/
33173317
static noinline int __push_leaf_left(struct btrfs_trans_handle *trans,
33183318
struct btrfs_path *path, int data_size,
3319-
int empty, struct extent_buffer *left,
3319+
bool empty, struct extent_buffer *left,
33203320
int free_space, u32 right_nritems,
33213321
u32 max_slot)
33223322
{
@@ -3642,7 +3642,7 @@ static noinline int split_leaf(struct btrfs_trans_handle *trans,
36423642
struct btrfs_root *root,
36433643
const struct btrfs_key *ins_key,
36443644
struct btrfs_path *path, int data_size,
3645-
int extend)
3645+
bool extend)
36463646
{
36473647
struct btrfs_disk_key disk_key;
36483648
struct extent_buffer *l;

fs/btrfs/disk-io.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ static void csum_tree_block(struct extent_buffer *buf, u8 *result)
116116
* detect blocks that either didn't get written at all or got written
117117
* in the wrong place.
118118
*/
119-
int btrfs_buffer_uptodate(struct extent_buffer *eb, u64 parent_transid, int atomic)
119+
int btrfs_buffer_uptodate(struct extent_buffer *eb, u64 parent_transid, bool atomic)
120120
{
121121
if (!extent_buffer_uptodate(eb))
122122
return 0;
@@ -1047,7 +1047,7 @@ static struct btrfs_root *read_tree_root_path(struct btrfs_root *tree_root,
10471047
root->node = NULL;
10481048
goto fail;
10491049
}
1050-
if (!btrfs_buffer_uptodate(root->node, generation, 0)) {
1050+
if (!btrfs_buffer_uptodate(root->node, generation, false)) {
10511051
ret = -EIO;
10521052
goto fail;
10531053
}

fs/btrfs/disk-io.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,7 @@ static inline struct btrfs_root *btrfs_grab_root(struct btrfs_root *root)
106106
void btrfs_put_root(struct btrfs_root *root);
107107
void btrfs_mark_buffer_dirty(struct btrfs_trans_handle *trans,
108108
struct extent_buffer *buf);
109-
int btrfs_buffer_uptodate(struct extent_buffer *buf, u64 parent_transid,
110-
int atomic);
109+
int btrfs_buffer_uptodate(struct extent_buffer *buf, u64 parent_transid, bool atomic);
111110
int btrfs_read_extent_buffer(struct extent_buffer *buf,
112111
const struct btrfs_tree_parent_check *check);
113112

fs/btrfs/extent-io-tree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1664,7 +1664,7 @@ void btrfs_find_first_clear_extent_bit(struct extent_io_tree *tree, u64 start,
16641664
*/
16651665
u64 btrfs_count_range_bits(struct extent_io_tree *tree,
16661666
u64 *start, u64 search_end, u64 max_bytes,
1667-
u32 bits, int contig,
1667+
u32 bits, bool contig,
16681668
struct extent_state **cached_state)
16691669
{
16701670
struct extent_state *state = NULL;

fs/btrfs/extent-io-tree.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ void __cold btrfs_extent_state_free_cachep(void);
163163

164164
u64 btrfs_count_range_bits(struct extent_io_tree *tree,
165165
u64 *start, u64 search_end,
166-
u64 max_bytes, u32 bits, int contig,
166+
u64 max_bytes, u32 bits, bool contig,
167167
struct extent_state **cached_state);
168168

169169
void btrfs_free_extent_state(struct extent_state *state);

fs/btrfs/extent-tree.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2457,7 +2457,7 @@ int btrfs_cross_ref_exist(struct btrfs_inode *inode, u64 offset,
24572457
static int __btrfs_mod_ref(struct btrfs_trans_handle *trans,
24582458
struct btrfs_root *root,
24592459
struct extent_buffer *buf,
2460-
int full_backref, int inc)
2460+
bool full_backref, bool inc)
24612461
{
24622462
struct btrfs_fs_info *fs_info = root->fs_info;
24632463
u64 parent;
@@ -2543,15 +2543,15 @@ static int __btrfs_mod_ref(struct btrfs_trans_handle *trans,
25432543
}
25442544

25452545
int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
2546-
struct extent_buffer *buf, int full_backref)
2546+
struct extent_buffer *buf, bool full_backref)
25472547
{
2548-
return __btrfs_mod_ref(trans, root, buf, full_backref, 1);
2548+
return __btrfs_mod_ref(trans, root, buf, full_backref, true);
25492549
}
25502550

25512551
int btrfs_dec_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
2552-
struct extent_buffer *buf, int full_backref)
2552+
struct extent_buffer *buf, bool full_backref)
25532553
{
2554-
return __btrfs_mod_ref(trans, root, buf, full_backref, 0);
2554+
return __btrfs_mod_ref(trans, root, buf, full_backref, false);
25552555
}
25562556

25572557
static u64 get_alloc_profile_by_root(struct btrfs_root *root, int data)
@@ -5584,7 +5584,7 @@ static int check_next_block_uptodate(struct btrfs_trans_handle *trans,
55845584

55855585
generation = btrfs_node_ptr_generation(path->nodes[level], path->slots[level]);
55865586

5587-
if (btrfs_buffer_uptodate(next, generation, 0))
5587+
if (btrfs_buffer_uptodate(next, generation, false))
55885588
return 0;
55895589

55905590
check.level = level - 1;
@@ -6051,9 +6051,9 @@ static noinline int walk_up_tree(struct btrfs_trans_handle *trans,
60516051
* also make sure backrefs for the shared block and all lower level
60526052
* blocks are properly updated.
60536053
*
6054-
* If called with for_reloc == 0, may exit early with -EAGAIN
6054+
* If called with for_reloc set, may exit early with -EAGAIN
60556055
*/
6056-
int btrfs_drop_snapshot(struct btrfs_root *root, int update_ref, int for_reloc)
6056+
int btrfs_drop_snapshot(struct btrfs_root *root, bool update_ref, bool for_reloc)
60576057
{
60586058
const bool is_reloc_root = (btrfs_root_id(root) == BTRFS_TREE_RELOC_OBJECTID);
60596059
struct btrfs_fs_info *fs_info = root->fs_info;

fs/btrfs/extent-tree.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,9 @@ int btrfs_reserve_extent(struct btrfs_root *root, u64 ram_bytes, u64 num_bytes,
140140
u64 min_alloc_size, u64 empty_size, u64 hint_byte,
141141
struct btrfs_key *ins, int is_data, int delalloc);
142142
int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
143-
struct extent_buffer *buf, int full_backref);
143+
struct extent_buffer *buf, bool full_backref);
144144
int btrfs_dec_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
145-
struct extent_buffer *buf, int full_backref);
145+
struct extent_buffer *buf, bool full_backref);
146146
int btrfs_set_disk_extent_flags(struct btrfs_trans_handle *trans,
147147
struct extent_buffer *eb, u64 flags);
148148
int btrfs_free_extent(struct btrfs_trans_handle *trans, struct btrfs_ref *ref);
@@ -155,8 +155,7 @@ int btrfs_pin_reserved_extent(struct btrfs_trans_handle *trans,
155155
const struct extent_buffer *eb);
156156
int btrfs_finish_extent_commit(struct btrfs_trans_handle *trans);
157157
int btrfs_inc_extent_ref(struct btrfs_trans_handle *trans, struct btrfs_ref *generic_ref);
158-
int btrfs_drop_snapshot(struct btrfs_root *root, int update_ref,
159-
int for_reloc);
158+
int btrfs_drop_snapshot(struct btrfs_root *root, bool update_ref, bool for_reloc);
160159
int btrfs_drop_subtree(struct btrfs_trans_handle *trans,
161160
struct btrfs_root *root,
162161
struct extent_buffer *node,

fs/btrfs/extent_io.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4523,7 +4523,7 @@ void btrfs_readahead_tree_block(struct btrfs_fs_info *fs_info,
45234523
if (IS_ERR(eb))
45244524
return;
45254525

4526-
if (btrfs_buffer_uptodate(eb, gen, 1)) {
4526+
if (btrfs_buffer_uptodate(eb, gen, true)) {
45274527
free_extent_buffer(eb);
45284528
return;
45294529
}

0 commit comments

Comments
 (0)