On 9/18/25 00:40, Jaegeuk Kim wrote:
> Do we need this?

I think so, it can provide a way to dump more information to troubleshoot
in which function we're trying to update w/ a zero-sized extent.

Thanks,

> 
> On 09/16, Chao Yu wrote:
>> Add a sanity check in __update_extent_tree_range() to detect any
>> zero-sized extent update.
>>
>> Signed-off-by: wangzijie <wangzij...@honor.com>
>> Signed-off-by: Chao Yu <c...@kernel.org>
>> ---
>>  fs/f2fs/extent_cache.c | 9 +++++++++
>>  1 file changed, 9 insertions(+)
>>
>> diff --git a/fs/f2fs/extent_cache.c b/fs/f2fs/extent_cache.c
>> index 199c1e7a83ef..3070d1cb0676 100644
>> --- a/fs/f2fs/extent_cache.c
>> +++ b/fs/f2fs/extent_cache.c
>> @@ -664,6 +664,15 @@ static void __update_extent_tree_range(struct inode 
>> *inode,
>>      if (!et)
>>              return;
>>  
>> +    if (unlikely(len == 0)) {
>> +            f2fs_err_ratelimited(sbi, "%s: extent len is zero, type: %d, "
>> +                    "extent [%u, %u, %u], age [%llu, %llu]",
>> +                    __func__, type, tei->fofs, tei->blk, tei->len,
>> +                    tei->age, tei->last_blocks);
>> +            f2fs_bug_on(sbi, 1);
>> +            return;
>> +    }
>> +
>>      if (type == EX_READ)
>>              trace_f2fs_update_read_extent_tree_range(inode, fofs, len,
>>                                              tei->blk, 0);
>> -- 
>> 2.49.0



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to