Whamcloud - gitweb
LU-13412 llite: fix read if readahead window smaller than rpc size 32/38132/3
authorWang Shilong <wshilong@ddn.com>
Fri, 3 Apr 2020 13:14:25 +0000 (21:14 +0800)
committerOleg Drokin <green@whamcloud.com>
Wed, 27 May 2020 05:04:45 +0000 (05:04 +0000)
Readahead always try to align readahead with RPC size, but this
could introduce a problem if readahead window is smaller than RPC size.

With current codes, it will fallback a lot of 4k read because
RPC aligned window start plus window pages will be behind of
current read. Fix this to align with readahead window rather
than RPC size in this case.

Change-Id: I0cd33ac7f92a75f38c926db33630f3036bbfd6c7
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-on: https://review.whamcloud.com/38132
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Gu Zheng <gzheng@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>

index 6cf2c74..29ec2b7 100644 (file)
@@ -348,7 +348,11 @@ static unsigned long ria_page_count(struct ra_io_arg *ria)
 static pgoff_t ras_align(struct ll_readahead_state *ras, pgoff_t index)
-       return index - (index % ras->ras_rpc_pages);
+       unsigned opt_size = min(ras->ras_window_pages, ras->ras_rpc_pages);
+       if (opt_size == 0)
+               opt_size = 1;
+       return index - (index % opt_size);
 /* Check whether the index is in the defined ra-window */