]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
f2fs: avoid unnecessary block mapping lookups in f2fs_read_data_large_folio
authorYongpeng Yang <yangyongpeng@xiaomi.com>
Fri, 9 Jan 2026 14:46:18 +0000 (22:46 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Sat, 17 Jan 2026 00:00:35 +0000 (00:00 +0000)
In the second call to f2fs_map_blocks within f2fs_read_data_large_folio,
map.m_len exceeds the logical address space to be read. This patch
ensures map.m_len does not exceed the required address space.

Signed-off-by: Yongpeng Yang <yangyongpeng@xiaomi.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/data.c

index 9b70b6d3370314534301aeeb1c5658c4402405a4..7aa1cd43898fbc6783a87271e684953bba8f7b31 100644 (file)
@@ -2468,7 +2468,7 @@ next_folio:
        ffs = NULL;
        nrpages = folio_nr_pages(folio);
 
-       for (; nrpages; nrpages--) {
+       for (; nrpages; nrpages--, max_nr_pages--) {
                sector_t block_nr;
                /*
                 * Map blocks using the previous result first.