From d0caf2ae6c5290d308a79f22e7aeba955bfb6ecb Mon Sep 17 00:00:00 2001 From: Patrick Farrell Date: Sun, 24 Sep 2023 16:58:22 -0400 Subject: [PATCH] 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. Test-Parameters: fortestonly Test-Parameters: forjanitoronly Signed-off-by: Patrick Farrell Change-Id: I9fc993e57d1607a6ad5cba27f896e0eb2a838218 --- lustre/include/cl_object.h | 23 +++++++++++++---------- lustre/obdclass/cl_io.c | 4 ++++ lustre/obdclass/cl_page.c | 16 ++++++++++++++++ 3 files changed, 33 insertions(+), 10 deletions(-) diff --git a/lustre/include/cl_object.h b/lustre/include/cl_object.h index 2306b40..9ebb95d 100644 --- a/lustre/include/cl_object.h +++ b/lustre/include/cl_object.h @@ -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; diff --git a/lustre/obdclass/cl_io.c b/lustre/obdclass/cl_io.c index 40358c7..ffe351b 100644 --- a/lustre/obdclass/cl_io.c +++ b/lustre/obdclass/cl_io.c @@ -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 diff --git a/lustre/obdclass/cl_page.c b/lustre/obdclass/cl_page.c index b78a920..878e6c5 100644 --- a/lustre/obdclass/cl_page.c +++ b/lustre/obdclass/cl_page.c @@ -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. * -- 1.8.3.1