From e14b4dac252cf704c4fb0a10f7ac464337a78d57 Mon Sep 17 00:00:00 2001 From: Patrick Farrell Date: Sun, 24 Sep 2023 17:02:02 -0400 Subject: [PATCH] LU-13814 clio: add osc_dio_pages_init We need the OSC offset of the cl_dio_pages array, so we add the osc_dio_pages_init function to collect it. Test-Parameters: fortestonly Test-Parameters: forjanitoronly Signed-off-by: Patrick Farrell Change-Id: I97a0355b1cb39e9106363577c71b9fde64879cdd --- lustre/include/cl_object.h | 1 + lustre/include/lustre_osc.h | 2 ++ lustre/mdc/mdc_dev.c | 1 + lustre/osc/osc_cache.c | 16 +++------------- lustre/osc/osc_object.c | 1 + lustre/osc/osc_page.c | 9 +++++++++ 6 files changed, 17 insertions(+), 13 deletions(-) diff --git a/lustre/include/cl_object.h b/lustre/include/cl_object.h index 2d84e09..d613b5a 100644 --- a/lustre/include/cl_object.h +++ b/lustre/include/cl_object.h @@ -2606,6 +2606,7 @@ struct cl_dio_pages { /* the file offset of the first page. */ loff_t cdp_file_offset; unsigned int cdp_lov_index; + loff_t cdp_osc_off; /* the first and last page can be incomplete, this records the * offsets */ diff --git a/lustre/include/lustre_osc.h b/lustre/include/lustre_osc.h index c85716c..2c9de2f 100644 --- a/lustre/include/lustre_osc.h +++ b/lustre/include/lustre_osc.h @@ -542,6 +542,8 @@ extern struct lu_context_key osc_session_key; #define OSC_FLAGS (ASYNC_URGENT|ASYNC_READY) /* osc_page.c */ +int osc_dio_pages_init(const struct lu_env *env, struct cl_object *obj, + struct cl_dio_pages *cdp, pgoff_t index); int osc_page_init(const struct lu_env *env, struct cl_io *io, struct cl_object *obj, struct cl_page *cl_page, pgoff_t index); diff --git a/lustre/mdc/mdc_dev.c b/lustre/mdc/mdc_dev.c index 2e6f627..184a6e75 100644 --- a/lustre/mdc/mdc_dev.c +++ b/lustre/mdc/mdc_dev.c @@ -1512,6 +1512,7 @@ static int mdc_object_flush(const struct lu_env *env, struct cl_object *obj, static const struct cl_object_operations mdc_ops = { .coo_page_init = osc_page_init, + .coo_dio_pages_init = osc_dio_pages_init, .coo_lock_init = mdc_lock_init, .coo_io_init = mdc_io_init, .coo_attr_get = mdc_attr_get, diff --git a/lustre/osc/osc_cache.c b/lustre/osc/osc_cache.c index 27e4e1f..f4c8da9 100644 --- a/lustre/osc/osc_cache.c +++ b/lustre/osc/osc_cache.c @@ -2541,6 +2541,7 @@ int osc_queue_dio_pages(const struct lu_env *env, struct cl_io *io, struct osc_lock *oscl; struct cl_page *page; struct osc_page *opg; + pgoff_t cdp_index = cdp->cdp_osc_off >> PAGE_SHIFT; int mppr = cli->cl_max_pages_per_rpc; int page_count = to_page - from_page + 1; pgoff_t start = CL_PAGE_EOF; @@ -2564,19 +2565,8 @@ int osc_queue_dio_pages(const struct lu_env *env, struct cl_io *io, if (unlikely(cdp->cdp_from > 0 || cdp->cdp_to < PAGE_SIZE - 1)) can_merge = false; - for (i = from_page; i <= to_page; i++) { - pgoff_t index; - - page = cdp->cdp_cl_pages[i]; - opg = osc_cl_page_osc(page, obj); - oap = &opg->ops_oap; - index = osc_index(opg); - - if (index > end) - end = index; - if (index < start) - start = index; - } + start = cdp_index + from_page; + end = cdp_index + to_page; ext = osc_extent_alloc(obj); if (ext == NULL) { diff --git a/lustre/osc/osc_object.c b/lustre/osc/osc_object.c index 026cb2d..610ca49 100644 --- a/lustre/osc/osc_object.c +++ b/lustre/osc/osc_object.c @@ -421,6 +421,7 @@ static void osc_req_attr_set(const struct lu_env *env, struct cl_object *obj, static const struct cl_object_operations osc_ops = { .coo_page_init = osc_page_init, + .coo_dio_pages_init = osc_dio_pages_init, .coo_lock_init = osc_lock_init, .coo_io_init = osc_io_init, .coo_attr_get = osc_attr_get, diff --git a/lustre/osc/osc_page.c b/lustre/osc/osc_page.c index d5f6482..d7fb3d4 100644 --- a/lustre/osc/osc_page.c +++ b/lustre/osc/osc_page.c @@ -232,6 +232,15 @@ static const struct cl_page_operations osc_page_ops = { .cpo_page_touch = osc_page_touch, }; +int osc_dio_pages_init(const struct lu_env *env, struct cl_object *obj, + struct cl_dio_pages *cdp, pgoff_t index) +{ + cdp->cdp_osc_off = index << PAGE_SHIFT; + + return 0; +} +EXPORT_SYMBOL(osc_dio_pages_init); + int osc_page_init(const struct lu_env *env, struct cl_io *io, struct cl_object *obj, struct cl_page *cl_page, pgoff_t index) { -- 1.8.3.1