Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp13799894rwl; Wed, 4 Jan 2023 13:18:14 -0800 (PST) X-Google-Smtp-Source: AMrXdXs0IC+OVGMunsBlHmdwbugu90cwk+MOyKfHvl2+3ohu+std+/OsLICxqE9KvfvG/e/zo2CG X-Received: by 2002:a05:6a20:42a6:b0:ad:ade2:4b57 with SMTP id o38-20020a056a2042a600b000adade24b57mr74328298pzj.42.1672867094485; Wed, 04 Jan 2023 13:18:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672867094; cv=none; d=google.com; s=arc-20160816; b=nE3rVU2WGW6n6EwvDOlwiTHS8PRLKXG9THpgexZ4+ivQi3v9ABHqyaoN9L+it+7olt zKw0aZk2rQr65G/U+y6ucT7k6Pka6Pg4F7bCemHkCif6zRlF7zjoftkHlfyDQ8zHYXB8 7TE/7SwLVgpMwFpyevXY7SyzntLtL56GYZK8RVWqYVi+DwELdL/AHdVlcKncQsZwZJEg J4fiXmQxu5WDYINcnN3ZxO4F18xM6lFx4vOLOMff2kNG1X+PKoLJl4VVU3EN+Pfc76zV dZJeRsft3B+OIkGSvR5+yrF/V3dmqeDDuhvavoxLEHX3xgSD+48u1wK1Vtxgb6/vnijN ZekQ== 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=L90Su4X0B6ZDbXSVecEDf/ou5Q5FXQ0WnoUVcaVOv6Y=; b=t94HomUMSf6dans7Oii0eoA6Nx5SHpx+1a0Cg5+G0B/+iyN0MlEkH42UouU+DRi9RI cqHvFzO0aMDN1/88bNwrv+WfTG2L/IQUd0UpmpoDRqYIlTIrW9hV8pmWKUDyng8Y7qC8 1YEpsDWM/zMXECWpZpwCbqcaAtZaLnjbuUVjrh/wS/nazqtj2noI3nZchX0x+dlD7yCD WhZKfyasWy7VjspdWSsSDIgnPLCzDjxp5O8TnnKsbjPxNZeb9GEo0MCbOnsvFRAQa4Ce dEEeuU5XLnFbrJ2/9VL3qHVYj0Vd1vZZqvWckBOSSHLS1tBPhi+Mi0GlTVV1MnI3QKuW RfRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=IJQ2lGSL; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 189-20020a6301c6000000b0048219b9d027si36524435pgb.269.2023.01.04.13.17.55; Wed, 04 Jan 2023 13:18:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=IJQ2lGSL; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240613AbjADVQG (ORCPT + 99 others); Wed, 4 Jan 2023 16:16:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240354AbjADVPX (ORCPT ); Wed, 4 Jan 2023 16:15:23 -0500 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B190D1CFEA; Wed, 4 Jan 2023 13:15:22 -0800 (PST) Received: by mail-pl1-x62b.google.com with SMTP id d9so20453667pll.9; Wed, 04 Jan 2023 13:15:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=L90Su4X0B6ZDbXSVecEDf/ou5Q5FXQ0WnoUVcaVOv6Y=; b=IJQ2lGSLIhJxuzMRKK4freJEwBJhCzBUrph/WLRQ43Sy4Xeacbh1o7/sSt5j3pOh8Z LL8WHQC/7wF5bp73Ob+g8tBBd0notcEteRMybn5RyZfu96sHRm/Pwe8Ls04wVXfjMg20 8FMDvGDJgsLK1C7YpCx3k79sPNIbPSWeB8cC6hxkdsp0thSpN2GQNQUGqoi3GcaDthu/ w+Bbr2ES9OtWsORlXKrzLdZc6TBzxjM1qEpazgTeIQ7mhN7PD2UYDA1xUnKMGnkHAoYQ iN/0O7yxoY8ZPHeBYXpu6QcmywT4JFhGiJUbmS68g6J79g5xBmH4zGz9QdwEO8z0grET Xf/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=L90Su4X0B6ZDbXSVecEDf/ou5Q5FXQ0WnoUVcaVOv6Y=; b=XMkcn6oRgsS2tJhRd2k+/ijcAb6kt7IXksh6gu7ytEqHD9jA7NlxDCEjhSdZz2BPzm RTqwEFn7pJXCPGIX66IeKaX01E769Jnj8d3BGhdnT7aC1fOfRiuC5mHAKMVWtXgLGRRt SZl5/ygPXTjR6H4r/dmpF49YXctDleD5DeZVvSLWd8LxhyJ2FpgiE6kBAN3wbW8qXItz 7w4NjWjA/YnagYvmx3FOhEYTS3omYkNr850fFIWrqtsZ8ZRoa+6XRy0wVS1mPK4iOwRV r2t17g20Eoo9bACLgXkQsiFHYOMlMJ2vu4LxD/06N9dP8zCA+DSKTBsanZ67c6FCPld4 UliA== X-Gm-Message-State: AFqh2kr9cP90i8vY2g9dSqObcwDO7abcgFIQLGHEPuDcGKUsGN35VAMf 2EK2YWuPQF/Spx9cMMsLSKVr8Nn33A3zSA== X-Received: by 2002:a17:90a:8c18:b0:221:5897:d46d with SMTP id a24-20020a17090a8c1800b002215897d46dmr51320455pjo.1.1672866921917; Wed, 04 Jan 2023 13:15:21 -0800 (PST) Received: from fedora.hsd1.ca.comcast.net ([2601:644:8002:1c20::a55d]) by smtp.googlemail.com with ESMTPSA id i8-20020a17090a138800b00226369149cesm6408pja.21.2023.01.04.13.15.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 13:15:21 -0800 (PST) From: "Vishal Moola (Oracle)" To: linux-fsdevel@vger.kernel.org Cc: linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org, linux-btrfs@vger.kernel.org, ceph-devel@vger.kernel.org, linux-cifs@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, cluster-devel@redhat.com, linux-nilfs@vger.kernel.org, linux-mm@kvack.org, "Vishal Moola (Oracle)" , Ryusuke Konishi Subject: [PATCH v5 18/23] nilfs2: Convert nilfs_lookup_dirty_data_buffers() to use filemap_get_folios_tag() Date: Wed, 4 Jan 2023 13:14:43 -0800 Message-Id: <20230104211448.4804-19-vishal.moola@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230104211448.4804-1-vishal.moola@gmail.com> References: <20230104211448.4804-1-vishal.moola@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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_NONE,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 Convert function to use folios throughout. This is in preparation for the removal of find_get_pages_range_tag(). This change removes 4 calls to compound_head(). Signed-off-by: Vishal Moola (Oracle) Acked-by: Ryusuke Konishi --- fs/nilfs2/segment.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c index 76c3bd88b858..8866af742a49 100644 --- a/fs/nilfs2/segment.c +++ b/fs/nilfs2/segment.c @@ -680,7 +680,7 @@ static size_t nilfs_lookup_dirty_data_buffers(struct inode *inode, loff_t start, loff_t end) { struct address_space *mapping = inode->i_mapping; - struct pagevec pvec; + struct folio_batch fbatch; pgoff_t index = 0, last = ULONG_MAX; size_t ndirties = 0; int i; @@ -694,23 +694,26 @@ static size_t nilfs_lookup_dirty_data_buffers(struct inode *inode, index = start >> PAGE_SHIFT; last = end >> PAGE_SHIFT; } - pagevec_init(&pvec); + folio_batch_init(&fbatch); repeat: if (unlikely(index > last) || - !pagevec_lookup_range_tag(&pvec, mapping, &index, last, - PAGECACHE_TAG_DIRTY)) + !filemap_get_folios_tag(mapping, &index, last, + PAGECACHE_TAG_DIRTY, &fbatch)) return ndirties; - for (i = 0; i < pagevec_count(&pvec); i++) { + for (i = 0; i < folio_batch_count(&fbatch); i++) { struct buffer_head *bh, *head; - struct page *page = pvec.pages[i]; + struct folio *folio = fbatch.folios[i]; - lock_page(page); - if (!page_has_buffers(page)) - create_empty_buffers(page, i_blocksize(inode), 0); - unlock_page(page); + folio_lock(folio); + head = folio_buffers(folio); + if (!head) { + create_empty_buffers(&folio->page, i_blocksize(inode), 0); + head = folio_buffers(folio); + } + folio_unlock(folio); - bh = head = page_buffers(page); + bh = head; do { if (!buffer_dirty(bh) || buffer_async_write(bh)) continue; @@ -718,13 +721,13 @@ static size_t nilfs_lookup_dirty_data_buffers(struct inode *inode, list_add_tail(&bh->b_assoc_buffers, listp); ndirties++; if (unlikely(ndirties >= nlimit)) { - pagevec_release(&pvec); + folio_batch_release(&fbatch); cond_resched(); return ndirties; } } while (bh = bh->b_this_page, bh != head); } - pagevec_release(&pvec); + folio_batch_release(&fbatch); cond_resched(); goto repeat; } -- 2.38.1