Whamcloud - gitweb
LU-13814 osc: reduce usage of cdp_cl_pages array 64/52164/19
authorPatrick Farrell <pfarrell@whamcloud.com>
Tue, 29 Aug 2023 21:01:45 +0000 (17:01 -0400)
committerPatrick Farrell <pfarrell@whamcloud.com>
Tue, 26 Sep 2023 18:58:30 +0000 (14:58 -0400)
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 <pfarrell@whamcloud.com>
Change-Id: Ifd2f5ad63b20df8475f83447a6d9b3d56be3ca70

lustre/osc/osc_cache.c

index e2d0498..27e4e1f 100644 (file)
@@ -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);