From: Patrick Farrell Date: Tue, 22 Apr 2025 19:16:10 +0000 (-0400) Subject: LU-13814 clio: add cl_dio_pages_complete X-Git-Tag: 2.16.55~44 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=4b6cbdf80bba74d1b226ca4db220ed04d0179534;p=fs%2Flustre-release.git LU-13814 clio: add cl_dio_pages_complete 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 Change-Id: I9fc993e57d1607a6ad5cba27f896e0eb2a838218 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/52111 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Qian Yingjin Reviewed-by: Marc Vef Reviewed-by: Oleg Drokin --- diff --git a/lustre/include/cl_object.h b/lustre/include/cl_object.h index ff70422..fa75ffa 100644 --- a/lustre/include/cl_object.h +++ b/lustre/include/cl_object.h @@ -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; diff --git a/lustre/obdclass/cl_io.c b/lustre/obdclass/cl_io.c index 37abb87..dff5c16 100644 --- a/lustre/obdclass/cl_io.c +++ b/lustre/obdclass/cl_io.c @@ -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 diff --git a/lustre/obdclass/cl_page.c b/lustre/obdclass/cl_page.c index 2055599..f68e2e3 100644 --- a/lustre/obdclass/cl_page.c +++ b/lustre/obdclass/cl_page.c @@ -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. *