summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2023-09-19 17:43:52 -0700
committerJaegeuk Kim <jaegeuk@kernel.org>2023-09-26 10:38:56 -0700
commit3e729e50d01e6a336132d1739866a6463f82faa9 (patch)
tree03868607277ec4aac108e6defc9c771675e75646
parentf5f3bd903a5d3e3b2ba89f11e0e29db25e60c048 (diff)
downloadlinux-3e729e50d01e6a336132d1739866a6463f82faa9.tar.gz
linux-3e729e50d01e6a336132d1739866a6463f82faa9.tar.bz2
linux-3e729e50d01e6a336132d1739866a6463f82faa9.zip
f2fs: preload extent_cache for POSIX_FADV_WILLNEED
This patch tries to preload extent_cache given POSIX_FADV_WILLNEED, which is more useful for generic usecases. Reviewed-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r--fs/f2fs/file.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 09716127e107..161826c6e200 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -4858,6 +4858,9 @@ static int f2fs_file_fadvise(struct file *filp, loff_t offset, loff_t len,
filp->f_mode &= ~FMODE_RANDOM;
spin_unlock(&filp->f_lock);
return 0;
+ } else if (advice == POSIX_FADV_WILLNEED && offset == 0) {
+ /* Load extent cache at the first readahead. */
+ f2fs_precache_extents(inode);
}
err = generic_fadvise(filp, offset, len, advice);