From b32321feef7b1bf4eebe8bb3ea0cc6a945e4a285 Mon Sep 17 00:00:00 2001 From: Patrick Farrell Date: Sun, 25 Feb 2024 13:05:27 -0500 Subject: [PATCH] LU-13814 clio: convert lov submit to cl_dio_pages This patch converts lov layer of IO submit to use the cl_dio_pages array. This simplifies that code since the page array is all on one stripe and can only succeed or fail completely. (No partial successes.) This pushes the array-to-queue conversion down to the OSC layer. Signed-off-by: Patrick Farrell Change-Id: Ic414218be2be07bb7d74b150faebf5f404760d80 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/52113 Reviewed-by: Andreas Dilger Reviewed-by: Marc Vef Reviewed-by: Shaun Tancheff Reviewed-by: Oleg Drokin Tested-by: Maloo Tested-by: jenkins --- lustre/include/lustre_osc.h | 3 ++ lustre/lov/lov_io.c | 74 ++++++++------------------------------------- lustre/mdc/mdc_dev.c | 1 + lustre/osc/osc_io.c | 26 ++++++++++++++++ 4 files changed, 43 insertions(+), 61 deletions(-) diff --git a/lustre/include/lustre_osc.h b/lustre/include/lustre_osc.h index fd4aaa2..1cde847 100644 --- a/lustre/include/lustre_osc.h +++ b/lustre/include/lustre_osc.h @@ -643,6 +643,9 @@ void osc_schedule_grant_work(void); int osc_io_submit(const struct lu_env *env, struct cl_io *io, const struct cl_io_slice *ios, enum cl_req_type crt, struct cl_2queue *queue); +int osc_dio_submit(const struct lu_env *env, struct cl_io *io, + const struct cl_io_slice *ios, enum cl_req_type crt, + struct cl_dio_pages *cdp); int osc_io_commit_async(const struct lu_env *env, const struct cl_io_slice *ios, struct cl_page_list *qin, int from, int to, diff --git a/lustre/lov/lov_io.c b/lustre/lov/lov_io.c index a76f621..b6bbbcc 100644 --- a/lustre/lov/lov_io.c +++ b/lustre/lov/lov_io.c @@ -1327,73 +1327,25 @@ static int lov_dio_submit(const struct lu_env *env, const struct cl_io_slice *ios, enum cl_req_type crt, struct cl_dio_pages *cdp) { - struct cl_page_list *plist = &lov_env_info(env)->lti_plist; - struct lov_io *lio = cl2lov_io(env, ios); - struct cl_2queue *queue; - struct cl_page *page; - struct cl_page_list *qin; - struct lov_io_sub *sub; - int index; + struct lov_io *lio = cl2lov_io(env, ios); + struct lov_io_sub *sub; int rc = 0; + int index; ENTRY; - cl_dio_pages_2queue(cdp); - queue = &cdp->cdp_queue; - - qin = &queue->c2_qin; - page = cl_page_list_first(qin); - - cl_page_list_init(plist); - while (qin->pl_nr > 0) { - struct cl_2queue *cl2q = &lov_env_info(env)->lti_cl2q; - - page = cl_page_list_first(qin); - if (lov_pages_is_empty(cdp)) { - cl_page_list_move(&queue->c2_qout, qin, page); - - /* - * it could only be mirror read to get here therefore - * the pages will be transient. We don't care about - * the return code of cl_page_prep() at all. - */ - LASSERT(page->cp_type == CPT_TRANSIENT); - cl_page_complete(env, page, crt, 0); - continue; - } - - cl_2queue_init(cl2q); - cl_page_list_move(&cl2q->c2_qin, qin, page); - - index = page->cp_lov_index; - /* DIO is already split by stripe */ - cl_page_list_splice(qin, &cl2q->c2_qin); - - sub = lov_sub_get(env, lio, index); - if (!IS_ERR(sub)) { - rc = cl_io_submit_rw(sub->sub_env, &sub->sub_io, - crt, cl2q); - } else { - rc = PTR_ERR(sub); - } - - cl_page_list_splice(&cl2q->c2_qin, plist); - cl_page_list_splice(&cl2q->c2_qout, &queue->c2_qout); - cl_2queue_fini(env, cl2q); - - if (rc != 0) - break; + if (lov_pages_is_empty(cdp)) { + cl_dio_pages_complete(env, cdp, cdp->cdp_page_count, 0); + RETURN(0); } - cl_page_list_splice(plist, qin); - cl_page_list_fini(env, plist); - - /* if submit failed, no pages were sent */ - LASSERT(ergo(rc != 0, list_empty(&queue->c2_qout.pl_pages))); - while (queue->c2_qout.pl_nr > 0) { - struct cl_page *page; + index = cdp->cdp_lov_index; - page = cl_page_list_first(&queue->c2_qout); - cl_page_list_del(env, &queue->c2_qout, page, false); + sub = lov_sub_get(env, lio, index); + if (!IS_ERR(sub)) { + rc = cl_dio_submit_rw(sub->sub_env, &sub->sub_io, + crt, cdp); + } else { + rc = PTR_ERR(sub); } RETURN(rc); diff --git a/lustre/mdc/mdc_dev.c b/lustre/mdc/mdc_dev.c index d064b6b..ba5719e 100644 --- a/lustre/mdc/mdc_dev.c +++ b/lustre/mdc/mdc_dev.c @@ -1381,6 +1381,7 @@ static const struct cl_io_operations mdc_io_ops = { .cio_read_ahead = mdc_io_read_ahead, .cio_lru_reserve = osc_io_lru_reserve, .cio_submit = osc_io_submit, + .cio_dio_submit = osc_dio_submit, .cio_commit_async = osc_io_commit_async, .cio_extent_release = osc_io_extent_release, }; diff --git a/lustre/osc/osc_io.c b/lustre/osc/osc_io.c index e65f6a8..3357174 100644 --- a/lustre/osc/osc_io.c +++ b/lustre/osc/osc_io.c @@ -242,6 +242,31 @@ int osc_io_submit(const struct lu_env *env, struct cl_io *io, } EXPORT_SYMBOL(osc_io_submit); +int osc_dio_submit(const struct lu_env *env, struct cl_io *io, + const struct cl_io_slice *ios, enum cl_req_type crt, + struct cl_dio_pages *cdp) +{ + struct cl_2queue *queue; + int rc = 0; + + cl_dio_pages_2queue(cdp); + queue = &cdp->cdp_queue; + + rc = osc_io_submit(env, io, ios, crt, queue); + + /* if submit failed, no pages were sent */ + LASSERT(ergo(rc != 0, list_empty(&queue->c2_qout.pl_pages))); + while (queue->c2_qout.pl_nr > 0) { + struct cl_page *page; + + page = cl_page_list_first(&queue->c2_qout); + cl_page_list_del(env, &queue->c2_qout, page, false); + } + + RETURN(rc); +} +EXPORT_SYMBOL(osc_dio_submit); + /** * This is called to update the attributes when modifying a specific page, * both when making new pages and when doing updates to existing cached pages. @@ -1332,6 +1357,7 @@ static const struct cl_io_operations osc_io_ops = { .cio_read_ahead = osc_io_read_ahead, .cio_lru_reserve = osc_io_lru_reserve, .cio_submit = osc_io_submit, + .cio_dio_submit = osc_dio_submit, .cio_commit_async = osc_io_commit_async, .cio_extent_release = osc_io_extent_release }; -- 1.8.3.1