ext4: factor out __es_alloc_extent() and __es_free_extent()
authorBaokun Li <libaokun1@huawei.com>
Mon, 24 Apr 2023 03:38:37 +0000 (11:38 +0800)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 26 Jun 2023 23:35:12 +0000 (19:35 -0400)
commit73a2f033656be11298912201ad50615307b4477a
treec6394eddf66d52c17378946d45c51b836a47db77
parent9649eb18c6288f514cacffdd699d5cd999c2f8f6
ext4: factor out __es_alloc_extent() and __es_free_extent()

Factor out __es_alloc_extent() and __es_free_extent(), which only allocate
and free extent_status in these two helpers.

The ext4_es_alloc_extent() function is split into __es_alloc_extent()
and ext4_es_init_extent(). In __es_alloc_extent() we allocate memory using
GFP_KERNEL | __GFP_NOFAIL | __GFP_ZERO if the memory allocation cannot
fail, otherwise we use GFP_ATOMIC. and the ext4_es_init_extent() is used to
initialize extent_status and update related variables after a successful
allocation.

This is to prepare for the use of pre-allocated extent_status later.

Signed-off-by: Baokun Li <libaokun1@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20230424033846.4732-4-libaokun1@huawei.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/extents_status.c