From: Patrick Farrell Date: Tue, 25 Mar 2025 21:23:23 +0000 (-0400) Subject: LU-13814 clio: add coo_dio_pages_init X-Git-Tag: 2.16.55~81 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=2db2c9dcebc67459a31ac3becc0616b50ef6020c;p=fs%2Flustre-release.git LU-13814 clio: add coo_dio_pages_init 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 Change-Id: I30251b4b9e1455f87768e488647296390352cf88 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/58530 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin Reviewed-by: Andreas Dilger Reviewed-by: Shaun Tancheff --- diff --git a/lustre/include/cl_object.h b/lustre/include/cl_object.h index 108c3f7..0d1a49b 100644 --- a/lustre/include/cl_object.h +++ b/lustre/include/cl_object.h @@ -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 diff --git a/lustre/obdclass/cl_page.c b/lustre/obdclass/cl_page.c index 652f985..2055599 100644 --- a/lustre/obdclass/cl_page.c +++ b/lustre/obdclass/cl_page.c @@ -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;