From patchwork Mon Nov 27 14:30:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryusuke Konishi X-Patchwork-Id: 170205 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp3165831vqx; Mon, 27 Nov 2023 06:33:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IFKuXJHcLG/Dn0IBaMVwmGSALoCj0PlBuK3tQ/EUisjNnKE3JzzHDVohEFIZOPrbIig8hA4 X-Received: by 2002:a05:6871:438f:b0:1e9:e268:ab6f with SMTP id lv15-20020a056871438f00b001e9e268ab6fmr16357020oab.17.1701095623765; Mon, 27 Nov 2023 06:33:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701095623; cv=none; d=google.com; s=arc-20160816; b=PpgjdnTPeQUHK07OGsx9Xsfa5TnEkxY8zH+irkso1frCrhygJn34ouoLB30Xs4cCjN +PidtWnyxGtghopS3zb9SmTHaGSl7i84XQCe4OrP3d2oXvjG0eB3Wavb+k3lgUwlwZXq gQ34uJgoz1dnr3mRlkaBC0g9WZDqwh2zZYQFxl1jbaPUiGXeqUH7lhf1DeLe1aSJwaHD fR870Ao+tVAeQ+RSKhLWViIlt8SJCiL7F+iBuOTBSOowXsoojMETiv1rkRuYs2B5haiT MfOWUY2mgd8AFRTuN+I+G8AJ7HbpO0o+6922l31ZDHfs91syaZ4xCY3S7n3ZNaRPvfzH Xh+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=LQ0hTMNOO2rQEY/dpZit98zV3CambmsVJR+t1rZ7hqw=; fh=c4gLbwT9pvttlQWxFI2VesWIZ95B4IQ3bBh75IOono4=; b=r6q5AN8StRS7zNfjKL8TW05zJ+aX2y5RmK0VhCZBbl09LLr/Q219vQaMFleJ8ADhCH Gtw0Jd25iVuVM/9JbsorUvPHFpLY1lSiV9UEA97nGRdP1o3VsMMczVw42tvi1DbPUmSR 4I+JZkTfEV3g8r6fPdqL6m3gxj50ty0T+2vHv+8qkBTt2VM3iXUaVSnyNZqE0p1NAp3h MuDv/Cz+ayyfBSm8F5xE6J6aVAFM/nwI71ZOr6jxH2xuUcRyMbByZJVfgi67ZeTHlfeJ Ge5rcPwCZmjE72GJmH59sQfKkH2dOYAPsZZeejZkgs+/XZgFTuoEltIKvezs0akWqLCM Mk9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=lvFBsreH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id j4-20020a056830270400b006d7e9a52180si4168244otu.132.2023.11.27.06.33.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 06:33:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=lvFBsreH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 623E78225091; Mon, 27 Nov 2023 06:33:39 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233957AbjK0Ocj (ORCPT + 99 others); Mon, 27 Nov 2023 09:32:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233799AbjK0ObW (ORCPT ); Mon, 27 Nov 2023 09:31:22 -0500 Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8711C1AD; Mon, 27 Nov 2023 06:31:25 -0800 (PST) Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1cf89df1eecso27319505ad.3; Mon, 27 Nov 2023 06:31:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701095485; x=1701700285; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LQ0hTMNOO2rQEY/dpZit98zV3CambmsVJR+t1rZ7hqw=; b=lvFBsreHk2zBB4k3PxfvUiSWpHMqxYMoxPpfUbGsWPzafdGKfV9jpTYqrtJtgbMJr0 YLQ5fZl+e6CMCbDY+1aGMrqmtXUGHrwj0F8bQJJF5RY/XHhdxxQ7j99AZWHcfRntw+FT 3dtMoaiUrQ3vSNhMf3CRCDNIKozNsXaE+7lLATjUgzIu3+9afC+r3PNfq9yG26mrEuj2 KBtmM2wJp38mRb1irXA3GEyo3CxwrurWtr2o2CiloHIiKVP/jbzg7Q0zPdsBZWba2arb XtpXPHGl8/OQMNnGqRuED2NqSeqTfr6w++2yuqLkT/SQUrcuZ3wT5sZa1slrV7MN1nc6 zpng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701095485; x=1701700285; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LQ0hTMNOO2rQEY/dpZit98zV3CambmsVJR+t1rZ7hqw=; b=oE72ZTJXknOkhAjo3J3fxy49gThjWmVuykMy8N94IEOPx6zQ61MukmGAHxCSyZNTBf ks0GJYEJOTgg9iDzzmPVSj/+U0I9HZ1Wi0/KH7MC4sV4x7REkBYraYcupaIau8zFvX3f yzm3uny6w4gDXVOyN1O+URquzUEzx/UpkRaUtVB5CVIax9k3FYPldLMVOkpcaR3xvpPV 1o6fCJ8FCOPvWzfSJ1fsFu6Voq0/XRCHXCZSv8Ibf0PPNaaFKpnQJDkoyfCz69cZi6GW Cs3/NSH9Lwje7HJUwcBEA+Ui0rumqDU4TX+YnLG9PIzM18h5VMLjuFl0WISgwQH+bDsX 1efQ== X-Gm-Message-State: AOJu0YxjHT9idnkKOUUp8H3D2koxfUuEF1wYakmvTIB3XmvB41Ru4njk DKFSFCUmltCSxWNU8iZTRsA= X-Received: by 2002:a17:902:e843:b0:1cf:d24c:7b6c with SMTP id t3-20020a170902e84300b001cfd24c7b6cmr2485252plg.59.1701095484950; Mon, 27 Nov 2023 06:31:24 -0800 (PST) Received: from carrot.. (i60-34-119-11.s42.a014.ap.plala.or.jp. [60.34.119.11]) by smtp.gmail.com with ESMTPSA id a5-20020a170902ee8500b001cf51972586sm8302784pld.292.2023.11.27.06.31.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 06:31:24 -0800 (PST) From: Ryusuke Konishi To: Andrew Morton Cc: linux-nilfs@vger.kernel.org, Matthew Wilcox , linux-kernel@vger.kernel.org Subject: [PATCH 14/17] nilfs2: Convert nilfs_empty_dir() to use a folio Date: Mon, 27 Nov 2023 23:30:33 +0900 Message-Id: <20231127143036.2425-15-konishi.ryusuke@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231127143036.2425-1-konishi.ryusuke@gmail.com> References: <20231127143036.2425-1-konishi.ryusuke@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Mon, 27 Nov 2023 06:33:39 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783728044967786067 X-GMAIL-MSGID: 1783728044967786067 From: "Matthew Wilcox (Oracle)" Remove three calls to compound_head() by using the folio API. Signed-off-by: Matthew Wilcox (Oracle) Signed-off-by: Ryusuke Konishi --- fs/nilfs2/dir.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/fs/nilfs2/dir.c b/fs/nilfs2/dir.c index 8d8c42e34148..919936d9ec27 100644 --- a/fs/nilfs2/dir.c +++ b/fs/nilfs2/dir.c @@ -203,17 +203,6 @@ static void *nilfs_get_folio(struct inode *dir, unsigned long n, return ERR_PTR(-EIO); } -static void *nilfs_get_page(struct inode *dir, unsigned long n, - struct page **pagep) -{ - struct folio *folio; - void *kaddr = nilfs_get_folio(dir, n, &folio); - - if (!IS_ERR(kaddr)) - *pagep = &folio->page; - return kaddr; -} - /* * NOTE! unlike strncmp, nilfs_match returns 1 for success, 0 for failure. * @@ -611,14 +600,14 @@ int nilfs_make_empty(struct inode *inode, struct inode *parent) */ int nilfs_empty_dir(struct inode *inode) { - struct page *page = NULL; + struct folio *folio = NULL; char *kaddr; unsigned long i, npages = dir_pages(inode); for (i = 0; i < npages; i++) { struct nilfs_dir_entry *de; - kaddr = nilfs_get_page(inode, i, &page); + kaddr = nilfs_get_folio(inode, i, &folio); if (IS_ERR(kaddr)) continue; @@ -647,12 +636,12 @@ int nilfs_empty_dir(struct inode *inode) } de = nilfs_next_entry(de); } - unmap_and_put_page(page, kaddr); + folio_release_kmap(folio, kaddr); } return 1; not_empty: - unmap_and_put_page(page, kaddr); + folio_release_kmap(folio, kaddr); return 0; }