diff options
author | 2023-09-01 10:11:16 +0800 | |
---|---|---|
committer | 2023-10-12 16:44:03 +0200 | |
commit | 79ace7b807281ed4c9c4a847ef9bce71a4f5fa97 (patch) | |
tree | 9210656670c679b58574cfcae81c3e042cf97f29 /fs/btrfs/delayed-inode.c | |
parent | btrfs: qgroup: pre-allocate btrfs_qgroup to reduce GFP_ATOMIC usage (diff) | |
download | wireguard-linux-79ace7b807281ed4c9c4a847ef9bce71a4f5fa97.tar.xz wireguard-linux-79ace7b807281ed4c9c4a847ef9bce71a4f5fa97.zip |
btrfs: qgroup: prealloc btrfs_qgroup_list for __add_relation_rb()
Currently we go GFP_ATOMIC allocation for qgroup relation add, this
includes the following 3 call sites:
- btrfs_read_qgroup_config()
This is not really needed, as at that time we're still in single
thread mode, and no spin lock is held.
- btrfs_add_qgroup_relation()
This one is holding a spinlock, but we're ensured to add at most one
relation, thus we can easily do a preallocation and use the
preallocated memory to avoid GFP_ATOMIC.
- btrfs_qgroup_inherit()
This is a little more tricky, as we may have as many relationships as
inherit::num_qgroups.
Thus we have to properly allocate an array then preallocate all the
memory.
This patch would remove the GFP_ATOMIC allocation for above involved
call sites, by doing preallocation before holding the spinlock, and let
__add_relation_rb() to handle the freeing of the structure.
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/delayed-inode.c')
0 files changed, 0 insertions, 0 deletions