Whamcloud - gitweb
LU-13814 clio: add osc_dio_pages_init 65/52165/19
authorPatrick Farrell <pfarrell@whamcloud.com>
Sun, 24 Sep 2023 21:02:02 +0000 (17:02 -0400)
committerPatrick Farrell <pfarrell@whamcloud.com>
Tue, 26 Sep 2023 18:58:30 +0000 (14:58 -0400)
We need the OSC offset of the cl_dio_pages array, so we
add the osc_dio_pages_init function to collect it.

Test-Parameters: fortestonly
Test-Parameters: forjanitoronly
Signed-off-by: Patrick Farrell <pfarrell@whamcloud.com>
Change-Id: I97a0355b1cb39e9106363577c71b9fde64879cdd

lustre/include/cl_object.h
lustre/include/lustre_osc.h
lustre/mdc/mdc_dev.c
lustre/osc/osc_cache.c
lustre/osc/osc_object.c
lustre/osc/osc_page.c

index 2d84e09..d613b5a 100644 (file)
@@ -2606,6 +2606,7 @@ struct cl_dio_pages {
        /* the file offset of the first page. */
        loff_t                  cdp_file_offset;
        unsigned int            cdp_lov_index;
+       loff_t                  cdp_osc_off;
        /* the first and last page can be incomplete, this records the
         * offsets
         */
index c85716c..2c9de2f 100644 (file)
@@ -542,6 +542,8 @@ extern struct lu_context_key osc_session_key;
 #define OSC_FLAGS (ASYNC_URGENT|ASYNC_READY)
 
 /* osc_page.c */
+int osc_dio_pages_init(const struct lu_env *env, struct cl_object *obj,
+                      struct cl_dio_pages *cdp, pgoff_t index);
 int osc_page_init(const struct lu_env *env, struct cl_io *io,
                  struct cl_object *obj, struct cl_page *cl_page,
                  pgoff_t index);
index 2e6f627..184a6e7 100644 (file)
@@ -1512,6 +1512,7 @@ static int mdc_object_flush(const struct lu_env *env, struct cl_object *obj,
 
 static const struct cl_object_operations mdc_ops = {
        .coo_page_init = osc_page_init,
+       .coo_dio_pages_init = osc_dio_pages_init,
        .coo_lock_init = mdc_lock_init,
        .coo_io_init = mdc_io_init,
        .coo_attr_get = mdc_attr_get,
index 27e4e1f..f4c8da9 100644 (file)
@@ -2541,6 +2541,7 @@ int osc_queue_dio_pages(const struct lu_env *env, struct cl_io *io,
        struct osc_lock *oscl;
        struct cl_page *page;
        struct osc_page *opg;
+       pgoff_t cdp_index = cdp->cdp_osc_off >> PAGE_SHIFT;
        int mppr = cli->cl_max_pages_per_rpc;
        int page_count = to_page - from_page + 1;
        pgoff_t start = CL_PAGE_EOF;
@@ -2564,19 +2565,8 @@ int osc_queue_dio_pages(const struct lu_env *env, struct cl_io *io,
        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;
-
-               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;
-               if (index < start)
-                       start = index;
-       }
+       start = cdp_index + from_page;
+       end = cdp_index + to_page;
 
        ext = osc_extent_alloc(obj);
        if (ext == NULL) {
index 026cb2d..610ca49 100644 (file)
@@ -421,6 +421,7 @@ static void osc_req_attr_set(const struct lu_env *env, struct cl_object *obj,
 
 static const struct cl_object_operations osc_ops = {
        .coo_page_init    = osc_page_init,
+       .coo_dio_pages_init = osc_dio_pages_init,
        .coo_lock_init    = osc_lock_init,
        .coo_io_init      = osc_io_init,
        .coo_attr_get     = osc_attr_get,
index d5f6482..d7fb3d4 100644 (file)
@@ -232,6 +232,15 @@ static const struct cl_page_operations osc_page_ops = {
        .cpo_page_touch    = osc_page_touch,
 };
 
+int osc_dio_pages_init(const struct lu_env *env, struct cl_object *obj,
+                      struct cl_dio_pages *cdp, pgoff_t index)
+{
+       cdp->cdp_osc_off = index << PAGE_SHIFT;
+
+       return 0;
+}
+EXPORT_SYMBOL(osc_dio_pages_init);
+
 int osc_page_init(const struct lu_env *env, struct cl_io *io,
                  struct cl_object *obj, struct cl_page *cl_page, pgoff_t index)
 {