Whamcloud - gitweb
LU-13814 clio: remove cl_page_prep for transients 85/52085/21
authorPatrick Farrell <pfarrell@whamcloud.com>
Fri, 23 Feb 2024 16:21:26 +0000 (11:21 -0500)
committerOleg Drokin <green@whamcloud.com>
Thu, 8 Aug 2024 00:03:21 +0000 (00:03 +0000)
cl_page_prep no longer does anything for transient pages,
finish cleaning that up and make it explicit with asserts.

Signed-off-by: Patrick Farrell <patrick.farrell@oracle.com>
Change-Id: I3285a69f971530ba0407de128430bb2497900d11
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/52085
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Qian Yingjin <qian@ddn.com>
Reviewed-by: Sebastien Buisson <sbuisson@ddn.com>
lustre/lov/lov_io.c
lustre/obdclass/cl_page.c
lustre/osc/osc_io.c

index bd235b8..1e22a3f 100644 (file)
@@ -1381,7 +1381,7 @@ static int lov_io_submit(const struct lu_env *env,
                         * the pages will be transient. We don't care about
                         * the return code of cl_page_prep() at all.
                         */
-                       (void) cl_page_prep(env, ios->cis_io, page, crt);
+                       LASSERT(page->cp_type == CPT_TRANSIENT);
                        cl_page_completion(env, page, crt, 0);
                        continue;
                }
index f53ea2d..f25ab21 100644 (file)
@@ -869,10 +869,8 @@ static void cl_page_io_start(const struct lu_env *env,
 {
        /* Page is queued for IO, change its state. */
        ENTRY;
-       if (pg->cp_type != CPT_TRANSIENT) {
-               cl_page_owner_clear(pg);
-               cl_page_state_set(env, pg, cl_req_type_state(crt));
-       }
+       cl_page_owner_clear(pg);
+       cl_page_state_set(env, pg, cl_req_type_state(crt));
        EXIT;
 }
 
@@ -886,8 +884,7 @@ int cl_page_prep(const struct lu_env *env, struct cl_io *io,
        struct page *vmpage = cp->cp_vmpage;
        int rc;
 
-       if (cp->cp_type == CPT_TRANSIENT)
-               GOTO(start, rc = 0);
+       LASSERT(cp->cp_type != CPT_TRANSIENT);
        PASSERT(env, cp, crt < CRT_NR);
        PINVRNT(env, cp, cl_page_is_owned(cp, io));
        PINVRNT(env, cp, cl_page_invariant(cp));
@@ -905,7 +902,6 @@ int cl_page_prep(const struct lu_env *env, struct cl_io *io,
                if (cp->cp_sync_io == NULL)
                        set_page_writeback(vmpage);
        }
-start:
 
        cl_page_io_start(env, cp, crt);
        rc = 0;
@@ -982,9 +978,7 @@ int cl_page_make_ready(const struct lu_env *env, struct cl_page *cp,
 
        ENTRY;
        PASSERT(env, cp, crt == CRT_WRITE);
-
-       if (cp->cp_type == CPT_TRANSIENT)
-               GOTO(out, rc = 0);
+       LASSERT(cp->cp_type != CPT_TRANSIENT);
 
        lock_page(vmpage);
        PASSERT(env, cp, PageUptodate(vmpage));
@@ -1008,7 +1002,6 @@ int cl_page_make_ready(const struct lu_env *env, struct cl_page *cp,
                LBUG();
        }
 
-out:
        if (rc == 0) {
                PASSERT(env, cp, cp->cp_state == CPS_CACHED);
                cl_page_io_start(env, cp, crt);
index fdbf305..296213f 100644 (file)
@@ -140,6 +140,7 @@ int osc_io_submit(const struct lu_env *env, struct cl_io *io,
        unsigned int ppc_bits; /* pages per chunk bits */
        unsigned int ppc;
        bool sync_queue = false;
+       bool dio = false;
 
        LASSERT(qin->pl_nr > 0);
 
@@ -157,8 +158,10 @@ int osc_io_submit(const struct lu_env *env, struct cl_io *io,
                brw_flags |= OBD_BRW_NDELAY;
 
        page = cl_page_list_first(qin);
-       if (page->cp_type == CPT_TRANSIENT)
+       if (page->cp_type == CPT_TRANSIENT) {
                brw_flags |= OBD_BRW_NOCACHE;
+               dio = true;
+       }
        if (lnet_is_rdma_only_page(page->cp_vmpage))
                brw_flags |= OBD_BRW_RDMA_ONLY;
 
@@ -182,23 +185,24 @@ int osc_io_submit(const struct lu_env *env, struct cl_io *io,
                         break;
                 }
 
-               result = cl_page_prep(env, top_io, page, crt);
-               if (result != 0) {
-                        LASSERT(result < 0);
-                        if (result != -EALREADY)
-                                break;
-                        /*
-                         * Handle -EALREADY error: for read case, the page is
-                         * already in UPTODATE state; for write, the page
-                         * is not dirty.
-                         */
-                        result = 0;
-                       continue;
-                }
+               if (!dio) {
+                       result = cl_page_prep(env, top_io, page, crt);
+                       if (result != 0) {
+                               LASSERT(result < 0);
+                               if (result != -EALREADY)
+                                       break;
+                               /*
+                                * Handle -EALREADY error: for read case, the
+                                * page is already in UPTODATE state; for
+                                * write, the page is not dirty.
+                                */
+                               result = 0;
+                               continue;
+                       }
+               }
 
-               if (page->cp_type != CPT_TRANSIENT) {
+               if (!dio)
                        oap->oap_async_flags = ASYNC_URGENT|ASYNC_READY|ASYNC_COUNT_STABLE;
-               }
 
                osc_page_submit(env, opg, crt, brw_flags);
                list_add_tail(&oap->oap_pending_item, &list);