From patchwork Sun Jan 6 22:14:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 10749729 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 49F55746 for ; Sun, 6 Jan 2019 22:15:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3C19528957 for ; Sun, 6 Jan 2019 22:15:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3093A28965; Sun, 6 Jan 2019 22:15:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from pdx1-mailman02.dreamhost.com (pdx1-mailman02.dreamhost.com [64.90.62.194]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C324628957 for ; Sun, 6 Jan 2019 22:15:37 +0000 (UTC) Received: from pdx1-mailman02.dreamhost.com (localhost [IPv6:::1]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id 4359D6820AC; Sun, 6 Jan 2019 14:15:04 -0800 (PST) X-Original-To: lustre-devel@lists.lustre.org Delivered-To: lustre-devel-lustre.org@pdx1-mailman02.dreamhost.com Received: from smtp4.ccs.ornl.gov (smtp4.ccs.ornl.gov [160.91.203.40]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id F11E521FF30 for ; Sun, 6 Jan 2019 14:14:40 -0800 (PST) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp4.ccs.ornl.gov (Postfix) with ESMTP id D4C011005176; Sun, 6 Jan 2019 17:14:30 -0500 (EST) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id D3020BE; Sun, 6 Jan 2019 17:14:30 -0500 (EST) From: James Simmons To: Andreas Dilger , Oleg Drokin , NeilBrown Date: Sun, 6 Jan 2019 17:14:21 -0500 Message-Id: <1546812868-11794-27-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> References: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> Subject: [lustre-devel] [PATCH v2 26/33] lustre: lov: readahead shouldn't exceed component boundary X-BeenThere: lustre-devel@lists.lustre.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "For discussing Lustre software development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lustre Development List MIME-Version: 1.0 Errors-To: lustre-devel-bounces@lists.lustre.org Sender: "lustre-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Jinshan Xiong Otherwise, it will extend the readahead RPC to the next component while the actual lock of that component is not checked. Signed-off-by: Jinshan Xiong WC-bug-id: https://jira.whamcloud.com/browse/LU-9340 Reviewed-on: https://review.whamcloud.com/26677 Reviewed-on: https://review.whamcloud.com/26861 Reviewed-by: Bobi Jam Reviewed-by: Andreas Dilger Reviewed-by: Niu Yawei Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/lov/lov_io.c | 23 ++++++++++++++++------- drivers/staging/lustre/lustre/lov/lov_page.c | 4 +++- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/drivers/staging/lustre/lustre/lov/lov_io.c b/drivers/staging/lustre/lustre/lov/lov_io.c index ec0d14f..9a3352f 100644 --- a/drivers/staging/lustre/lustre/lov/lov_io.c +++ b/drivers/staging/lustre/lustre/lov/lov_io.c @@ -684,28 +684,37 @@ static int lov_io_read_ahead(const struct lu_env *env, return rc; /** - * Adjust the stripe index by layout of raid0. ra->cra_end is + * Adjust the stripe index by layout of comp. ra->cra_end is * the maximum page index covered by an underlying DLM lock. * This function converts cra_end from stripe level to file - * level, and make sure it's not beyond stripe boundary. + * level, and make sure it's not beyond stripe and component + * boundary. */ - if (r0->lo_nr == 1) /* single stripe file */ - return 0; /* cra_end is stripe level, convert it into file level */ ra_end = ra->cra_end; if (ra_end != CL_PAGE_EOF) - ra_end = lov_stripe_pgoff(loo->lo_lsm, index, ra_end, stripe); + ra->cra_end = lov_stripe_pgoff(loo->lo_lsm, index, + ra_end, stripe); + + /* boundary of current component */ + ra_end = cl_index(obj, (loff_t)lov_lse(loo, index)->lsme_extent.e_end); + if (ra_end != CL_PAGE_EOF && ra->cra_end >= ra_end) + ra->cra_end = ra_end - 1; + + if (r0->lo_nr == 1) /* single stripe file */ + return 0; pps = lov_lse(loo, index)->lsme_stripe_size >> PAGE_SHIFT; CDEBUG(D_READA, DFID " max_index = %lu, pps = %u, index = %u, stripe_size = %u, stripe no = %u, start index = %lu\n", - PFID(lu_object_fid(lov2lu(loo))), ra_end, pps, index, + PFID(lu_object_fid(lov2lu(loo))), ra->cra_end, pps, index, lov_lse(loo, index)->lsme_stripe_size, stripe, start); /* never exceed the end of the stripe */ - ra->cra_end = min_t(pgoff_t, ra_end, start + pps - start % pps - 1); + ra->cra_end = min_t(pgoff_t, + ra->cra_end, start + pps - start % pps - 1); return 0; } diff --git a/drivers/staging/lustre/lustre/lov/lov_page.c b/drivers/staging/lustre/lustre/lov/lov_page.c index 8b68d3c..90e2981 100644 --- a/drivers/staging/lustre/lustre/lov/lov_page.c +++ b/drivers/staging/lustre/lustre/lov/lov_page.c @@ -56,7 +56,9 @@ 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, raid0\n", lp); + return (*printer)(env, cookie, + LUSTRE_LOV_NAME "-page@%p, comp index: %x\n", + lp, lp->lps_index); } static const struct cl_page_operations lov_comp_page_ops = {