From: Patrick Farrell Date: Thu, 8 Aug 2019 17:14:51 +0000 (-0400) Subject: LU-12535 lov: Move page index to top level X-Git-Tag: 2.12.90~148 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=8d6d2914cf85be0508805cd5195163e1959652f4;hp=05b9da4fd124c61fd41d4b560773c0552a1ee5d7;ds=sidebyside LU-12535 lov: Move page index to top level When doing readahead, we see an amazing amount of time (~5-8%) just looking up the page index from the lov layer. In particular, this is more than half the time spent submitting pages: - 14.14% cl_io_submit_rw - 13.40% lov_io_submit - 8.24% lov_page_index This requires several indirections, all of which can be avoided by moving this up to the cl_page struct. Signed-off-by: Patrick Farrell Change-Id: I99bd7eb4d6556ac89c1aa9aeb4b7afc99774b212 Reviewed-on: https://review.whamcloud.com/35470 Reviewed-by: Wang Shilong Tested-by: jenkins Tested-by: Maloo Reviewed-by: Li Xi Reviewed-by: Oleg Drokin --- diff --git a/lustre/include/cl_object.h b/lustre/include/cl_object.h index 4b13504..695e87b 100644 --- a/lustre/include/cl_object.h +++ b/lustre/include/cl_object.h @@ -763,6 +763,8 @@ struct cl_page { struct lu_ref_link cp_queue_ref; /** Assigned if doing a sync_io */ struct cl_sync_io *cp_sync_io; + /** layout_entry + stripe index, composed using lov_comp_index() */ + unsigned int cp_lov_index; }; /** diff --git a/lustre/lov/lov_cl_internal.h b/lustre/lov/lov_cl_internal.h index a41e978..b811451 100644 --- a/lustre/lov/lov_cl_internal.h +++ b/lustre/lov/lov_cl_internal.h @@ -437,8 +437,6 @@ struct lov_lock { struct lov_page { struct cl_page_slice lps_cl; - /** layout_entry + stripe index, composed using lov_comp_index() */ - unsigned int lps_index; /* the layout gen when this page was created */ __u32 lps_layout_gen; }; diff --git a/lustre/lov/lov_io.c b/lustre/lov/lov_io.c index 3cc6ec0..464c8f2 100644 --- a/lustre/lov/lov_io.c +++ b/lustre/lov/lov_io.c @@ -191,19 +191,6 @@ out: * Lov io operations. * */ - -int lov_page_index(const struct cl_page *page) -{ - const struct cl_page_slice *slice; - ENTRY; - - slice = cl_page_at(page, &lov_device_type); - LASSERT(slice != NULL); - LASSERT(slice->cpl_obj != NULL); - - RETURN(cl2lov_page(slice)->lps_index); -} - static int lov_io_subio_init(const struct lu_env *env, struct lov_io *lio, struct cl_io *io) { @@ -1137,10 +1124,10 @@ static int lov_io_submit(const struct lu_env *env, cl_2queue_init(cl2q); cl_page_list_move(&cl2q->c2_qin, qin, page); - index = lov_page_index(page); + index = page->cp_lov_index; cl_page_list_for_each_safe(page, tmp, qin) { /* this page is not on this stripe */ - if (index != lov_page_index(page)) + if (index != page->cp_lov_index) continue; cl_page_list_move(&cl2q->c2_qin, qin, page); @@ -1204,10 +1191,10 @@ static int lov_io_commit_async(const struct lu_env *env, cl_page_list_move(plist, queue, page); - index = lov_page_index(page); + index = page->cp_lov_index; while (queue->pl_nr > 0) { page = cl_page_list_first(queue); - if (index != lov_page_index(page)) + if (index != page->cp_lov_index) break; cl_page_list_move(plist, queue, page); @@ -1253,7 +1240,7 @@ static int lov_io_fault_start(const struct lu_env *env, fio = &ios->cis_io->u.ci_fault; lio = cl2lov_io(env, ios); - sub = lov_sub_get(env, lio, lov_page_index(fio->ft_page)); + sub = lov_sub_get(env, lio, fio->ft_page->cp_lov_index); sub->sub_io.u.ci_fault.ft_nob = fio->ft_nob; RETURN(lov_io_start(env, ios)); diff --git a/lustre/lov/lov_page.c b/lustre/lov/lov_page.c index cea48a1..2b9d54a 100644 --- a/lustre/lov/lov_page.c +++ b/lustre/lov/lov_page.c @@ -56,8 +56,8 @@ static int lov_comp_page_print(const struct lu_env *env, struct lov_page *lp = cl2lov_page(slice); return (*printer)(env, cookie, - LUSTRE_LOV_NAME"-page@%p, comp index: %x, gen: %u\n", - lp, lp->lps_index, lp->lps_layout_gen); + LUSTRE_LOV_NAME"-page@%p, gen: %u\n", + lp, lp->lps_layout_gen); } static const struct cl_page_operations lov_comp_page_ops = { @@ -96,11 +96,11 @@ int lov_page_init_composite(const struct lu_env *env, struct cl_object *obj, rc = lov_stripe_offset(loo->lo_lsm, entry, offset, stripe, &suboff); LASSERT(rc == 0); - lpg->lps_index = lov_comp_index(entry, stripe); + page->cp_lov_index = lov_comp_index(entry, stripe); lpg->lps_layout_gen = loo->lo_lsm->lsm_layout_gen; cl_page_slice_add(page, &lpg->lps_cl, obj, index, &lov_comp_page_ops); - sub = lov_sub_get(env, lio, lpg->lps_index); + sub = lov_sub_get(env, lio, page->cp_lov_index); if (IS_ERR(sub)) RETURN(PTR_ERR(sub)); @@ -139,7 +139,7 @@ int lov_page_init_empty(const struct lu_env *env, struct cl_object *obj, ENTRY; - lpg->lps_index = ~0; + page->cp_lov_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));