From: Patrick Farrell Date: Fri, 14 Jul 2017 14:07:52 +0000 (-0500) Subject: LU-9778 llite: Read ahead should return pages read X-Git-Tag: 2.10.51~2 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=805118241598df27c7617eff4cb9d8229bc8d2ba LU-9778 llite: Read ahead should return pages read ll_read_ahead_pages was modified by: LU-7990 clio: revise readahead to support 16MB IO d8467ab8a2ca15fbbd5be3429c9cf9ceb0fa78b8 And returning the count of pages read was removed. This only affects debug, but it's very nice to have it printed out, and several messages still try to print out pages read ahead, but print 0. Restore this functionality. Signed-off-by: Patrick Farrell Change-Id: I80fe66b5195629e0c46d5d19c76e3bcc0030a22a Reviewed-on: https://review.whamcloud.com/28052 Tested-by: Jenkins Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: Ben Evans Reviewed-by: Gu Zheng Reviewed-by: Jinshan Xiong --- diff --git a/lustre/llite/rw.c b/lustre/llite/rw.c index e359b60..4eece87 100644 --- a/lustre/llite/rw.c +++ b/lustre/llite/rw.c @@ -338,12 +338,11 @@ static int ras_inside_ra_window(unsigned long idx, struct ra_io_arg *ria) static unsigned long ll_read_ahead_pages(const struct lu_env *env, struct cl_io *io, struct cl_page_list *queue, struct ll_readahead_state *ras, - struct ra_io_arg *ria) + struct ra_io_arg *ria, pgoff_t *ra_end) { struct cl_read_ahead ra = { 0 }; - int rc = 0; + int rc = 0, count = 0; bool stride_ria; - unsigned long ra_end = 0; pgoff_t page_idx; LASSERT(ria != NULL); @@ -389,9 +388,13 @@ ll_read_ahead_pages(const struct lu_env *env, struct cl_io *io, if (rc < 0) break; - ra_end = page_idx; - if (rc == 0) + *ra_end = page_idx; + /* Only subtract from reserve & count the page if we + * really did readahead on that page. */ + if (rc == 0) { ria->ria_reserved--; + count++; + } } else if (stride_ria) { /* If it is not in the read-ahead window, and it is * read-ahead mode, then check whether it should skip @@ -418,7 +421,7 @@ ll_read_ahead_pages(const struct lu_env *env, struct cl_io *io, cl_read_ahead_release(env, &ra); - return ra_end; + return count; } static int ll_readahead(const struct lu_env *env, struct cl_io *io, @@ -429,7 +432,7 @@ static int ll_readahead(const struct lu_env *env, struct cl_io *io, struct ll_thread_info *lti = ll_env_info(env); struct cl_attr *attr = vvp_env_thread_attr(env); unsigned long len, mlen = 0; - pgoff_t ra_end, start = 0, end = 0; + pgoff_t ra_end = 0, start = 0, end = 0; struct inode *inode; struct ra_io_arg *ria = <i->lti_ria; struct cl_object *clob; @@ -538,7 +541,7 @@ static int ll_readahead(const struct lu_env *env, struct cl_io *io, atomic_read(&ll_i2sbi(inode)->ll_ra_info.ra_cur_pages), ll_i2sbi(inode)->ll_ra_info.ra_max_pages); - ra_end = ll_read_ahead_pages(env, io, queue, ras, ria); + ret = ll_read_ahead_pages(env, io, queue, ras, ria, &ra_end); if (ria->ria_reserved != 0) ll_ra_count_put(ll_i2sbi(inode), ria->ria_reserved);