From: Yongpeng Yang <[email protected]>

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 <[email protected]>
---
 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
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to