@@ -307,6 +307,9 @@ static inline struct pcc_inode *ll_i2pcci(struct inode *inode)
return ll_i2info(inode)->lli_pcc_inode;
}
+/* default to use at least 16M for fast read if possible */
+#define RA_REMAIN_WINDOW_MIN MiB_TO_PAGES(16UL)
+
/* default to about 64M of readahead on a given system. */
#define SBI_DEFAULT_READAHEAD_MAX MiB_TO_PAGES(64UL)
@@ -376,7 +376,7 @@ static int ras_inside_ra_window(unsigned long idx, struct ra_io_arg *ria)
* update read ahead RPC size.
* NB: it's racy but doesn't matter
*/
- if (ras->ras_rpc_size > ra.cra_rpc_size &&
+ if (ras->ras_rpc_size != ra.cra_rpc_size &&
ra.cra_rpc_size > 0)
ras->ras_rpc_size = ra.cra_rpc_size;
/* trim it to align with optimal RPC size */
@@ -1203,6 +1203,8 @@ int ll_readpage(struct file *file, struct page *vmpage)
struct ll_readahead_state *ras = &fd->fd_ras;
struct lu_env *local_env = NULL;
struct inode *inode = file_inode(file);
+ unsigned long fast_read_pages =
+ max(RA_REMAIN_WINDOW_MIN, ras->ras_rpc_size);
struct vvp_page *vpg;
result = -ENODATA;
@@ -1245,7 +1247,7 @@ int ll_readpage(struct file *file, struct page *vmpage)
* a cl_io to issue the RPC.
*/
if (ras->ras_window_start + ras->ras_window_len <
- ras->ras_next_readahead + PTLRPC_MAX_BRW_PAGES) {
+ ras->ras_next_readahead + fast_read_pages) {
/* export the page and skip io stack */
vpg->vpg_ra_used = 1;
cl_page_export(env, page, 1);