Whamcloud - gitweb
LU-13814 osc: begin converting queue_dio_pages 60/52160/20
authorPatrick Farrell <pfarrell@whamcloud.com>
Mon, 4 Sep 2023 23:38:31 +0000 (19:38 -0400)
committerPatrick Farrell <pfarrell@whamcloud.com>
Tue, 26 Sep 2023 18:58:30 +0000 (14:58 -0400)
This patch begins the lengthy process of converting
osc_queue_dio_pages to use the page array rather than the
lists.  This will be a lengthy process because this ties in
to the OSC extent and BRW code.

Test-Parameters: trivial
Test-Parameters: testlist=sanity-sec env=ONLY=52,59a,59b
Signed-off-by: Patrick Farrell <pfarrell@whamcloud.com>
Change-Id: I788faa0748a88045d838fb530107938a639407d0

lustre/include/lustre_osc.h
lustre/osc/osc_cache.c
lustre/osc/osc_io.c

index f5745a0..c85716c 100644 (file)
@@ -570,8 +570,9 @@ int osc_teardown_async_page(const struct lu_env *env, struct osc_object *obj,
 int osc_flush_async_page(const struct lu_env *env, struct cl_io *io,
                         struct osc_page *ops);
 int osc_queue_dio_pages(const struct lu_env *env, struct cl_io *io,
-                       struct osc_object *obj, struct list_head *list,
-                       int brw_flags);
+                       struct osc_object *obj, struct cl_dio_pages *cdp,
+                       struct list_head *list,
+                       int from_page, int to_page, int brw_flags);
 int osc_queue_sync_pages(const struct lu_env *env, struct cl_io *io,
                         struct osc_object *obj, struct list_head *list,
                         int brw_flags);
index 4c695c8..e2d0498 100644 (file)
@@ -2530,20 +2530,24 @@ out:
 }
 
 int osc_queue_dio_pages(const struct lu_env *env, struct cl_io *io,
-                       struct osc_object *obj, struct list_head *list,
-                       int brw_flags)
+                       struct osc_object *obj, struct cl_dio_pages *cdp,
+                       struct list_head *list,
+                       int from_page, int to_page, int brw_flags)
 {
        struct client_obd *cli = osc_cli(obj);
        struct osc_io *oio = osc_env_io(env);
        struct osc_async_page *oap;
        struct osc_extent *ext;
        struct osc_lock *oscl;
+       struct cl_page *page;
+       struct osc_page *opg;
        int mppr = cli->cl_max_pages_per_rpc;
        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;
 
        if (brw_flags & OBD_BRW_READ)
@@ -2551,9 +2555,13 @@ int osc_queue_dio_pages(const struct lu_env *env, struct cl_io *io,
        else
                crt = CRT_WRITE;
 
-       list_for_each_entry(oap, list, oap_pending_item) {
-               struct osc_page *opg = oap2osc_page(oap);
-               pgoff_t index = osc_index(opg);
+       for (i = from_page; i <= to_page; i++) {
+               pgoff_t index;
+
+               page = cdp->cdp_cl_pages[i];
+               opg = osc_cl_page_osc(page, obj);
+               oap = &opg->ops_oap;
+               index = osc_index(opg);
 
                if (index > end)
                        end = index;
@@ -2568,9 +2576,11 @@ int osc_queue_dio_pages(const struct lu_env *env, struct cl_io *io,
 
        ext = osc_extent_alloc(obj);
        if (ext == NULL) {
-               struct osc_async_page *tmp;
+               for (i = from_page; i <= to_page; i++) {
+                       page = cdp->cdp_cl_pages[i];
+                       opg = osc_cl_page_osc(page, obj);
+                       oap = &opg->ops_oap;
 
-               list_for_each_entry_safe(oap, tmp, list, oap_pending_item) {
                        list_del_init(&oap->oap_pending_item);
                        osc_completion(env, obj, oap, crt, -ENOMEM);
                }
@@ -2604,7 +2614,11 @@ int osc_queue_dio_pages(const struct lu_env *env, struct cl_io *io,
                CDEBUG(D_CACHE, "requesting %d bytes grant\n", grants);
                spin_lock(&cli->cl_loi_list_lock);
                if (osc_reserve_grant(cli, grants) == 0) {
-                       list_for_each_entry(oap, list, oap_pending_item) {
+                       for (i = from_page; i <= to_page; i++) {
+                               page = cdp->cdp_cl_pages[i];
+                               opg = osc_cl_page_osc(page, obj);
+                               oap = &opg->ops_oap;
+
                                osc_consume_write_grant(cli,
                                                        &oap->oap_brw_page);
                        }
index bd504ff..20b912b 100644 (file)
@@ -278,6 +278,8 @@ int __osc_dio_submit(const struct lu_env *env, struct cl_io *io,
        bool sync_queue = false;
        int result = 0;
        int brw_flags;
+       int from = -1;
+       int to = -1;
        int i = 0;
 
        LASSERT(qin->pl_nr > 0);
@@ -307,6 +309,8 @@ int __osc_dio_submit(const struct lu_env *env, struct cl_io *io,
 
                opg = osc_cl_page_osc(page, osc);
                oap = &opg->ops_oap;
+               if (from == -1)
+                       from = i;
 
                osc_page_submit(env, opg, crt, brw_flags);
                list_add_tail(&oap->oap_pending_item, &list);
@@ -330,19 +334,24 @@ int __osc_dio_submit(const struct lu_env *env, struct cl_io *io,
                                sync_queue = true;
                }
 
+               to = i;
                if (sync_queue) {
-                       result = osc_queue_dio_pages(env, top_io, osc, &list,
+                       result = osc_queue_dio_pages(env, top_io, osc, cdp,
+                                                    &list, from, to,
                                                     brw_flags);
                        if (result < 0)
                                break;
+                       from = -1;
                        queued = 0;
                        sync_queue = false;
                }
        }
 
-       if (queued > 0)
-               result = osc_queue_dio_pages(env, top_io, osc, &list,
-                                            brw_flags);
+       if (queued > 0) {
+               LASSERT(to != -1);
+               result = osc_queue_dio_pages(env, top_io, osc, cdp, &list,
+                                            from, to, brw_flags);
+       }
 
        /* Update c/mtime for sync write. LU-7310 */
        if (crt == CRT_WRITE && qout->pl_nr > 0 && result == 0) {