Message ID | 1591146001-27171-12-git-send-email-jsimmons@infradead.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | lustre: OpenSFS backport patches for May 29 2020 | expand |
diff --git a/fs/lustre/llite/rw.c b/fs/lustre/llite/rw.c index fd0bed6..ff8f3c6 100644 --- a/fs/lustre/llite/rw.c +++ b/fs/lustre/llite/rw.c @@ -350,7 +350,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 */