Whamcloud - gitweb
LU-13814 clio: add cl_dio_pages_complete 11/52111/21
authorPatrick Farrell <pfarrell@whamcloud.com>
Sun, 24 Sep 2023 20:58:22 +0000 (16:58 -0400)
committerPatrick Farrell <pfarrell@whamcloud.com>
Tue, 26 Sep 2023 18:58:30 +0000 (14:58 -0400)
This is the equivalent of cl_page_complete for regular
cl_pages.  This is used in a patch to come shortly.

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

lustre/include/cl_object.h
lustre/obdclass/cl_io.c
lustre/obdclass/cl_page.c

index 2306b40..9ebb95d 100644 (file)
@@ -2284,16 +2284,18 @@ int  cl_page_is_owned   (const struct cl_page *pg, const struct cl_io *io);
  * tracking transfer state.
  */
 /** @{ */
-int  cl_page_prep       (const struct lu_env *env, struct cl_io *io,
-                         struct cl_page *pg, enum cl_req_type crt);
-void cl_page_completion (const struct lu_env *env,
-                         struct cl_page *pg, enum cl_req_type crt, int ioret);
-int  cl_page_make_ready (const struct lu_env *env, struct cl_page *pg,
-                         enum cl_req_type crt);
-void cl_page_clip       (const struct lu_env *env, struct cl_page *pg,
-                         int from, int to);
-int  cl_page_flush      (const struct lu_env *env, struct cl_io *io,
-                        struct cl_page *pg);
+int cl_page_prep(const struct lu_env *env, struct cl_io *io,
+                struct cl_page *pg, enum cl_req_type crt);
+void cl_dio_pages_completion(const struct lu_env *env, struct cl_dio_pages *pg,
+                            int count, int ioret);
+void cl_page_completion(const struct lu_env *env,
+                       struct cl_page *pg, enum cl_req_type crt, int ioret);
+int cl_page_make_ready(const struct lu_env *env, struct cl_page *pg,
+                      enum cl_req_type crt);
+void cl_page_clip(const struct lu_env *env, struct cl_page *pg, int from,
+                 int to);
+int cl_page_flush(const struct lu_env *env, struct cl_io *io,
+                 struct cl_page *pg);
 
 /** @} transfer */
 
@@ -2599,6 +2601,7 @@ struct cl_dio_pages {
        struct page             **cdp_pages;
 
        struct cl_page          **cdp_cl_pages;
+       struct cl_sync_io       *cdp_sync_io;
        struct cl_2queue        cdp_queue;
        /** # of pages in the array. */
        size_t                  cdp_count;
index 40358c7..ffe351b 100644 (file)
@@ -1692,6 +1692,10 @@ void __cl_sync_io_note(const struct lu_env *env, struct cl_sync_io *anchor,
                sync_nr = atomic_sub_return(count - 1, &anchor->csi_sync_nr);
        else
                sync_nr = atomic_read(&anchor->csi_sync_nr);
+
+       CDEBUG(D_VFSTRACE,
+              "Noting completion of %d items, %d items remaining.\n",
+              count, sync_nr - 1);
        /*
         * Synchronous IO done without releasing page lock (e.g., as a part of
         * ->{prepare,commit}_write(). Completion is used to signal the end of
index b78a920..878e6c5 100644 (file)
@@ -1056,6 +1056,22 @@ out:
 }
 EXPORT_SYMBOL(cl_page_prep);
 
+/* this is the equivalent of cl_page_completion for a dio pages struct, but is
+ * much simpler - in fact, it only needs to note the completion in the sync io
+ */
+void cl_dio_pages_completion(const struct lu_env *env,
+                            struct cl_dio_pages *cdp, int count, int ioret)
+{
+       struct cl_sub_dio *sdio = container_of(cdp, struct cl_sub_dio,
+                                              csd_dio_pages);
+       ENTRY;
+
+       __cl_sync_io_note(env, &sdio->csd_sync, count, ioret);
+
+       EXIT;
+}
+EXPORT_SYMBOL(cl_dio_pages_completion);
+
 /**
  * Notify layers about transfer completion.
  *