From patchwork Thu Jan 21 13:19:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gautham Ananthakrishna X-Patchwork-Id: 12036211 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC4B7C433DB for ; Thu, 21 Jan 2021 13:23:21 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4000D23118 for ; Thu, 21 Jan 2021 13:23:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4000D23118 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 8425B6B000D; Thu, 21 Jan 2021 08:23:20 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 819036B000E; Thu, 21 Jan 2021 08:23:20 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 72F196B0010; Thu, 21 Jan 2021 08:23:20 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0055.hostedemail.com [216.40.44.55]) by kanga.kvack.org (Postfix) with ESMTP id 5B1AC6B000D for ; Thu, 21 Jan 2021 08:23:20 -0500 (EST) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 255998249980 for ; Thu, 21 Jan 2021 13:23:20 +0000 (UTC) X-FDA: 77729848560.13.lock62_3a07a0427563 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin13.hostedemail.com (Postfix) with ESMTP id 05C0F18140B70 for ; Thu, 21 Jan 2021 13:23:20 +0000 (UTC) X-HE-Tag: lock62_3a07a0427563 X-Filterd-Recvd-Size: 4639 Received: from userp2130.oracle.com (userp2130.oracle.com [156.151.31.86]) by imf11.hostedemail.com (Postfix) with ESMTP for ; Thu, 21 Jan 2021 13:23:18 +0000 (UTC) Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 10LDDw4d043265; Thu, 21 Jan 2021 13:23:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2020-01-29; bh=umojX43O9UL+jYD0gI/4zhN6/zL41ZdveCdmKKXIwBM=; b=pqEGV2pIOoYPSPnybD/fuGsJki4qKy0xpc1E9Y+8q/QFTbNTeUfUSqndtJYovCU+vWGz MigODdMtjCkXqF9MbTJs2RCTr5U+YK0AJUELQEADtvNq3VE/SSoCUnUCGSC+fHVugx82 6HbvlcIGUMeK8uLEFlquZF9Ip+Hce3IAN0BDFw14tXbRjcS7YyKGL9brCe7AKgOgcCqd g0l9z2Yh5oSkdes/btHbn1FIagJ9/jhvks5IzVgpZsNJ22YgRVbqTmbcJxYe7BWovCR3 wyG9mNYlyGRfPInXuSr7EHOFWbLZ1PatmjZvm4lWvEXwoE6Y7zZWdQuaJc9leLQGXLK/ 8A== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 3668qaf9tk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 21 Jan 2021 13:23:17 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 10LDFktF106733; Thu, 21 Jan 2021 13:21:16 GMT Received: from pps.reinject (localhost [127.0.0.1]) by userp3030.oracle.com with ESMTP id 3668rexr63-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 21 Jan 2021 13:21:16 +0000 Received: from userp3030.oracle.com (userp3030.oracle.com [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 10LDKZJD123118; Thu, 21 Jan 2021 13:21:16 GMT Received: from gmananth-linux.oraclecorp.com (dhcp-10-166-171-141.vpn.oracle.com [10.166.171.141]) by userp3030.oracle.com with ESMTP id 3668rexq88-4; Thu, 21 Jan 2021 13:21:16 +0000 From: Gautham Ananthakrishna To: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Cc: viro@zeniv.linux.org.uk, matthew.wilcox@oracle.com, khlebnikov@yandex-team.ru, gautham.ananthakrishna@oracle.com Subject: [PATCH RFC 3/6] dcache: add action D_WALK_SKIP_SIBLINGS to d_walk() Date: Thu, 21 Jan 2021 18:49:42 +0530 Message-Id: <1611235185-1685-4-git-send-email-gautham.ananthakrishna@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1611235185-1685-1-git-send-email-gautham.ananthakrishna@oracle.com> References: <1611235185-1685-1-git-send-email-gautham.ananthakrishna@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9870 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 spamscore=0 impostorscore=0 mlxscore=0 priorityscore=1501 phishscore=0 mlxlogscore=999 lowpriorityscore=0 malwarescore=0 adultscore=0 clxscore=1015 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101210072 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Konstantin Khlebnikov This lets skip remaining siblings at seeing d_is_tail_negative(). Signed-off-by: Konstantin Khlebnikov Signed-off-by: Gautham Ananthakrishna --- fs/dcache.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fs/dcache.c b/fs/dcache.c index a506169..894e6da 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -1320,12 +1320,14 @@ void shrink_dcache_sb(struct super_block *sb) * @D_WALK_QUIT: quit walk * @D_WALK_NORETRY: quit when retry is needed * @D_WALK_SKIP: skip this dentry and its children + * @D_WALK_SKIP_SIBLINGS: skip siblings and their children */ enum d_walk_ret { D_WALK_CONTINUE, D_WALK_QUIT, D_WALK_NORETRY, D_WALK_SKIP, + D_WALK_SKIP_SIBLINGS, }; /** @@ -1356,6 +1358,7 @@ static void d_walk(struct dentry *parent, void *data, break; case D_WALK_QUIT: case D_WALK_SKIP: + case D_WALK_SKIP_SIBLINGS: goto out_unlock; case D_WALK_NORETRY: retry = false; @@ -1387,6 +1390,9 @@ static void d_walk(struct dentry *parent, void *data, case D_WALK_SKIP: spin_unlock(&dentry->d_lock); continue; + case D_WALK_SKIP_SIBLINGS: + spin_unlock(&dentry->d_lock); + goto skip_siblings; } if (!list_empty(&dentry->d_subdirs)) { @@ -1398,6 +1404,7 @@ static void d_walk(struct dentry *parent, void *data, } spin_unlock(&dentry->d_lock); } +skip_siblings: /* * All done at this level ... ascend and resume the search. */