Whamcloud - gitweb
LU-12043 llite,readahead: don't always use max RPC size
[fs/lustre-release.git] / lustre / llite / rw.c
index 2eb305f..a5f3f9c 100644 (file)
@@ -369,7 +369,7 @@ ll_read_ahead_pages(const struct lu_env *env, struct cl_io *io,
                                         io->ci_obj, ra.cra_end, page_idx);
                                /* 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 */
@@ -1188,6 +1188,8 @@ int ll_readpage(struct file *file, struct page *vmpage)
                struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
                struct ll_readahead_state *ras = &fd->fd_ras;
                struct lu_env  *local_env = NULL;
+               unsigned long fast_read_pages =
+                       max(RA_REMAIN_WINDOW_MIN, ras->ras_rpc_size);
                struct vvp_page *vpg;
 
                result = -ENODATA;
@@ -1224,7 +1226,7 @@ int ll_readpage(struct file *file, struct page *vmpage)
                         * the case, we can't do fast IO because we will need
                         * 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);