aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/extents.c
diff options
context:
space:
mode:
authorZhang Yi <yi.zhang@huawei.com>2024-01-27 09:58:04 +0800
committerTheodore Ts'o <tytso@mit.edu>2024-02-01 23:59:21 -0500
commit874eaba96d39334fe9c729ff631e65523616d4d8 (patch)
tree401e4a6a4340ae92b68473fb2f02a34a63f5829f /fs/ext4/extents.c
parent9f1118223aa080021fe9751fa221590654d27669 (diff)
downloadlinux-874eaba96d39334fe9c729ff631e65523616d4d8.tar.gz
ext4: make ext4_map_blocks() distinguish delalloc only extent
Add a new map flag EXT4_MAP_DELAYED to indicate the mapping range is a delayed allocated only (not unwritten) one, and making ext4_map_blocks() can distinguish it, no longer mixing it with holes. Signed-off-by: Zhang Yi <yi.zhang@huawei.com> Reviewed-by: Jan Kara <jack@suse.cz> Link: https://lore.kernel.org/r/20240127015825.1608160-6-yi.zhang@huaweicloud.com Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/extents.c')
-rw-r--r--fs/ext4/extents.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index c5b54fb9eb8bd..7669d154c05e0 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -4076,8 +4076,11 @@ again:
/*
* The delalloc extent containing lblk, it must have been
* added after ext4_map_blocks() checked the extent status
- * tree, adjust the length to the delalloc extent's after
- * lblk.
+ * tree so we are not holding i_rwsem and delalloc info is
+ * only stabilized by i_data_sem we are going to release
+ * soon. Don't modify the extent status tree and report
+ * extent as a hole, just adjust the length to the delalloc
+ * extent's after lblk.
*/
len = es.es_lblk + es.es_len - lblk;
return len;