Whamcloud - gitweb
LU-13814 clio: add coo_dio_pages_init 30/58530/3
authorPatrick Farrell <pfarrell@whamcloud.com>
Tue, 25 Mar 2025 21:23:23 +0000 (17:23 -0400)
committerOleg Drokin <green@whamcloud.com>
Fri, 2 May 2025 02:16:55 +0000 (02:16 +0000)
Just like the cl_page it's replacing, the cl_dio_pages
struct needs various pieces of information from the
different layers of the cl_object in order to do the IO.

This adds the skeletion for coo_dio_pages_init.

Test-Parameters: trivial
Signed-off-by: Patrick Farrell <pfarrell@whamcloud.com>
Change-Id: I30251b4b9e1455f87768e488647296390352cf88
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/58530
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Shaun Tancheff <shaun.tancheff@hpe.com>
lustre/include/cl_object.h
lustre/obdclass/cl_page.c

index 108c3f7..0d1a49b 100644 (file)
@@ -290,6 +290,8 @@ enum coo_inode_opc {
        COIO_SIZE_UNLOCK,
 };
 
+struct cl_dio_pages;
+
 /**
  * Operations implemented for each cl object layer.
  *
@@ -313,7 +315,17 @@ struct cl_object_operations {
         */
        int  (*coo_page_init)(const struct lu_env *env, struct cl_object *obj,
                              struct cl_page *page, pgoff_t index);
-
+       /**
+        * Initialize the dio pages structure with information from this layer
+        *
+        * Called top-to-bottom through every object layer to gather the
+        * per-layer information required for the dio, does the same job as
+        * coo_page_init but just once for each dio page array
+        */
+       int  (*coo_dio_pages_init)(const struct lu_env *env,
+                                  struct cl_object *obj,
+                                  struct cl_dio_pages *cdp,
+                                  pgoff_t index);
        /**
         * Initialize lock slice for this layer. Called top-to-bottom through
         * every object layer when a new cl_lock is instantiated. Layer
@@ -1416,8 +1428,6 @@ static inline void cl_read_ahead_release(const struct lu_env *env,
                ra->cra_release(env, ra);
 }
 
-struct cl_dio_pages;
-
 /**
  * Per-layer io operations.
  * \see vvp_io_ops, lov_io_ops, lovsub_io_ops, osc_io_ops
index 652f985..2055599 100644 (file)
@@ -195,6 +195,8 @@ ssize_t cl_dio_pages_init(const struct lu_env *env, struct cl_object *obj,
                          struct cl_dio_pages *cdp, struct iov_iter *iter,
                          int rw, size_t bytes, loff_t offset, bool unaligned)
 {
+       struct cl_object *head = obj;
+       pgoff_t index = offset >> PAGE_SHIFT;
        ssize_t result = 0;
 
        ENTRY;
@@ -234,6 +236,17 @@ ssize_t cl_dio_pages_init(const struct lu_env *env, struct cl_object *obj,
        if (!cdp->cdp_cl_pages)
                GOTO(out, result = -ENOMEM);
 
+       cl_object_for_each(obj, head) {
+               if (obj->co_ops->coo_dio_pages_init != NULL) {
+                       result = obj->co_ops->coo_dio_pages_init(env, obj,
+                                                                cdp, index);
+                       if (result != 0) {
+                               LASSERT(result < 0);
+                               GOTO(out, result);
+                       }
+               }
+       }
+
 out:
        if (result >= 0)
                result = bytes;