]> www.infradead.org Git - users/willy/xarray.git/commit
ext4: optimize the EXT4_GET_BLOCKS_DELALLOC_RESERVE flag set
authorZhang Yi <yi.zhang@huawei.com>
Tue, 13 Aug 2024 12:34:42 +0000 (20:34 +0800)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 2 Sep 2024 19:26:13 +0000 (15:26 -0400)
commit8b8252884f2ff4d28e3ce1a825057b3ad2900c35
treeac168486770819ff1c87abdb673c22129e2c948f
parent130078d020e0214809f2e13cf4fb80c646020e94
ext4: optimize the EXT4_GET_BLOCKS_DELALLOC_RESERVE flag set

When doing block allocation, magic EXT4_GET_BLOCKS_DELALLOC_RESERVE
means the allocating range covers a range of delayed allocated clusters,
the blocks and quotas have already been reserved in ext4_da_map_blocks(),
we should update the reserved space and don't need to claim them again.

At the moment, we only set this magic in mpage_map_one_extent() when
allocating a range of delayed allocated clusters in the write back path,
it makes things complicated since we have to notice and deal with the
case of allocating non-delayed allocated clusters separately in
ext4_ext_map_blocks(). For example, it we fallocate some blocks that
have been delayed allocated, free space would be claimed again in
ext4_mb_new_blocks() (this is wrong exactily), and we can't claim quota
space again, we have to release the quota reservations made for that
previously delayed allocated clusters.

Move the position thats set the EXT4_GET_BLOCKS_DELALLOC_RESERVE to
where we actually do block allocation, it could simplify above handling
a lot, it means that we always set this magic once the allocation range
covers delalloc blocks, no need to take care of the allocation path.

Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://patch.msgid.link/20240813123452.2824659-3-yi.zhang@huaweicloud.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/inode.c