Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp1929048rdb; Thu, 21 Sep 2023 04:01:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGNb6s4VWdWdgz71tgZiluRzEjOZXWPPDMkmKYoYhg9gD6Q7H+tuH9hKVrP7d1c6/fk6Y/j X-Received: by 2002:a05:6602:248a:b0:79d:8708:4d24 with SMTP id g10-20020a056602248a00b0079d87084d24mr5217532ioe.15.1695294103676; Thu, 21 Sep 2023 04:01:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695294103; cv=none; d=google.com; s=arc-20160816; b=KPLVXiDXGUcPIWHGGkhg59mHEBDZLGd+FSLJiJv5AM9RbBs43CMajAtgNTXx67II7B lfBgX/CVT1clTRqDo59UmY06IA+fZHO3hqJND5pnYaYhWSvsgAAVvkXM0B49rgRG5jN7 Ye7wSxm25OYC3EsABwzQsrLCMOqXTFgP2fcryFbAmsHngyEVB5XqYZMuwrG7QqXRoV02 XRYkx6qoJI9MJ3U4yMiLy76OW3ZmcXJBhyu6VInWrJbAeo+MPmOvI2WTkrZ8nH7Xk06K 9fMRMhT9wFCLZ7gcG89gRhhrO8kbf+vFewYMAr2UxXqsAE8D3DA5ghNHGd9ka4cbxHBC g3nw== 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=eQus7xN9bGIDtrSXQ5yUpeC9VO6X9bRJrGYUnimnUlQ=; fh=sRR9gJ37ChtesxPb1iPEABChem0KgDKda8d5/HUMrrk=; b=Gt7esRuwBDgojOqMw7kukMNyOtA2BzPeGqiKZPPpbzj57adhoBrDNMsqIpapcefJxv eImfEnq3BQZcJD1w7V6tJKCtH5c5rlwSozpKNzmUhJYYJTC0Hs51AqvY0HyROl42R6ZE kbfSBiBLfKMSCCUQJ7n4oVZBFpbcvJsIkQrJgNdGvFP2PA8tV9rn72FjAlfrIRC5Ty5Z vm/fMigRKqOzWHHTR5t3tfQaYLXaP0oOiakT+F10YLOvZk5F2+GYNLY7xKHsoOf+rIQi DupWHpCqn5hyE9iQtE4FHPQdsWAqDBJoyRtkwk4HHpI2+vCDc1homwz6FIBtPcvCba2H FuoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QERE7Qs0; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id cj15-20020a056a00298f00b0068e2d888713si1170716pfb.167.2023.09.21.04.01.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 04:01:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-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=@redhat.com header.s=mimecast20190719 header.b=QERE7Qs0; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (Postfix) with ESMTP id ADF4E8083B47; Tue, 19 Sep 2023 15:35:53 -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 S233519AbjISWfl (ORCPT + 99 others); Tue, 19 Sep 2023 18:35:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233454AbjISWfl (ORCPT ); Tue, 19 Sep 2023 18:35:41 -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 B4E70C0 for ; Tue, 19 Sep 2023 15:34:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695162895; 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=eQus7xN9bGIDtrSXQ5yUpeC9VO6X9bRJrGYUnimnUlQ=; b=QERE7Qs0UVnfmtfFPWir107Hqwo0Z5Ln9+k4YvxkViI8bbDSjylQDLOkN26BOTbWBHM7lV +3JB+YzlaSBIlC564udIA9HaG4QF0D4z6391jlqxhnhx8gLL9Fb9JASe0WsLOx+K6Mz8uC 8MnhdXTVLbC15VRqFhbBNPUDWIUjyXk= Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-547-rax19IInPVy2f6u7D8y3IQ-1; Tue, 19 Sep 2023 18:34:54 -0400 X-MC-Unique: rax19IInPVy2f6u7D8y3IQ-1 Received: by mail-pl1-f199.google.com with SMTP id d9443c01a7336-1c5a0d9cf67so9889935ad.0 for ; Tue, 19 Sep 2023 15:34:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695162893; x=1695767693; 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=eQus7xN9bGIDtrSXQ5yUpeC9VO6X9bRJrGYUnimnUlQ=; b=R4fMTRwW60HI9z/QEU5fw+XX1DVv44O4en5KmrbPltmPYkobyxCvIWRJLj2jFxSLUr 8iMNpCa6zAnnFy9WnADkc8beT9TvQbF3M9kMnTmVTApmPoqr4wROdfd5ryKVswzbVPht +aTmXJPwDAViu9OKiv90mx/IzaZ6ypYLTV1ve3VyNszaHzL5K3yP7Uw4kBgTKD10LBn+ YXWTTf1WkRSeKeumGHSyw5Z7T2bY74efV72vlF96jqABuHHbAqwutE1RLl5O2X5koQlM d6qgUw0YKS9Vtc9tO4cv453GgyJNnrSbMxrwgtrD3Woy8tXfK0T+e1h23FYOhk4UmwRl CB2Q== X-Gm-Message-State: AOJu0YxksSYkIdHwE9w3wRxC2iXT2lqq6JMaUNk3GWqBxNCJnvno1/qB 58aQirZQlTIHVi/2nGLsju41c+rYGMBm3oZcBI1UDbgv/k5IpR689Ivpl/hHTAo1UnuZ/zKn9yl FDVtU6mAew7cRkdiYoGu4SZk0SnTODHo7E3SjSQ== X-Received: by 2002:a17:902:b7c1:b0:1c5:76b6:d94f with SMTP id v1-20020a170902b7c100b001c576b6d94fmr670930plz.31.1695162893573; Tue, 19 Sep 2023 15:34:53 -0700 (PDT) X-Received: by 2002:a17:902:b7c1:b0:1c5:76b6:d94f with SMTP id v1-20020a170902b7c100b001c576b6d94fmr670921plz.31.1695162893309; Tue, 19 Sep 2023 15:34:53 -0700 (PDT) MIME-Version: 1.0 References: <20230919045135.3635437-1-willy@infradead.org> <20230919045135.3635437-7-willy@infradead.org> In-Reply-To: <20230919045135.3635437-7-willy@infradead.org> From: Andreas Gruenbacher Date: Wed, 20 Sep 2023 00:34:41 +0200 Message-ID: Subject: Re: [PATCH 06/26] gfs2: Convert gfs2_getbuf() to folios 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,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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 15:35:53 -0700 (PDT) On Tue, Sep 19, 2023 at 7:00=E2=80=AFAM Matthew Wilcox (Oracle) wrote: > Remove several folio->page->folio conversions. Also use __GFP_NOFAIL > instead of calling yield() and the new get_nth_bh(). > > Signed-off-by: Matthew Wilcox (Oracle) > --- > fs/gfs2/meta_io.c | 39 +++++++++++++++++---------------------- > 1 file changed, 17 insertions(+), 22 deletions(-) > > diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c > index 924361fa510b..f1fac1b45059 100644 > --- a/fs/gfs2/meta_io.c > +++ b/fs/gfs2/meta_io.c > @@ -115,7 +115,7 @@ struct buffer_head *gfs2_getbuf(struct gfs2_glock *gl= , u64 blkno, int create) > { > struct address_space *mapping =3D gfs2_glock2aspace(gl); > struct gfs2_sbd *sdp =3D gl->gl_name.ln_sbd; > - struct page *page; > + struct folio *folio; > struct buffer_head *bh; > unsigned int shift; > unsigned long index; > @@ -129,36 +129,31 @@ struct buffer_head *gfs2_getbuf(struct gfs2_glock *= gl, u64 blkno, int create) > bufnum =3D blkno - (index << shift); /* block buf index within p= age */ > > if (create) { > - for (;;) { > - page =3D grab_cache_page(mapping, index); > - if (page) > - break; > - yield(); > - } > - if (!page_has_buffers(page)) > - create_empty_buffers(page, sdp->sd_sb.sb_bsize, 0= ); > + folio =3D __filemap_get_folio(mapping, index, > + FGP_LOCK | FGP_ACCESSED | FGP_CREAT, > + mapping_gfp_mask(mapping) | __GFP_NOFAIL)= ; > + bh =3D folio_buffers(folio); > + if (!bh) > + bh =3D folio_create_empty_buffers(folio, > + sdp->sd_sb.sb_bsize, 0); > } else { > - page =3D find_get_page_flags(mapping, index, > - FGP_LOCK|FGP_ACCESSED); > - if (!page) > + folio =3D __filemap_get_folio(mapping, index, > + FGP_LOCK | FGP_ACCESSED, 0); > + if (IS_ERR(folio)) > return NULL; > - if (!page_has_buffers(page)) { > - bh =3D NULL; > - goto out_unlock; > - } > + bh =3D folio_buffers(folio); > } > > - /* Locate header for our buffer within our page */ > - for (bh =3D page_buffers(page); bufnum--; bh =3D bh->b_this_page) > - /* Do nothing */; > - get_bh(bh); > + if (!bh) > + goto out_unlock; > > + bh =3D get_nth_bh(bh, bufnum); > if (!buffer_mapped(bh)) > map_bh(bh, sdp->sd_vfs, blkno); > > out_unlock: > - unlock_page(page); > - put_page(page); > + folio_unlock(folio); > + folio_put(folio); > > return bh; > } > -- > 2.40.1 > Reviewed-by: Andreas Gruenbacher Thanks, Andreas