From: Patrick Farrell Date: Tue, 29 Aug 2023 21:01:45 +0000 (-0400) Subject: LU-13814 osc: reduce usage of cdp_cl_pages array X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F64%2F52164%2F19;p=fs%2Flustre-release.git LU-13814 osc: reduce usage of cdp_cl_pages array The cdp_cl_pages array is how we are still keeping cl_pages available, so reducing use of it is the next step. This is the start of that process, in this case in osc_queue_dio_pages. Test-Parameters: fortestonly Test-Parameters: forjanitoronly Signed-off-by: Patrick Farrell Change-Id: Ifd2f5ad63b20df8475f83447a6d9b3d56be3ca70 --- diff --git a/lustre/osc/osc_cache.c b/lustre/osc/osc_cache.c index e2d0498..27e4e1f 100644 --- a/lustre/osc/osc_cache.c +++ b/lustre/osc/osc_cache.c @@ -2542,10 +2542,10 @@ int osc_queue_dio_pages(const struct lu_env *env, struct cl_io *io, struct cl_page *page; struct osc_page *opg; int mppr = cli->cl_max_pages_per_rpc; + int page_count = to_page - from_page + 1; pgoff_t start = CL_PAGE_EOF; bool can_merge = true; enum cl_req_type crt; - int page_count = 0; pgoff_t end = 0; int i; ENTRY; @@ -2555,6 +2555,15 @@ int osc_queue_dio_pages(const struct lu_env *env, struct cl_io *io, else crt = CRT_WRITE; + /* we should never have more pages than can fit in an RPC, but if we do + * we must allow sending of a larger RPC + */ + while (page_count > mppr) + mppr = mppr << 1; + + if (unlikely(cdp->cdp_from > 0 || cdp->cdp_to < PAGE_SIZE - 1)) + can_merge = false; + for (i = from_page; i <= to_page; i++) { pgoff_t index; @@ -2567,11 +2576,6 @@ int osc_queue_dio_pages(const struct lu_env *env, struct cl_io *io, end = index; if (index < start) start = index; - ++page_count; - mppr <<= (page_count > mppr); - - if (unlikely(oap->oap_count < PAGE_SIZE)) - can_merge = false; } ext = osc_extent_alloc(obj);