From patchwork Thu Feb 27 21:12:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 11410197 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 B52CA92A for ; Thu, 27 Feb 2020 21:32:31 +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 9D76E24677 for ; Thu, 27 Feb 2020 21:32:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9D76E24677 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 CDE6C349AAE; Thu, 27 Feb 2020 13:27:33 -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 C661A205750 for ; Thu, 27 Feb 2020 13:19:51 -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 E0F6F8A44; Thu, 27 Feb 2020 16:18:16 -0500 (EST) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id DF23A46F; Thu, 27 Feb 2020 16:18:16 -0500 (EST) From: James Simmons To: Andreas Dilger , Oleg Drokin , NeilBrown Date: Thu, 27 Feb 2020 16:12:52 -0500 Message-Id: <1582838290-17243-305-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 304/622] lustre: llite: hash just created files if lock allows 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" From: Oleg Drokin If open|creat (and other intent operations later) returned a lookup bit as part of the lock, hash the resultant dentry under this lock, not to trigger further RPCs in subsequent lookups. Benchmark results: This patch can significantly improve open-create + stat on the same client. This patch in combination with two others: https://review.whamcloud.com/32157 https://review.whamcloud.com/33585 Improves the 'stat' side of open-create + stat by >10x. Without patches (master branch commit 26a7abe): mpirun -np 24 --allow-run-as-root /work/tools/bin/mdtest -n 50000 -d /cache1/out/ -F -C -T -v -w 32k SUMMARY rate: (of 1 iterations) Operation Max Min Mean Std Dev --------- --- --- ---- ------- File creation : 3838.205 3838.204 3838.204 0.000 File stat : 33459.289 33459.249 33459.271 0.011 File read : 0.000 0.000 0.000 0.000 File removal : 0.000 0.000 0.000 0.000 Tree creation : 3146.841 3146.841 3146.841 0.000 Tree removal : 0.000 0.000 0.000 0.000 With the three patches: mpirun -np 24 --allow-run-as-root /work/tools/bin/mdtest -n 50000 -d /cache1/out/ -F -C -T -v -w 32k SUMMARY rate: (of 1 iterations) Operation Max Min Mean Std Dev --------- --- --- ---- ------- File creation : 3822.440 3822.439 3822.440 0.000 File stat : 350620.140 350615.980 350617.193 1.051 File read : 0.000 0.000 0.000 0.000 File removal : 0.000 0.000 0.000 0.000 Tree creation : 2076.727 2076.727 2076.727 0.000 Tree removal : 0.000 0.000 0.000 0.000 Note 33K stats/second vs 350K stats/second. ls -l time of the mdtest directory is also reduced from 23.5 seconds to 5.8 seconds. WC-bug-id: https://jira.whamcloud.com/browse/LU-11623 Lustre-commit: fc42cbe0e2e5 ("LU-11623 llite: hash just created files if lock allows") Signed-off-by: Oleg Drokin Reviewed-on: https://review.whamcloud.com/33584 Reviewed-by: Andreas Dilger Reviewed-by: Patrick Farrell Signed-off-by: James Simmons --- fs/lustre/llite/namei.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/fs/lustre/llite/namei.c b/fs/lustre/llite/namei.c index c3e8de4..3c796bd 100644 --- a/fs/lustre/llite/namei.c +++ b/fs/lustre/llite/namei.c @@ -678,9 +678,9 @@ static int ll_lookup_it_finish(struct ptlrpc_request *request, if (bits & MDS_INODELOCK_LOOKUP) d_lustre_revalidate(*de); } else if (!it_disposition(it, DISP_OPEN_CREATE)) { - /* If file created on server, don't depend on parent UPDATE - * lock to unhide it. It is left hidden and next lookup can - * find it in ll_splice_alias. + /* + * If file was created on the server, the dentry is revalidated + * in ll_create_it if the lock allows for it. */ /* Check that parent has UPDATE lock. */ struct lookup_intent parent_it = { @@ -1063,6 +1063,7 @@ static int ll_create_it(struct inode *dir, struct dentry *dentry, struct lookup_intent *it, void *secctx, u32 secctxlen) { struct inode *inode; + u64 bits = 0; int rc = 0; CDEBUG(D_VFSTRACE, "VFS Op:name=%pd, dir=" DFID "(%p), intent=%s\n", @@ -1088,6 +1089,10 @@ static int ll_create_it(struct inode *dir, struct dentry *dentry, return rc; } + ll_set_lock_data(ll_i2sbi(dir)->ll_md_exp, inode, it, &bits); + if (bits & MDS_INODELOCK_LOOKUP) + d_lustre_revalidate(dentry); + d_instantiate(dentry, inode); if (!(ll_i2sbi(inode)->ll_flags & LL_SBI_FILE_SECCTX))