[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZRMXpLyT7OcQ/jYf@google.com>
Date: Tue, 26 Sep 2023 10:40:52 -0700
From: Jaegeuk Kim <jaegeuk@...nel.org>
To: linux-kernel@...r.kernel.org,
linux-f2fs-devel@...ts.sourceforge.net
Cc: Eric Biggers <ebiggers@...nel.org>
Subject: Re: [PATCH v2] 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@...nel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@...nel.org>
---
Change log from v1:
- load it at offset=0 once to avoid reloading for all the calls
fs/f2fs/file.c | 3 +++
1 file changed, 3 insertions(+)
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);
--
2.42.0.515.g380fc7ccd1-goog
Powered by blists - more mailing lists