Skip to contentSkip to conversation

f2fs: preload extent_cache for POSIX_FADV_WILLNEED

PATCH Applied Jaegeuk Kim 3 participants 4 messages Sep 20, 2023 – Sep 26, 2023 F2FS file system

lore
Share & tools
lore

Jaegeuk Kim

author maintainer
#0 lore raw

PATCH 1/1 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.

---
 fs/f2fs/file.c | 2 ++
 1 file changed, 2 insertions(+)
fs/f2fs/file.c +2 -0
index 09716127e107..df7703c1f7d7 100644
@@ -4858,6 +4858,8 @@ 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) {
+		f2fs_precache_extents(inode);
 	}
 
 	err = generic_fadvise(filp, offset, len, advice);
Signature · 1 line
2.42.0.459.ge4e396fd5e-goog
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Jaegeuk Kim

This patch tries to preload extent_cache given POSIX_FADV_WILLNEED, which is more useful for generic usecases.

Thanks,

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

#2 lore raw
In reply to Jaegeuk Kim
This patch was applied to jaegeuk/f2fs.git (dev) by Jaegeuk Kim <[email protected]>:

Hello:

This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <[email protected]>:

Quoted 8 lines · On Tue, 19 Sep 2023 17:46:45 -0700 you wrote:

This patch tries to preload extent_cache given POSIX_FADV_WILLNEED, which is more useful for generic usecases.

---
 fs/f2fs/file.c | 2 ++
 1 file changed, 2 insertions(+)

Here is the summary with links:
- [f2fs-dev] f2fs: preload extent_cache for POSIX_FADV_WILLNEED

    https://git.kernel.org/jaegeuk/f2fs/c/a3edf9f0bbb7

You are awesome, thank you!

Signature · 10 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html




_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
author maintainer Reviewed-by Chao Yu on v1 1/1
#3 lore raw
In reply to Jaegeuk Kim

This patch tries to preload extent_cache given POSIX_FADV_WILLNEED, which is more useful for generic usecases.

---

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(+)
fs/f2fs/file.c +3 -0
index 09716127e107..161826c6e200 100644
@@ -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);
Signature · 1 line
2.42.0.515.g380fc7ccd1-goog