Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp829925rdb; Tue, 19 Sep 2023 11:19:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEoHRn47F16O377wJjf0j5qlT/ffpgeSyUqGZT7FR5+zxYnKn08mo5kz0CmxCvvVl1fnFoJ X-Received: by 2002:a05:6a20:9383:b0:149:97e4:8ae4 with SMTP id x3-20020a056a20938300b0014997e48ae4mr623731pzh.0.1695147548213; Tue, 19 Sep 2023 11:19:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695147548; cv=none; d=google.com; s=arc-20160816; b=Lkxf8JsH1rqCMwszj0cAjufulA0TQNQeu2jkMXj2tGcELEL1iB6b2JZ5zaZzQYLVAh RkxpukyaGEGSFIUGv9bKvv9dblTwIcve8BwoOPsayE1loi0sezQzgdHqfhw5ZVT9A9Mu /O2ioM0YWPpJBvwoY1p/ovY4Ro0EpExV5IReilDcMQO7lddN2rz4bFaTGAQUqV9yS6Rd IITVu1Z53e00gpD9mibOggmopOsOAWaMOIaw+EQ9de0V9o5k3K7qFCxSU7FZbksOU3zT uOz4NeIC9yZrv3epvlw1zEt+3b1mKPcV1mA4Ym7XA8PRfZ510liDQaoHGiOrg7WL+GlT m6Tg== 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=2w/wQ8V2E6A/A9h71MT3wsUIExlrWO06vblA9KgaYVM=; fh=sRR9gJ37ChtesxPb1iPEABChem0KgDKda8d5/HUMrrk=; b=YmZS1y+vsj1XcnGNY6MYmG4A5DjGTbiNVcNICGBASqooYi/R0md/VoccnTK1xt+PUH FfUxums/N8wN5exkfzsemu5zx4ID9q0rYOejDm5oZ7i5lc71s2hwq3rKra8r7IH5Qsdz qHqH/NX7dQnUrDMWcKEcMs3ItD9cJ3tXD532rEIN2QTChfN2DnMd2xy2lwBsy4fjk1K/ RijLAMBQwdRLzWtGMZgJECRBHEgIK66Y7FaRIuU/9Z4sp+H/QJl0Zzo3WDsxTVmCxW/C yM4aghRnhJHodG9FhQMaCpJPzELRDCNWlGQsTIXNOc+xWFO/Thu6awSFa81AITkBPyr9 v1LQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=JASdwCEn; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id k20-20020aa788d4000000b006880a2ca0fasi10304425pff.312.2023.09.19.11.19.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 11:19:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=JASdwCEn; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id D0C7E80F5F0C; Tue, 19 Sep 2023 06:01:51 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232099AbjISNBv (ORCPT + 99 others); Tue, 19 Sep 2023 09:01:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232207AbjISNBu (ORCPT ); Tue, 19 Sep 2023 09:01:50 -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 6032FF3; Tue, 19 Sep 2023 06:01:45 -0700 (PDT) Received: by mail-vk1-xa2e.google.com with SMTP id 71dfb90a1353d-493a661d7b6so4314512e0c.1; Tue, 19 Sep 2023 06:01:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695128504; x=1695733304; 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=2w/wQ8V2E6A/A9h71MT3wsUIExlrWO06vblA9KgaYVM=; b=JASdwCEnfgAb+ft+LfrupnfREkabkKh+Q1dnk9x5iaDpzTEIn8g+Rj7oPgJzQ8eVPI xg2l6e4Dnao6cNTgfXTivP2PHl0y+4qrBJv9qR5mbmjQtcJDrwc96/mMH6f1p0AkxsIE 4JFcBiviHvGRtepNJ9KhkaYdVyKkMOSJrXz1UwwW8iyt7j9onZnZvHZ5iWdsxyXbyoVj /uh6X5OdInRxukWgUCQpBur9qkyAt5HiCjPWKCMj+3O5jtpkPo3ifd8D/1TbTgxHxBGG KXck9S9Pad0T3ogphS3h3xF4elhUJvTuJbqeHhddq4oQ9xWhklKXWV4Be+6uR1UqGkDw bPxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695128504; x=1695733304; 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=2w/wQ8V2E6A/A9h71MT3wsUIExlrWO06vblA9KgaYVM=; b=MtRlPiicBBBmoQDbCs43hreygZhYpXFPx4eCvFUZ3VljODGSd+tnRu70ntEOaV0nwG 3CBkocKZPLBHwLacMSD3j2pQckjz0Dsbxyi9BMk/vbDJbhez3Tbjo9lZtn4I6HwlZlpK ZE9fpNS8RIaS+GA+mfY4Ddri7kjnOznY5SgH2IxYzT+1DU1aC3tbfr0bgmP1RdOKCrKr qrAe2v/j04XmStVyoaFwNd7nPQm6qQ+Tks9dtxJ7T71RQLclIgkq9RNzvDYJhbQV7WD3 usyRRDxBZvbaGPpHGD2Pj4wPZjyMbe/kGyxIGIM1xuNR7GPdjtUldYb+zzv+qcRFz8Go Lrwg== X-Gm-Message-State: AOJu0YwKjqlqe8fOkMq4e0CAVpFmOXAeQKRVO5ZI2nPAPRh7E0cX/ZgV 9BVLcVyzuSHADv0pPYZj99KoxS1oV+K6EFdBiwk= X-Received: by 2002:a05:6122:3657:b0:496:2d54:e6f0 with SMTP id dv23-20020a056122365700b004962d54e6f0mr921811vkb.6.1695128503713; Tue, 19 Sep 2023 06:01:43 -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: Tue, 19 Sep 2023 22:01:27 +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=-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 autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email 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 (lipwig.vger.email [0.0.0.0]); Tue, 19 Sep 2023 06:01:51 -0700 (PDT) Hi, 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 When I tried to test the patchset against 6.6-rc2, I encountered the following error during the build: ERROR: modpost: "folio_copy" [fs/nilfs2/nilfs2.ko] undefined! It looks like "folio_copy" is not exported to modules. I'll correct this manually for now and proceed with the review and testing, but could you please fix this build issue in some way ? Thanks, Ryusuke Konishi