From patchwork Thu Feb 27 21:15:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 11410617 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 55316138D for ; Thu, 27 Feb 2020 21:42:33 +0000 (UTC) Received: from pdx1-mailman02.dreamhost.com (pdx1-mailman02.dreamhost.com [64.90.62.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3C33424690 for ; Thu, 27 Feb 2020 21:42:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3C33424690 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lustre-devel-bounces@lists.lustre.org Received: from pdx1-mailman02.dreamhost.com (localhost [IPv6:::1]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id E7D6C34ABC3; Thu, 27 Feb 2020 13:34:25 -0800 (PST) X-Original-To: lustre-devel@lists.lustre.org Delivered-To: lustre-devel-lustre.org@pdx1-mailman02.dreamhost.com Received: from smtp3.ccs.ornl.gov (smtp3.ccs.ornl.gov [160.91.203.39]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id D09AC21F3A2 for ; Thu, 27 Feb 2020 13:20:45 -0800 (PST) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id D5F919174; Thu, 27 Feb 2020 16:18:18 -0500 (EST) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id D491247C; Thu, 27 Feb 2020 16:18:18 -0500 (EST) From: James Simmons To: Andreas Dilger , Oleg Drokin , NeilBrown Date: Thu, 27 Feb 2020 16:15:43 -0500 Message-Id: <1582838290-17243-476-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1582838290-17243-1-git-send-email-jsimmons@infradead.org> References: <1582838290-17243-1-git-send-email-jsimmons@infradead.org> Subject: [lustre-devel] [PATCH 475/622] lustre: llite: extend readahead locks for striped file 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: Wang Shilong , Lustre Development List MIME-Version: 1.0 Errors-To: lustre-devel-bounces@lists.lustre.org Sender: "lustre-devel" From: Wang Shilong Currently cl_io_read_ahead() can not return locks that cross stripe boundary at one time, thus readahead will stop because of this reason. This is really bad, as we will stop readahead every time we hit stripe boundary, for example default stripe size is 1M, this could hurt performances very much especially with async readahead introduced. So try to use existed locks aggressivly if there is no lock contention, otherwise lock should be not less than requested extent. WC-bug-id: https://jira.whamcloud.com/browse/LU-12043 Lustre-commit: cfbeae97d736 ("LU-12043 llite: extend readahead locks for striped file") Signed-off-by: Wang Shilong Reviewed-on: https://review.whamcloud.com/35438 Reviewed-by: Li Xi Reviewed-by: Patrick Farrell Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- fs/lustre/include/cl_object.h | 2 ++ fs/lustre/llite/rw.c | 14 ++++++++++++-- fs/lustre/osc/osc_io.c | 2 ++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/fs/lustre/include/cl_object.h b/fs/lustre/include/cl_object.h index 71ca283..65fdab9 100644 --- a/fs/lustre/include/cl_object.h +++ b/fs/lustre/include/cl_object.h @@ -1474,6 +1474,8 @@ struct cl_read_ahead { void (*cra_release)(const struct lu_env *env, void *cbdata); /* Callback data for cra_release routine */ void *cra_cbdata; + /* whether lock is in contention */ + bool cra_contention; }; static inline void cl_read_ahead_release(const struct lu_env *env, diff --git a/fs/lustre/llite/rw.c b/fs/lustre/llite/rw.c index 4fec9a6..7c2dbdc 100644 --- a/fs/lustre/llite/rw.c +++ b/fs/lustre/llite/rw.c @@ -369,6 +369,18 @@ static int ras_inside_ra_window(unsigned long idx, struct ra_io_arg *ria) if (rc < 0) break; + /* Do not shrink the ria_end at any case until + * the minimum end of current read is covered. + * And only shrink the ria_end if the matched + * LDLM lock doesn't cover more. + */ + if (page_idx > ra.cra_end || + (ra.cra_contention && + page_idx > ria->ria_end_min)) { + ria->ria_end = ra.cra_end; + break; + } + CDEBUG(D_READA, "idx: %lu, ra: %lu, rpc: %lu\n", page_idx, ra.cra_end, ra.cra_rpc_size); LASSERTF(ra.cra_end >= page_idx, @@ -387,8 +399,6 @@ static int ras_inside_ra_window(unsigned long idx, struct ra_io_arg *ria) ria->ria_end = end - 1; if (ria->ria_end < ria->ria_end_min) ria->ria_end = ria->ria_end_min; - if (ria->ria_end > ra.cra_end) - ria->ria_end = ra.cra_end; } /* If the page is inside the read-ahead window */ diff --git a/fs/lustre/osc/osc_io.c b/fs/lustre/osc/osc_io.c index 4f46b95..8e299d4 100644 --- a/fs/lustre/osc/osc_io.c +++ b/fs/lustre/osc/osc_io.c @@ -92,6 +92,8 @@ static int osc_io_read_ahead(const struct lu_env *env, dlmlock->l_policy_data.l_extent.end); ra->cra_release = osc_read_ahead_release; ra->cra_cbdata = dlmlock; + if (ra->cra_end != CL_PAGE_EOF) + ra->cra_contention = true; result = 0; }