From: Patrick Farrell Date: Mon, 28 Apr 2025 15:39:28 +0000 (-0400) Subject: LU-13814 osc: begin converting queue_dio_pages X-Git-Tag: 2.16.56~31 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=be8e3958845f503beaf094c94183d931424fb6d1;p=fs%2Flustre-release.git LU-13814 osc: begin converting queue_dio_pages This patch begins the lengthy process of converting osc_queue_dio_pages to use the page array rather than the lists. This will be a lengthy process because this ties in to the OSC extent and BRW code. Test-Parameters: testlist=sanity-sec env=ONLY=52,59a,59b Signed-off-by: Patrick Farrell Change-Id: I788faa0748a88045d838fb530107938a639407d0 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/52160 Reviewed-by: Marc Vef Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin Tested-by: Maloo Tested-by: jenkins --- diff --git a/lustre/include/lustre_osc.h b/lustre/include/lustre_osc.h index e24827f..44b763b 100644 --- a/lustre/include/lustre_osc.h +++ b/lustre/include/lustre_osc.h @@ -553,8 +553,9 @@ int osc_teardown_async_page(const struct lu_env *env, struct osc_object *obj, int osc_flush_async_page(const struct lu_env *env, struct cl_io *io, struct osc_page *ops); int osc_queue_dio_pages(const struct lu_env *env, struct cl_io *io, - struct osc_object *obj, struct list_head *list, - int brw_flags); + struct osc_object *obj, struct cl_dio_pages *cdp, + struct list_head *list, + int from_page, int to_page, int brw_flags); int osc_queue_sync_pages(const struct lu_env *env, struct cl_io *io, struct osc_object *obj, struct list_head *list, int brw_flags); diff --git a/lustre/osc/osc_cache.c b/lustre/osc/osc_cache.c index c3128fe..f18d8fa 100644 --- a/lustre/osc/osc_cache.c +++ b/lustre/osc/osc_cache.c @@ -2559,7 +2559,8 @@ out: } int osc_queue_dio_pages(const struct lu_env *env, struct cl_io *io, - struct osc_object *obj, struct list_head *list, + struct osc_object *obj, struct cl_dio_pages *cdp, + struct list_head *list, int from_page, int to_page, int brw_flags) { struct client_obd *cli = osc_cli(obj); @@ -2567,12 +2568,16 @@ int osc_queue_dio_pages(const struct lu_env *env, struct cl_io *io, struct osc_async_page *oap; struct osc_extent *ext; struct osc_lock *oscl; + struct cl_page *page; + struct osc_page *opg; int mppr = cli->cl_max_pages_per_rpc; pgoff_t start = CL_PAGE_EOF; bool can_merge = true; enum cl_req_type crt; int page_count = 0; pgoff_t end = 0; + int i; + ENTRY; if (brw_flags & OBD_BRW_READ) @@ -2580,9 +2585,13 @@ int osc_queue_dio_pages(const struct lu_env *env, struct cl_io *io, else crt = CRT_WRITE; - list_for_each_entry(oap, list, oap_pending_item) { - struct osc_page *opg = oap2osc_page(oap); - pgoff_t index = osc_index(opg); + 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; @@ -2597,9 +2606,11 @@ int osc_queue_dio_pages(const struct lu_env *env, struct cl_io *io, ext = osc_extent_alloc(obj); if (ext == NULL) { - struct osc_async_page *tmp; + for (i = from_page; i <= to_page; i++) { + page = cdp->cdp_cl_pages[i]; + opg = osc_cl_page_osc(page, obj); + oap = &opg->ops_oap; - list_for_each_entry_safe(oap, tmp, list, oap_pending_item) { list_del_init(&oap->oap_pending_item); osc_completion(env, obj, oap, crt, -ENOMEM); } @@ -2642,7 +2653,11 @@ int osc_queue_dio_pages(const struct lu_env *env, struct cl_io *io, CDEBUG(D_CACHE, "requesting %d bytes grant\n", grants); spin_lock(&cli->cl_loi_list_lock); if (osc_reserve_grant(cli, grants) == 0) { - list_for_each_entry(oap, list, oap_pending_item) { + for (i = from_page; i <= to_page; i++) { + page = cdp->cdp_cl_pages[i]; + opg = osc_cl_page_osc(page, obj); + oap = &opg->ops_oap; + osc_consume_write_grant(cli, &oap->oap_brw_page); } diff --git a/lustre/osc/osc_io.c b/lustre/osc/osc_io.c index feb5e03..0b598f9 100644 --- a/lustre/osc/osc_io.c +++ b/lustre/osc/osc_io.c @@ -261,6 +261,8 @@ static int __osc_dio_submit(const struct lu_env *env, struct cl_io *io, bool sync_queue = false; int result = 0; int brw_flags; + int from = -1; + int to = -1; int i = 0; LASSERT(qin->pl_nr > 0); @@ -290,6 +292,8 @@ static int __osc_dio_submit(const struct lu_env *env, struct cl_io *io, opg = osc_cl_page_osc(page, osc); oap = &opg->ops_oap; + if (from == -1) + from = i; osc_page_submit(env, opg, crt, brw_flags); list_add_tail(&oap->oap_pending_item, &list); @@ -313,19 +317,24 @@ static int __osc_dio_submit(const struct lu_env *env, struct cl_io *io, sync_queue = true; } + to = i; if (sync_queue) { - result = osc_queue_dio_pages(env, top_io, osc, &list, + result = osc_queue_dio_pages(env, top_io, osc, cdp, + &list, from, to, brw_flags); if (result < 0) break; + from = -1; queued = 0; sync_queue = false; } } - if (queued > 0) - result = osc_queue_dio_pages(env, top_io, osc, &list, - brw_flags); + if (queued > 0) { + LASSERT(to != -1); + result = osc_queue_dio_pages(env, top_io, osc, cdp, &list, + from, to, brw_flags); + } /* Update c/mtime for sync write. LU-7310 */ if (crt == CRT_WRITE && qout->pl_nr > 0 && result == 0) {