From e222da1b9eef27b9b41b61a9ae00a287ab73e8e8 Mon Sep 17 00:00:00 2001 From: Patrick Farrell Date: Tue, 29 Aug 2023 17:01:45 -0400 Subject: [PATCH] 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 --- lustre/osc/osc_cache.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) 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); -- 1.8.3.1