From patchwork Mon May 25 22:07:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 11569551 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 F41D560D for ; Mon, 25 May 2020 22:09: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 DD3902071A for ; Mon, 25 May 2020 22:09:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DD3902071A 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 2E3A12474EE; Mon, 25 May 2020 15:09:06 -0700 (PDT) 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 3052321F59A for ; Mon, 25 May 2020 15:08:36 -0700 (PDT) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp4.ccs.ornl.gov (Postfix) with ESMTP id 2D7CE1005870; Mon, 25 May 2020 18:08:27 -0400 (EDT) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id 2C80E498; Mon, 25 May 2020 18:08:27 -0400 (EDT) From: James Simmons To: Andreas Dilger , Oleg Drokin , NeilBrown Date: Mon, 25 May 2020 18:07:56 -0400 Message-Id: <1590444502-20533-20-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1590444502-20533-1-git-send-email-jsimmons@infradead.org> References: <1590444502-20533-1-git-send-email-jsimmons@infradead.org> Subject: [lustre-devel] [PATCH 19/45] lustre: llite: clean up pcc_layout_wait() 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: Mr NeilBrown pcc_layout_wait() contains a pointless while loop (and an unnecessary blank line) and is a trivial function that is only called once. So move the code into __pcc_layout_invalidate(), remove the while loop, and generally tidy up. WC-bug-id: https://jira.whamcloud.com/browse/LU-10467 Lustre-commit: c5a311781fc60 ("LU-10467 llite: clean up pcc_layout_wait()") Signed-off-by: Mr NeilBrown Reviewed-on: https://review.whamcloud.com/38403 Reviewed-by: Yingjin Qian Reviewed-by: James Simmons Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- fs/lustre/llite/pcc.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/fs/lustre/llite/pcc.c b/fs/lustre/llite/pcc.c index e0628b9..391733e 100644 --- a/fs/lustre/llite/pcc.c +++ b/fs/lustre/llite/pcc.c @@ -1968,20 +1968,17 @@ int pcc_fault(struct vm_area_struct *vma, struct vm_fault *vmf, return rc; } -static void pcc_layout_wait(struct pcc_inode *pcci) -{ - if (atomic_read(&pcci->pcci_active_ios) > 0) - CDEBUG(D_CACHE, "Waiting for IO completion: %d\n", - atomic_read(&pcci->pcci_active_ios)); - wait_event_idle(pcci->pcci_waitq, - atomic_read(&pcci->pcci_active_ios) == 0); -} - static void __pcc_layout_invalidate(struct pcc_inode *pcci) { pcci->pcci_type = LU_PCC_NONE; pcc_layout_gen_set(pcci, CL_LAYOUT_GEN_NONE); - pcc_layout_wait(pcci); + if (atomic_read(&pcci->pcci_active_ios) == 0) + return; + + CDEBUG(D_CACHE, "Waiting for IO completion: %d\n", + atomic_read(&pcci->pcci_active_ios)); + wait_event_idle(pcci->pcci_waitq, + atomic_read(&pcci->pcci_active_ios) == 0); } void pcc_layout_invalidate(struct inode *inode)