Whamcloud - gitweb
LU-13814 clio: add cl_dio_pages_complete 11/52111/34
authorPatrick Farrell <pfarrell@whamcloud.com>
Tue, 22 Apr 2025 19:16:10 +0000 (15:16 -0400)
committerOleg Drokin <green@whamcloud.com>
Wed, 7 May 2025 21:10:31 +0000 (21:10 +0000)
This is the equivalent of cl_page_complete for regular
cl_pages.  This is used in a patch to come shortly.

Signed-off-by: Patrick Farrell <pfarrell@whamcloud.com>
Change-Id: I9fc993e57d1607a6ad5cba27f896e0eb2a838218
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/52111
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Qian Yingjin <qian@ddn.com>
Reviewed-by: Marc Vef <mvef@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/cl_object.h
lustre/obdclass/cl_io.c
lustre/obdclass/cl_page.c

index ff70422..fa75ffa 100644 (file)
@@ -2259,12 +2259,14 @@ int cl_page_is_owned(const struct cl_page *pg, const struct cl_io *io);
  */
 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);
+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);
+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);
 
@@ -2556,6 +2558,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;
        /* the file offset of the first page. */
        loff_t                  cdp_file_offset;
index 37abb87..dff5c16 100644 (file)
@@ -1807,6 +1807,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 2055599..f68e2e3 100644 (file)
@@ -1032,6 +1032,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.
  *