f2fs: let f2fs_precache_extents() traverses in file range
authorChao Yu <chao@kernel.org>
Tue, 10 Oct 2023 01:34:59 +0000 (09:34 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Thu, 12 Oct 2023 00:31:38 +0000 (17:31 -0700)
Rather than in range of [0, max_file_blocks()), since data after EOF
is alwasy zero, it's unnecessary to preload mapping info of the data.

Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/file.c

index 06d35b8aceefedc242fb4669bf32647e23349a29..304d0516d3a42dae7819e41b50de64b94a6dcc3f 100644 (file)
@@ -3263,7 +3263,7 @@ int f2fs_precache_extents(struct inode *inode)
        map.m_next_extent = &m_next_extent;
        map.m_seg_type = NO_CHECK_TYPE;
        map.m_may_create = false;
-       end = max_file_blocks(inode);
+       end = F2FS_BLK_ALIGN(i_size_read(inode));
 
        while (map.m_lblk < end) {
                map.m_len = end - map.m_lblk;