From ec7eb7a932b7d95b9b3d12800edb7416bfb4f04a Mon Sep 17 00:00:00 2001 From: Jinshan Xiong Date: Sat, 26 Aug 2017 12:49:38 -0700 Subject: [PATCH] LU-9771 lov: skip empty pages in lov_io_submit() empty page doesn't have corresponding bottem half so it should be completed in the LOV layer. Test-Parameters: testlist=sanity-flr Signed-off-by: Jinshan Xiong Change-Id: Idb4576a8689bdf01638d66fddd123f05ffdd02cf Reviewed-on: https://review.whamcloud.com/29094 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Bobi Jam Reviewed-by: Dmitry Eremin --- lustre/lov/lov_cl_internal.h | 1 + lustre/lov/lov_io.c | 26 +++++++++++++------------- lustre/lov/lov_page.c | 9 +++++++++ 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/lustre/lov/lov_cl_internal.h b/lustre/lov/lov_cl_internal.h index 9382830..56c8bc2 100644 --- a/lustre/lov/lov_cl_internal.h +++ b/lustre/lov/lov_cl_internal.h @@ -650,6 +650,7 @@ struct lu_object *lovsub_object_alloc(const struct lu_env *env, struct lov_stripe_md *lov_lsm_addref(struct lov_object *lov); int lov_page_stripe(const struct cl_page *page); +bool lov_page_is_empty(const struct cl_page *page); int lov_lsm_entry(const struct lov_stripe_md *lsm, __u64 offset); int lov_io_layout_at(struct lov_io *lio, __u64 offset); diff --git a/lustre/lov/lov_io.c b/lustre/lov/lov_io.c index 317fb3f..c07540b 100644 --- a/lustre/lov/lov_io.c +++ b/lustre/lov/lov_io.c @@ -1022,24 +1022,20 @@ static int lov_io_submit(const struct lu_env *env, int rc = 0; ENTRY; - if (lio->lis_nr_subios == 1) { - int idx = lio->lis_single_subio_index; - - sub = lov_sub_get(env, lio, idx); - LASSERT(!IS_ERR(sub)); - LASSERT(sub == &lio->lis_single_subio); - rc = cl_io_submit_rw(sub->sub_env, &sub->sub_io, - crt, queue); - RETURN(rc); - } - cl_page_list_init(plist); while (qin->pl_nr > 0) { struct cl_2queue *cl2q = &lov_env_info(env)->lti_cl2q; - cl_2queue_init(cl2q); - page = cl_page_list_first(qin); + if (lov_page_is_empty(page)) { + cl_page_list_move(&queue->c2_qout, qin, page); + + cl_page_prep(env, ios->cis_io, page, crt); + cl_page_completion(env, page, crt, 0); + continue; + } + + cl_2queue_init(cl2q); cl_page_list_move(&cl2q->c2_qin, qin, page); index = lov_page_index(page); @@ -1088,6 +1084,8 @@ static int lov_io_commit_async(const struct lu_env *env, if (lio->lis_nr_subios == 1) { int idx = lio->lis_single_subio_index; + LASSERT(!lov_page_is_empty(cl_page_list_first(queue))); + sub = lov_sub_get(env, lio, idx); LASSERT(!IS_ERR(sub)); LASSERT(sub == &lio->lis_single_subio); @@ -1103,6 +1101,8 @@ static int lov_io_commit_async(const struct lu_env *env, LASSERT(plist->pl_nr == 0); page = cl_page_list_first(queue); + LASSERT(!lov_page_is_empty(page)); + cl_page_list_move(plist, queue, page); index = lov_page_index(page); diff --git a/lustre/lov/lov_page.c b/lustre/lov/lov_page.c index fa7aea7..96f8da06 100644 --- a/lustre/lov/lov_page.c +++ b/lustre/lov/lov_page.c @@ -137,6 +137,7 @@ int lov_page_init_empty(const struct lu_env *env, struct cl_object *obj, void *addr; ENTRY; + lpg->lps_index = ~0; cl_page_slice_add(page, &lpg->lps_cl, obj, index, &lov_empty_page_ops); addr = kmap(page->cp_vmpage); memset(addr, 0, cl_page_size(obj)); @@ -145,6 +146,14 @@ int lov_page_init_empty(const struct lu_env *env, struct cl_object *obj, RETURN(0); } +bool lov_page_is_empty(const struct cl_page *page) +{ + const struct cl_page_slice *slice = cl_page_at(page, &lov_device_type); + + LASSERT(slice != NULL); + return slice->cpl_ops == &lov_empty_page_ops; +} + /** @} lov */ -- 1.8.3.1