diff options
author | David Sterba <dsterba@suse.com> | 2023-12-06 15:16:03 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2023-12-15 23:01:03 +0100 |
commit | 6140ba8a0a1460986ee98b4062df7d4876b88295 (patch) | |
tree | 78a270ae66e0f20c8d9a939cf9e62e20c79f7413 /fs/btrfs/inode.c | |
parent | eefaf0a1a6f10726faa4d1b7800fdf307e97ef55 (diff) | |
download | linux-stable-6140ba8a0a1460986ee98b4062df7d4876b88295.tar.gz linux-stable-6140ba8a0a1460986ee98b4062df7d4876b88295.tar.bz2 linux-stable-6140ba8a0a1460986ee98b4062df7d4876b88295.zip |
btrfs: switch btrfs_root::delayed_nodes_tree to xarray from radix-tree
The radix-tree has been superseded by the xarray
(https://lwn.net/Articles/745073), this patch converts the
btrfs_root::delayed_nodes, the APIs are used in a simple way.
First idea is to do xa_insert() but this would require GFP_ATOMIC
allocation which we want to avoid if possible. The preload mechanism of
radix-tree can be emulated within the xarray API.
- xa_reserve() with GFP_NOFS outside of the lock, the reserved entry
is inserted atomically at most once
- xa_store() under a lock, in case something races in we can detect that
and xa_load() returns a valid pointer
All uses of xa_load() must check for a valid pointer in case they manage
to get between the xa_reserve() and xa_store(), this is handled in
btrfs_get_delayed_node().
Otherwise the functionality is equivalent, xarray implements the
radix-tree and there should be no performance difference.
The patch continues the efforts started in 253bf57555e451 ("btrfs: turn
delayed_nodes_tree into an XArray") and fixes the problems with locking
and GFP flags 088aea3b97e0ae ("Revert "btrfs: turn delayed_nodes_tree
into an XArray"").
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r-- | fs/btrfs/inode.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index a1f6e8d3b546..17cfba9ee273 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -3805,7 +3805,7 @@ cache_index: * cache. * * This is required for both inode re-read from disk and delayed inode - * in delayed_nodes_tree. + * in the delayed_nodes xarray. */ if (BTRFS_I(inode)->last_trans == btrfs_get_fs_generation(fs_info)) set_bit(BTRFS_INODE_NEEDS_FULL_SYNC, |