Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp1069319rdb; Tue, 19 Sep 2023 20:56:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IESmi4kXEwk4NwcDhu9JPZrceGgj4jUcYkUQVYm8yg6A9pnE47KqXBGuTIwcEoZh2SMFPGn X-Received: by 2002:a05:6a00:cc8:b0:68a:6018:a66f with SMTP id b8-20020a056a000cc800b0068a6018a66fmr2024437pfv.2.1695182195862; Tue, 19 Sep 2023 20:56:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695182195; cv=none; d=google.com; s=arc-20160816; b=kKi6MT+ntT9GgoGO2ybEgskAD+zqFV99LWEDx470FAUEJjN/MkBSbD5VpxSjSkvUwP 03Mukdair2B+ACr5yWs4KyOJIUO6DE4wx+5oyifKQaLy9HHXay9K55oCI8oZhp+c1SdX sKgixGOqdofWGoZY6xfGdQL+7FIXiYzJDUlFgAqjSwNrlsS2qOzvGTyIWUX8uK4Z4Bsf fEXD/pjAWp1pYvBkA5W79Gs4lgoLPHBLIB8zTwSsKooNrRonMsjgb0XSXndGtNC/Yn9t U8QEl6f9pvZ5MyEMvVZjRDtvODKKbWl4GOLhnvSfxztmurNjkD8lgvHgvVkehHMGPlzC ycfw== 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=0x5XQwTZHDcZyZxqW3gmQpgHS2gIGGzK97rIzkAXl3Q=; fh=sRR9gJ37ChtesxPb1iPEABChem0KgDKda8d5/HUMrrk=; b=goSb4pJMpwxF+TvvOEKJBNYMCAMvjySS3EsIuogkYObVKWnKwq9MhTQwFE5gYHL5su I+5ij2lQMtEJWtBdsUKQjSFS4UTPiANdFFjWrALtNHTQW9m8LBh9x5coNegDsfirn5I6 wC8xYPfR/So5Z0dkSjSEqgAFxgweVMe2ZYgA4EvAnylPL6mHGUxvNO9X0jgR9LHHakeD vHFFhTr4L/G9p5we4D+HaVmg0teyjejYqnZlbAQ7kEX6ZQhv2MbXYj5mYssKE4wm2f7B jmU2+7Kdbp3pqfK48dRXNkp+ZZO8MNSZMAGnAQ5f7rrzBGS5zpffwpPsxzqP9DHAP8bF b0MQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=feAAS7O1; 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=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id bd39-20020a056a0027a700b006906e1e6d44si5805670pfb.105.2023.09.19.20.56.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 20:56:35 -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=@redhat.com header.s=mimecast20190719 header.b=feAAS7O1; 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=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 965D6803E8D2; Tue, 19 Sep 2023 15:33:19 -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 S233482AbjISWdU (ORCPT + 99 others); Tue, 19 Sep 2023 18:33:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229887AbjISWdU (ORCPT ); Tue, 19 Sep 2023 18:33:20 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED8BBBA for ; Tue, 19 Sep 2023 15:32:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695162747; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0x5XQwTZHDcZyZxqW3gmQpgHS2gIGGzK97rIzkAXl3Q=; b=feAAS7O1g6lGUrDRMBJUFVi4qbugbyNyRFrzIlOg9OIfjWicBCWg6eAL9KgD4DOskL1Ajf 6+PsCQTwpQyd6WAKR8eyPvPMUhrVou6KNz5rj8bAtR3ohO9n1uRJebzUuSu6arXCCQMeg3 4r9aPEw1co6HvKjIyhx96JOeUe488/k= Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-531-g0TjJdNtMwiqyztdK-B41Q-1; Tue, 19 Sep 2023 18:32:25 -0400 X-MC-Unique: g0TjJdNtMwiqyztdK-B41Q-1 Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-1c467c33c06so2083955ad.0 for ; Tue, 19 Sep 2023 15:32:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695162744; x=1695767544; 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=0x5XQwTZHDcZyZxqW3gmQpgHS2gIGGzK97rIzkAXl3Q=; b=ZbDsl6N/WBd2TIq3ijwtPGCZW+MGw/3azc2gvXLs3R5hAfbr6lMh81VXJyMo7vZpzz oo1uVSonNMD1y4qQd0ivBImyGSuBJxDrpIRgZLPFWY3lnHcS8t45adf92FNV8hoIwZqx UZyHfnHjkJjL1GLvjRPApgneXwTS0YNWy5+yn2FxRkQlGAT714652W6piW2Y2GgUjuSk VTjHUFpgQ58zbuuiA5TCLv4/0T7tI1HdbAspbebW6HHV07U1j2gw4J7YQxjkdsYiI/aF CGZqxZB4ZUDJlW1bOvoNA/tp/GimPTk2xVnypLcml6/SqSDzVB9HkFuJQTrojESmucCo BCfQ== X-Gm-Message-State: AOJu0Yx6Z1Q+xAhPVG+msP5OLUXg1alzvGO6ZIwq1ClaLgXmHUTqrsfJ PDHXGzVjtGd1NbqNTSxfeN767SV/ebSSEaDNqmip37e1Wih9SWGNBHMIAbfkyEQH/nEdpd4U/rS RZUqwkvpEbng56TjPwXNl0E1OgmpcSbalU9yuyg== X-Received: by 2002:a17:902:d506:b0:1c1:d5d1:a364 with SMTP id b6-20020a170902d50600b001c1d5d1a364mr1049145plg.33.1695162744531; Tue, 19 Sep 2023 15:32:24 -0700 (PDT) X-Received: by 2002:a17:902:d506:b0:1c1:d5d1:a364 with SMTP id b6-20020a170902d50600b001c1d5d1a364mr1049128plg.33.1695162744239; Tue, 19 Sep 2023 15:32:24 -0700 (PDT) MIME-Version: 1.0 References: <20230919045135.3635437-1-willy@infradead.org> <20230919045135.3635437-9-willy@infradead.org> In-Reply-To: <20230919045135.3635437-9-willy@infradead.org> From: Andreas Gruenbacher Date: Wed, 20 Sep 2023 00:32:12 +0200 Message-ID: Subject: Re: [PATCH 08/26] gfs2: Convert gfs2_write_buf_to_page() to use a 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.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 15:33:19 -0700 (PDT) On Tue, Sep 19, 2023 at 7:00=E2=80=AFAM Matthew Wilcox (Oracle) wrote: > Remove several folio->page->folio conversions. > > Signed-off-by: Matthew Wilcox (Oracle) > --- > fs/gfs2/quota.c | 37 +++++++++++++++++++------------------ > 1 file changed, 19 insertions(+), 18 deletions(-) > > diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c > index 171b2713d2e5..0ee4865ebdca 100644 > --- a/fs/gfs2/quota.c > +++ b/fs/gfs2/quota.c > @@ -736,7 +736,7 @@ static int gfs2_write_buf_to_page(struct gfs2_sbd *sd= p, unsigned long index, > struct gfs2_inode *ip =3D GFS2_I(sdp->sd_quota_inode); > struct inode *inode =3D &ip->i_inode; > struct address_space *mapping =3D inode->i_mapping; > - struct page *page; > + struct folio *folio; > struct buffer_head *bh; > u64 blk; > unsigned bsize =3D sdp->sd_sb.sb_bsize, bnum =3D 0, boff =3D 0; > @@ -745,15 +745,15 @@ static int gfs2_write_buf_to_page(struct gfs2_sbd *= sdp, unsigned long index, > blk =3D index << (PAGE_SHIFT - sdp->sd_sb.sb_bsize_shift); > boff =3D off % bsize; > > - page =3D grab_cache_page(mapping, index); > - if (!page) > - return -ENOMEM; > - if (!page_has_buffers(page)) > - create_empty_buffers(page, bsize, 0); > + folio =3D filemap_grab_folio(mapping, index); > + if (IS_ERR(folio)) > + return PTR_ERR(folio); > + bh =3D folio_buffers(folio); > + if (!bh) > + bh =3D folio_create_empty_buffers(folio, bsize, 0); > > - bh =3D page_buffers(page); > - for(;;) { > - /* Find the beginning block within the page */ > + for (;;) { > + /* Find the beginning block within the folio */ > if (pg_off >=3D ((bnum * bsize) + bsize)) { > bh =3D bh->b_this_page; > bnum++; > @@ -766,9 +766,10 @@ static int gfs2_write_buf_to_page(struct gfs2_sbd *s= dp, unsigned long index, > goto unlock_out; > /* If it's a newly allocated disk block, zero it = */ > if (buffer_new(bh)) > - zero_user(page, bnum * bsize, bh->b_size)= ; > + folio_zero_range(folio, bnum * bsize, > + bh->b_size); > } > - if (PageUptodate(page)) > + if (folio_test_uptodate(folio)) > set_buffer_uptodate(bh); > if (bh_read(bh, REQ_META | REQ_PRIO) < 0) > goto unlock_out; > @@ -784,17 +785,17 @@ static int gfs2_write_buf_to_page(struct gfs2_sbd *= sdp, unsigned long index, > break; > } > > - /* Write to the page, now that we have setup the buffer(s) */ > - memcpy_to_page(page, off, buf, bytes); > - flush_dcache_page(page); > - unlock_page(page); > - put_page(page); > + /* Write to the folio, now that we have setup the buffer(s) */ > + memcpy_to_folio(folio, off, buf, bytes); > + flush_dcache_folio(folio); > + folio_unlock(folio); > + folio_put(folio); > > return 0; > > unlock_out: > - unlock_page(page); > - put_page(page); > + folio_unlock(folio); > + folio_put(folio); > return -EIO; > } > > -- > 2.40.1 > Reviewed-by: Andreas Gruenbacher Thanks, Andreas