diff mbox series

btrfs: initialize delayed inodes xarray without GFP_ATOMIC

Message ID b1eaf444091755ac133e26f44fb2836bb5280132.1713367002.git.fdmanana@suse.com (mailing list archive)
State New
Headers show
Series btrfs: initialize delayed inodes xarray without GFP_ATOMIC | expand

Commit Message

Filipe Manana April 17, 2024, 3:18 p.m. UTC
From: Filipe Manana <fdmanana@suse.com>

There's no need to initialize the delayed inodes xarray with a GFP_ATOMIC
flag because that actually does nothing on the xarray operations. That was
needed for radix trees (before their internals were updated to use xarray)
but for xarrays the allocation flags are passed as the last argument to
xa_store() (which we are using correctly).

So initialize the delayed inodes xarray with a simple xa_init().

Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 fs/btrfs/disk-io.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

David Sterba April 17, 2024, 8:50 p.m. UTC | #1
On Wed, Apr 17, 2024 at 04:18:12PM +0100, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
> 
> There's no need to initialize the delayed inodes xarray with a GFP_ATOMIC
> flag because that actually does nothing on the xarray operations. That was
> needed for radix trees (before their internals were updated to use xarray)
> but for xarrays the allocation flags are passed as the last argument to
> xa_store() (which we are using correctly).
> 
> So initialize the delayed inodes xarray with a simple xa_init().
> 
> Signed-off-by: Filipe Manana <fdmanana@suse.com>

Reviewed-by: David Sterba <dsterba@suse.com>
Josef Bacik April 17, 2024, 9:01 p.m. UTC | #2
On Wed, Apr 17, 2024 at 04:18:12PM +0100, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
> 
> There's no need to initialize the delayed inodes xarray with a GFP_ATOMIC
> flag because that actually does nothing on the xarray operations. That was
> needed for radix trees (before their internals were updated to use xarray)
> but for xarrays the allocation flags are passed as the last argument to
> xa_store() (which we are using correctly).
> 
> So initialize the delayed inodes xarray with a simple xa_init().
> 
> Signed-off-by: Filipe Manana <fdmanana@suse.com>

Reviewed-by: Josef Bacik <josef@toxicpanda.com>

Thanks,

Josef
Qu Wenruo April 18, 2024, 1:10 a.m. UTC | #3
在 2024/4/18 00:48, fdmanana@kernel.org 写道:
> From: Filipe Manana <fdmanana@suse.com>
>
> There's no need to initialize the delayed inodes xarray with a GFP_ATOMIC
> flag because that actually does nothing on the xarray operations. That was
> needed for radix trees (before their internals were updated to use xarray)
> but for xarrays the allocation flags are passed as the last argument to
> xa_store() (which we are using correctly).
>
> So initialize the delayed inodes xarray with a simple xa_init().

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu
>
> Signed-off-by: Filipe Manana <fdmanana@suse.com>
> ---
>   fs/btrfs/disk-io.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
> index 6eeac9618a69..5b6838156237 100644
> --- a/fs/btrfs/disk-io.c
> +++ b/fs/btrfs/disk-io.c
> @@ -663,8 +663,7 @@ static void __setup_root(struct btrfs_root *root, struct btrfs_fs_info *fs_info,
>   	root->nr_delalloc_inodes = 0;
>   	root->nr_ordered_extents = 0;
>   	root->inode_tree = RB_ROOT;
> -	/* GFP flags are compatible with XA_FLAGS_*. */
> -	xa_init_flags(&root->delayed_nodes, GFP_ATOMIC);
> +	xa_init(&root->delayed_nodes);
>
>   	btrfs_init_root_block_rsv(root);
>
diff mbox series

Patch

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 6eeac9618a69..5b6838156237 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -663,8 +663,7 @@  static void __setup_root(struct btrfs_root *root, struct btrfs_fs_info *fs_info,
 	root->nr_delalloc_inodes = 0;
 	root->nr_ordered_extents = 0;
 	root->inode_tree = RB_ROOT;
-	/* GFP flags are compatible with XA_FLAGS_*. */
-	xa_init_flags(&root->delayed_nodes, GFP_ATOMIC);
+	xa_init(&root->delayed_nodes);
 
 	btrfs_init_root_block_rsv(root);