summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorZhang Yi <yi.zhang@huawei.com>2025-11-29 18:32:43 +0800
committerTheodore Ts'o <tytso@mit.edu>2026-01-18 11:23:33 -0500
commitae3e5ebbdd77a9b2b2eccd6a96ff656dfa3d718f (patch)
tree54cd4d59955d0a46f538de949f1836dc763b1c13 /include
parent42ad7b23b335835548fecc757d6627b67cd5f0b4 (diff)
ext4: make ext4_es_cache_extent() support overwrite existing extents
Currently, ext4_es_cache_extent() is used to load extents into the extent status tree when reading on-disk extent blocks. But it inserts information into the extent status tree if and only if there isn't information about the specified range already. So it only used for the initial loading and does not support overwrit extents. However, there are many other places in ext4 where on-disk extents are inserted into the extent status tree, such as in ext4_map_query_blocks(). Currently, they call ext4_es_insert_extent() to perform the insertion, but they don't modify the extents, so ext4_es_cache_extent() would be a more appropriate choice. However, when ext4_map_query_blocks() inserts an extent, it may overwrite a short existing extent of the same type. Therefore, to prepare for the replacements, we need to extend ext4_es_cache_extent() to allow it to overwrite existing extents with the same status. So it checks the found extents before removing and inserting. (There is one exception, a hole in the on-disk extent but a delayed extent in the extent status tree is allowed.) In addition, since cached extents can be more lenient than the extents they modify and do not involve modifying reserved blocks, it is not necessary to ensure that the insertion operation succeeds as strictly as in the ext4_es_insert_extent() function. Signed-off-by: Zhang Yi <yi.zhang@huawei.com> Reviewed-by: Baokun Li <libaokun1@huawei.com> Message-ID: <20251129103247.686136-12-yi.zhang@huaweicloud.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions