Skip to content

Commit 944cbee

Browse files
fdmananakdave
authored andcommitted
btrfs: make btrfs_readdir_delayed_dir_index() return a bool instead
There's no need to return errors, all we do is return 1 or 0 depending on whether we should or should not stop iterating over delayed dir indexes. So change the function to return bool instead of an int. Signed-off-by: Filipe Manana <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent cde0422 commit 944cbee

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

fs/btrfs/delayed-inode.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1753,15 +1753,14 @@ bool btrfs_should_delete_dir_index(const struct list_head *del_list, u64 index)
17531753
/*
17541754
* Read dir info stored in the delayed tree.
17551755
*/
1756-
int btrfs_readdir_delayed_dir_index(struct dir_context *ctx,
1757-
const struct list_head *ins_list)
1756+
bool btrfs_readdir_delayed_dir_index(struct dir_context *ctx,
1757+
const struct list_head *ins_list)
17581758
{
17591759
struct btrfs_dir_item *di;
17601760
struct btrfs_delayed_item *curr, *next;
17611761
struct btrfs_key location;
17621762
char *name;
17631763
int name_len;
1764-
int over = 0;
17651764
unsigned char d_type;
17661765

17671766
/*
@@ -1770,6 +1769,8 @@ int btrfs_readdir_delayed_dir_index(struct dir_context *ctx,
17701769
* directory, nobody can delete any directory indexes now.
17711770
*/
17721771
list_for_each_entry_safe(curr, next, ins_list, readdir_list) {
1772+
bool over;
1773+
17731774
list_del(&curr->readdir_list);
17741775

17751776
if (curr->index < ctx->pos) {
@@ -1787,17 +1788,16 @@ int btrfs_readdir_delayed_dir_index(struct dir_context *ctx,
17871788
d_type = fs_ftype_to_dtype(btrfs_dir_flags_to_ftype(di->type));
17881789
btrfs_disk_key_to_cpu(&location, &di->location);
17891790

1790-
over = !dir_emit(ctx, name, name_len,
1791-
location.objectid, d_type);
1791+
over = !dir_emit(ctx, name, name_len, location.objectid, d_type);
17921792

17931793
if (refcount_dec_and_test(&curr->refs))
17941794
kfree(curr);
17951795

17961796
if (over)
1797-
return 1;
1797+
return true;
17981798
ctx->pos++;
17991799
}
1800-
return 0;
1800+
return false;
18011801
}
18021802

18031803
static void fill_stack_inode_item(struct btrfs_trans_handle *trans,

fs/btrfs/delayed-inode.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,8 @@ void btrfs_readdir_put_delayed_items(struct btrfs_inode *inode,
151151
struct list_head *ins_list,
152152
struct list_head *del_list);
153153
bool btrfs_should_delete_dir_index(const struct list_head *del_list, u64 index);
154-
int btrfs_readdir_delayed_dir_index(struct dir_context *ctx,
155-
const struct list_head *ins_list);
154+
bool btrfs_readdir_delayed_dir_index(struct dir_context *ctx,
155+
const struct list_head *ins_list);
156156

157157
/* Used during directory logging. */
158158
void btrfs_log_get_delayed_items(struct btrfs_inode *inode,

fs/btrfs/inode.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6170,8 +6170,7 @@ static int btrfs_real_readdir(struct file *file, struct dir_context *ctx)
61706170
if (ret)
61716171
goto nopos;
61726172

6173-
ret = btrfs_readdir_delayed_dir_index(ctx, &ins_list);
6174-
if (ret)
6173+
if (btrfs_readdir_delayed_dir_index(ctx, &ins_list))
61756174
goto nopos;
61766175

61776176
/*

0 commit comments

Comments
 (0)