diff options
author | Qu Wenruo <wqu@suse.com> | 2023-08-29 19:48:57 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2023-10-12 16:44:03 +0200 |
commit | 8d54518b5e52e5b351cb5893f83990093699e415 (patch) | |
tree | 7c23fcecebee21d7a905d54a74a1fde1be0868dd /fs/btrfs/dev-replace.c | |
parent | dce28769a33a95425b007f00842d6e12ffa28f83 (diff) | |
download | linux-8d54518b5e52e5b351cb5893f83990093699e415.tar.gz linux-8d54518b5e52e5b351cb5893f83990093699e415.tar.bz2 linux-8d54518b5e52e5b351cb5893f83990093699e415.zip |
btrfs: qgroup: pre-allocate btrfs_qgroup to reduce GFP_ATOMIC usage
Qgroup is the heaviest user of GFP_ATOMIC, but one call site does not
really need GFP_ATOMIC, that is add_qgroup_rb().
That function only searches the rbtree to find if we already have such
entry. If not, then it would try to allocate memory for it.
This means we can afford to pre-allocate such structure unconditionally,
then free the memory if it's not needed.
Considering this function is not a hot path, only utilized by the
following functions:
- btrfs_qgroup_inherit()
For "btrfs subvolume snapshot -i" option.
- btrfs_read_qgroup_config()
At mount time, and we're ensured there would be no existing rb tree
entry for each qgroup.
- btrfs_create_qgroup()
Thus we're completely safe to pre-allocate the extra memory for btrfs_qgroup
structure, and reduce unnecessary GFP_ATOMIC usage.
Reviewed-by: Filipe Manana <fdmanana@suse.com>
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/dev-replace.c')
0 files changed, 0 insertions, 0 deletions