All of lore.kernel.org
 help / color / mirror / Atom feed
* [f2fs-dev] [RFC PATCH 1/1] f2fs: adjust readahead window based on extent length
@ 2025-12-12 13:52 Yongpeng Yang
  2025-12-15  1:55 ` Chao Yu via Linux-f2fs-devel
  2025-12-16  0:48 ` Jaegeuk Kim via Linux-f2fs-devel
  0 siblings, 2 replies; 4+ messages in thread
From: Yongpeng Yang @ 2025-12-12 13:52 UTC (permalink / raw)
  To: Chao Yu, Jaegeuk Kim; +Cc: Yongpeng Yang, Yongpeng Yang, linux-f2fs-devel

From: Yongpeng Yang <yangyongpeng@xiaomi.com>

For readahead, if the current readahead window is smaller than the extent
size, expand the window so that larger bios can be issued and improve
overall read performance.

Signed-off-by: Yongpeng Yang <yangyongpeng@xiaomi.com>
---
 fs/f2fs/data.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index c30e69392a62..2e5cbdb7729c 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -2377,6 +2377,17 @@ static int f2fs_mpage_readpages(struct inode *inode,
 	map.m_seg_type = NO_CHECK_TYPE;
 	map.m_may_create = false;
 
+	if (rac) {
+		loff_t block_in_file;
+
+		block_in_file = rac->_index;
+		map.m_lblk = block_in_file;
+		map.m_len = max(nr_pages, inode_to_bdi(inode)->ra_pages);
+		if (!f2fs_map_blocks(inode, &map, F2FS_GET_BLOCK_DEFAULT) && map.m_len > nr_pages) {
+			readahead_expand(rac, block_in_file << F2FS_BLKSIZE_BITS, map.m_len << F2FS_BLKSIZE_BITS);
+			nr_pages = readahead_count(rac);
+		}
+	}
 	for (; nr_pages; nr_pages--) {
 		if (rac) {
 			folio = readahead_folio(rac);
-- 
2.43.0



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-12-16 13:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-12 13:52 [f2fs-dev] [RFC PATCH 1/1] f2fs: adjust readahead window based on extent length Yongpeng Yang
2025-12-15  1:55 ` Chao Yu via Linux-f2fs-devel
2025-12-16 13:02   ` Yongpeng Yang
2025-12-16  0:48 ` Jaegeuk Kim via Linux-f2fs-devel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.