btrfs: make btrfs_should_delete_dir_index() return a bool instead
authorFilipe Manana <fdmanana@suse.com>
Sat, 31 May 2025 14:41:41 +0000 (15:41 +0100)
committerDavid Sterba <dsterba@suse.com>
Mon, 21 Jul 2025 21:53:30 +0000 (23:53 +0200)
There's no need to return errors and we currently return 1 in case the
index should be deleted and 0 otherwise, so change the return type from
int to bool as this is a boolean function and it's more clear this way.

Reviewed-by: Boris Burkov <boris@bur.io>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/delayed-inode.c
fs/btrfs/delayed-inode.h

index 1e9bec6d24f7b67cededc607c2abc3aeacda4806..050723ade9420d39405af52e28b353b0fc96fb5e 100644 (file)
@@ -1734,17 +1734,16 @@ void btrfs_readdir_put_delayed_items(struct btrfs_inode *inode,
        downgrade_write(&inode->vfs_inode.i_rwsem);
 }
 
-int btrfs_should_delete_dir_index(const struct list_head *del_list,
-                                 u64 index)
+bool btrfs_should_delete_dir_index(const struct list_head *del_list, u64 index)
 {
        struct btrfs_delayed_item *curr;
-       int ret = 0;
+       bool ret = false;
 
        list_for_each_entry(curr, del_list, readdir_list) {
                if (curr->index > index)
                        break;
                if (curr->index == index) {
-                       ret = 1;
+                       ret = true;
                        break;
                }
        }
index c4b4ba122bebb891f5a1816ae9815e6dcca5cdd6..73d13fac89171759d78315ae31dff5fa303cd43d 100644 (file)
@@ -150,8 +150,7 @@ bool btrfs_readdir_get_delayed_items(struct btrfs_inode *inode,
 void btrfs_readdir_put_delayed_items(struct btrfs_inode *inode,
                                     struct list_head *ins_list,
                                     struct list_head *del_list);
-int btrfs_should_delete_dir_index(const struct list_head *del_list,
-                                 u64 index);
+bool btrfs_should_delete_dir_index(const struct list_head *del_list, u64 index);
 int btrfs_readdir_delayed_dir_index(struct dir_context *ctx,
                                    const struct list_head *ins_list);