Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp1155596rdb; Wed, 20 Sep 2023 00:47:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGDyQjlVGqAUTpVzYi+TAekZcdYnSowXm3CqF+f0rcxmlyJWJ6zKg8gVk9OEzo2dQ22y9Ao X-Received: by 2002:a05:6a20:9384:b0:138:60e:9c4 with SMTP id x4-20020a056a20938400b00138060e09c4mr2206197pzh.23.1695196028290; Wed, 20 Sep 2023 00:47:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695196028; cv=none; d=google.com; s=arc-20160816; b=y/EWwSQSqYPCd/dzTxETUIbZraTVBGJ5K4cq5PQUXQ2g5gmXsIBLXFwtCIkcu8VMHQ exchRWcuTqbdCPvpqcLWc9+WpiBqsV1FHHtmiw3buijw4Lba07iorgHW7nVYipJN9WUv U4EUd5iyJ9GdZZXnXRcbGQB2/t4CZUqiLHo26UHxw7qIjefi7LmYCNBRDjxITYhc3NLL CjLhXSWp/o2IjwI/HPlq8LePB7+ON0au16TQzqn9ifte2LQxIyui7+oDUo4jqhHa7SHJ 8pMIfaq99Eeo+tdpZ945oCCuParkCtuAy4NKQbVS/xvq3NTsRPyifl+tgBzRFqpkE3yZ q/3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=5e3f4QzEJgcH/wzSbDI/gKJD4hMsGrXqzvw2fLNZQag=; fh=sRR9gJ37ChtesxPb1iPEABChem0KgDKda8d5/HUMrrk=; b=HinDgeXrakBXzC4QmSnMpxCPDsdoJ4xFrPn5gzvFW80jAa9RBkhuNmW+JEdZbcOQqz KtczFxGJzoeOwEeMlofvfvl8Z/rcuQOIYoZN9oW+/4TIZCbLRB0kku20kOJbC7E1ida1 aDawR77+9k2mgkRCiEbv0WqcdkG5AhZXimL1K/+1GyPKdwzDq64ns0hVNcY+gvRpUk/P 8aOCnrOWc50azBDIHoJgArC0VJI8Ss7hCZPFxFpJdzFV+Rpx+RKzELyjwVW6z2B0ud6l RCSSlzMAZBFFQY/DgU91WaOimvY9qNsROwM7h9NfgzV4eJnjvJPrKzlCj8HwJ2A1kpMN R/jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=UzFd3QYM; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id p18-20020a170902e75200b001bdd35033ebsi11718646plf.361.2023.09.20.00.46.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Sep 2023 00:47:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=UzFd3QYM; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-ext4-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 C2A11834F762; Tue, 19 Sep 2023 22:48:27 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233069AbjITFsa (ORCPT + 99 others); Wed, 20 Sep 2023 01:48:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233125AbjITFsW (ORCPT ); Wed, 20 Sep 2023 01:48:22 -0400 Received: from mail-vk1-xa2e.google.com (mail-vk1-xa2e.google.com [IPv6:2607:f8b0:4864:20::a2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE688197; Tue, 19 Sep 2023 22:48:11 -0700 (PDT) Received: by mail-vk1-xa2e.google.com with SMTP id 71dfb90a1353d-496a775af2fso1275133e0c.0; Tue, 19 Sep 2023 22:48:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695188890; x=1695793690; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=5e3f4QzEJgcH/wzSbDI/gKJD4hMsGrXqzvw2fLNZQag=; b=UzFd3QYMtehCdgeNkvTn4rIvQVKMFQ/UvVVf4H6QmR8BgFdZfIY9gSoKwLHUqAaLRG 3yFf/rq2wcv248xUP0jJ+gpZpugGXXn8nWxU0cdCacDRmYA5E2aLJIAZexhB2aCbmAM0 7AO6bjwFjCdQTkrA8ixSn7M7G6bRu6pIlq2d82PhIQK4IV+YpTC7jkVVW6kQwAmA788b jd7NNovi+H233hSX5GiJCc72IQBo5pj0eSB9a1YuiN8XLyR9LOajzV1NTxc82Gm6p98g tG1HfvYCh2FqSrqw+Yw/yC9JHI/Di8evphmuEy0qzkmNnuooVraq8uA87GC5i/xgKCLb LQQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695188890; x=1695793690; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5e3f4QzEJgcH/wzSbDI/gKJD4hMsGrXqzvw2fLNZQag=; b=Ig2szPowlHCarmLzpqe6edaQwk9VeF+A0tQ/maBMaXFa0RSpAW7YoPAS1p4gJceUuV kSgJCPlWRNMPIFe3ombfAUToeMOoy0u12IE8XjGhKfN1oQLCOj2gDOHDdtcThnbE5BKa KBiXiOA28YWKK74g4xpaHndw5CzINaPojrs/gtFIf/fqBQCOIpzmh4qMbZMuhF+/yJNu 8OvqYymJ0sBGaS6ld/PwluRR9XcLS8+lWfDREAliYl4SdJnDoF0CkQzhxeZghmTzIVAM L49IwTWnmfe12MHKjRhwxXvZQNuNF8HiFGUxGnItus4rU53hwrwbquH8llrPhrYQaj9E vwTA== X-Gm-Message-State: AOJu0Yxw8D6BjvK8d+KJx3SUiqrIa0ERwiC21WUSq6cy0LAeqmTgc/d+ DmkFtn1+75rovgNBQhcu/bZneM3dZb3Wb6rkL0I= X-Received: by 2002:a1f:de43:0:b0:496:295a:843 with SMTP id v64-20020a1fde43000000b00496295a0843mr1735552vkg.13.1695188890584; Tue, 19 Sep 2023 22:48:10 -0700 (PDT) MIME-Version: 1.0 References: <20230919045135.3635437-1-willy@infradead.org> <20230919045135.3635437-12-willy@infradead.org> In-Reply-To: <20230919045135.3635437-12-willy@infradead.org> From: Ryusuke Konishi Date: Wed, 20 Sep 2023 14:47:53 +0900 Message-ID: Subject: Re: [PATCH 11/26] nilfs2: Convert nilfs_copy_page() to nilfs_copy_folio() To: "Matthew Wilcox (Oracle)" Cc: Andrew Morton , linux-fsdevel@vger.kernel.org, gfs2@lists.linux.dev, linux-nilfs@vger.kernel.org, linux-ntfs-dev@lists.sourceforge.net, ntfs3@lists.linux.dev, ocfs2-devel@lists.linux.dev, reiserfs-devel@vger.kernel.org, linux-ext4@vger.kernel.org, Pankaj Raghav Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 19 Sep 2023 22:48:27 -0700 (PDT) On Tue, Sep 19, 2023 at 1:56=E2=80=AFPM Matthew Wilcox (Oracle) wrote: > > Both callers already have a folio, so pass it in and use it directly. > Removes a lot of hidden calls to compound_head(). > > Signed-off-by: Matthew Wilcox (Oracle) > --- > fs/nilfs2/page.c | 50 +++++++++++++++++++++++++----------------------- > 1 file changed, 26 insertions(+), 24 deletions(-) > > diff --git a/fs/nilfs2/page.c b/fs/nilfs2/page.c > index 1c075bd906c9..696215d899bf 100644 > --- a/fs/nilfs2/page.c > +++ b/fs/nilfs2/page.c > @@ -184,30 +184,32 @@ void nilfs_page_bug(struct page *page) > } > > /** > - * nilfs_copy_page -- copy the page with buffers > - * @dst: destination page > - * @src: source page > - * @copy_dirty: flag whether to copy dirty states on the page's buffer h= eads. > + * nilfs_copy_folio -- copy the folio with buffers > + * @dst: destination folio > + * @src: source folio > + * @copy_dirty: flag whether to copy dirty states on the folio's buffer = heads. > * > - * This function is for both data pages and btnode pages. The dirty fla= g > - * should be treated by caller. The page must not be under i/o. > - * Both src and dst page must be locked > + * This function is for both data folios and btnode folios. The dirty f= lag > + * should be treated by caller. The folio must not be under i/o. > + * Both src and dst folio must be locked > */ > -static void nilfs_copy_page(struct page *dst, struct page *src, int copy= _dirty) > +static void nilfs_copy_folio(struct folio *dst, struct folio *src, > + bool copy_dirty) > { > struct buffer_head *dbh, *dbufs, *sbh; > unsigned long mask =3D NILFS_BUFFER_INHERENT_BITS; > > - BUG_ON(PageWriteback(dst)); > + BUG_ON(folio_test_writeback(dst)); > > - sbh =3D page_buffers(src); > - if (!page_has_buffers(dst)) > - create_empty_buffers(dst, sbh->b_size, 0); > + sbh =3D folio_buffers(src); > + dbh =3D folio_buffers(dst); > + if (!dbh) > + dbh =3D folio_create_empty_buffers(dst, sbh->b_size, 0); > > if (copy_dirty) > mask |=3D BIT(BH_Dirty); > > - dbh =3D dbufs =3D page_buffers(dst); > + dbufs =3D dbh; > do { > lock_buffer(sbh); > lock_buffer(dbh); > @@ -218,16 +220,16 @@ static void nilfs_copy_page(struct page *dst, struc= t page *src, int copy_dirty) > dbh =3D dbh->b_this_page; > } while (dbh !=3D dbufs); > > - copy_highpage(dst, src); > + folio_copy(dst, src); > > - if (PageUptodate(src) && !PageUptodate(dst)) > - SetPageUptodate(dst); > - else if (!PageUptodate(src) && PageUptodate(dst)) > - ClearPageUptodate(dst); > - if (PageMappedToDisk(src) && !PageMappedToDisk(dst)) > - SetPageMappedToDisk(dst); > - else if (!PageMappedToDisk(src) && PageMappedToDisk(dst)) > - ClearPageMappedToDisk(dst); > + if (folio_test_uptodate(src) && !folio_test_uptodate(dst)) > + folio_mark_uptodate(dst); > + else if (!folio_test_uptodate(src) && folio_test_uptodate(dst)) > + folio_clear_uptodate(dst); > + if (folio_test_mappedtodisk(src) && !folio_test_mappedtodisk(dst)= ) > + folio_set_mappedtodisk(dst); > + else if (!folio_test_mappedtodisk(src) && folio_test_mappedtodisk= (dst)) > + folio_clear_mappedtodisk(dst); > > do { > unlock_buffer(sbh); > @@ -269,7 +271,7 @@ int nilfs_copy_dirty_pages(struct address_space *dmap= , > NILFS_PAGE_BUG(&folio->page, > "found empty page in dat page cach= e"); > > - nilfs_copy_page(&dfolio->page, &folio->page, 1); > + nilfs_copy_folio(dfolio, folio, true); > filemap_dirty_folio(folio_mapping(dfolio), dfolio); > > folio_unlock(dfolio); > @@ -314,7 +316,7 @@ void nilfs_copy_back_pages(struct address_space *dmap= , > if (!IS_ERR(dfolio)) { > /* overwrite existing folio in the destination ca= che */ > WARN_ON(folio_test_dirty(dfolio)); > - nilfs_copy_page(&dfolio->page, &folio->page, 0); > + nilfs_copy_folio(dfolio, folio, false); > folio_unlock(dfolio); > folio_put(dfolio); > /* Do we not need to remove folio from smap here?= */ > -- > 2.40.1 > Acked-by: Ryusuke Konishi Everything else looks fine if the folio_copy symbol is exported. Thanks, Ryusuke Konishi