Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp54854rwi; Wed, 2 Nov 2022 09:15:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7hMmVu0kMq8jRD01g079FXQN3KW3y+8IEhPPFHJeHLP2Xh9K3A8sSXUalxHEHGzQP6n5f4 X-Received: by 2002:a17:906:4795:b0:794:8b93:2e33 with SMTP id cw21-20020a170906479500b007948b932e33mr24838504ejc.265.1667405744907; Wed, 02 Nov 2022 09:15:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667405744; cv=none; d=google.com; s=arc-20160816; b=zQpUl72WJo2vDbtIlz8VPO5BmRozNA7KFWMNxhdCIgEcGubKVHcrVHOsHB/cxcR0ho SHHyDA7drqRkb/FlJ2jQCz6mWIOVKhrYE95y5Flip2sdPWOeMrjpa1MzQxkn5DaWvJP5 ypRm2gqfZB4QAkvR2YbXA7hQn1CIc1sxUxRvE8m3X0dxY4r9wZUXj99EHLUNTgA/jJ1l iAGznMCPIdrgnql5puVwggocdXUoqgbKi3unw6vWjWfVN3Wp+nEw0SBQYnUQRxTdXFhj Ko5hzhZ9rWXw9SOctyFoi46LCRihq83w20VAImW+yEs76N9qXV5VU3bKDBP7c7wMN8cg /vgg== 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=zdjIiLbt6NZs/+ugsh8p0DToyI6+NA6EFXmKyQS/uaI=; b=DZtYCG/Lxrqj4Y5lta0oGj2E0+sD3GS00MFNR5tBpc4woujtm0mwKAJ/FuSU9TmA/x KVn+/IAivAoT3PSLi8EfbYG5hualzDWPJX0UX0g5DuWEwH0aKuJI94VhyumM1Vr9hIwz dECdU1jc7A3Vcm71g+pDoLqD8O0521U3wFDCl0R0gKDJT8r2Pst9I5zeBMehjF0WBykD 3kcmPB+saLBM9tQBaA9evj14NTJ3q4kVMOLCrfTS1Virb21lKpgh4xUqqstwxejFXiCR QWaC4d8o/SKLR0e3keYULZUTtLY9bXqq4/Zi1E+x7k2UmLU4sLzBJjX/yDL2XLUZTb1E MReg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="dnw/Y7Sd"; 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 l21-20020a170906645500b0078d550c0272si12611183ejn.269.2022.11.02.09.15.15; Wed, 02 Nov 2022 09:15:44 -0700 (PDT) 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="dnw/Y7Sd"; 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 S231648AbiKBQNR (ORCPT + 99 others); Wed, 2 Nov 2022 12:13:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231640AbiKBQMI (ORCPT ); Wed, 2 Nov 2022 12:12:08 -0400 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1ABD62D1D5; Wed, 2 Nov 2022 09:11:39 -0700 (PDT) Received: by mail-pf1-x42d.google.com with SMTP id v28so16646057pfi.12; Wed, 02 Nov 2022 09:11:39 -0700 (PDT) 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=zdjIiLbt6NZs/+ugsh8p0DToyI6+NA6EFXmKyQS/uaI=; b=dnw/Y7Sdt/2yswLfUwe7rf3FamG1uOa+Cme4BQysz6O5GJju2KxY/lGLFeRfg3fP7F gusz6QFWiXK3Emskoxdh85TotdaoyDyH+kDkBo55CuXGPS5jgjmyY15TzCw5SJdm/Und Pe28CM7DVUvGUwOIf1oO6mSePnJQCQlGwEwLCjujRil72gYP2VXxqrNEY2Y2A8eBJRNr 6SM+6en5d7DcLIdBgiDQSKo8zoKuWtwZRdiHWF+RAAgco3tzrrCbCJhmkzEEdqzxvKka gMha+qpnNfslZTnKojM1KOTJPxVbBbMJ8BYFTrGc9EfVhhAKpe6HIgIjjlnkj/wKgw8P /0BA== 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=zdjIiLbt6NZs/+ugsh8p0DToyI6+NA6EFXmKyQS/uaI=; b=FUEId2bu/jqaxoUsuBVhZMNSUTZcJfu2uxenaXXnm2N5TnBbK6OsVI+iKq0nnLXluM dlSi5bEkCqYzlZthHviyRjQ6ezM9yiyfket7XpyvcBctidREIZHBSaIXO8+Q9w3RUNv4 /bJ3ZeR99klz6dgY3xz2DB7PebQEPEGGHYCla575MRhwXXqrcIIb6SyprLSlf0KrXvp1 NVkIJQEvT3PmrvubtSMCr6kJl5774VY6kyU1TdxL1VPvVUwhnb2deEL6OhbK66xv5L48 Rc7vBFWP7u61qCP/SgCLjHUpGvvEK6HFiR1W5PT5q5oYHddO7hyH23gSe5Ytn4TdxTLj 7uNg== X-Gm-Message-State: ACrzQf16jaLXDBlo8mSjC2CI0TgindfbhY3obR+eXl9ZyDPGlgnn+JDw aDfwWA95li6q7k50fzygQXQbd4vGj05e3Q== X-Received: by 2002:a63:4949:0:b0:442:b733:2fae with SMTP id y9-20020a634949000000b00442b7332faemr21682136pgk.424.1667405498578; Wed, 02 Nov 2022 09:11:38 -0700 (PDT) Received: from fedora.hsd1.ca.comcast.net ([2601:644:8002:1c20::8080]) by smtp.googlemail.com with ESMTPSA id ms4-20020a17090b234400b00210c84b8ae5sm1632101pjb.35.2022.11.02.09.11.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Nov 2022 09:11:38 -0700 (PDT) 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 v4 21/23] nilfs2: Convert nilfs_copy_dirty_pages() to use filemap_get_folios_tag() Date: Wed, 2 Nov 2022 09:10:29 -0700 Message-Id: <20221102161031.5820-22-vishal.moola@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221102161031.5820-1-vishal.moola@gmail.com> References: <20221102161031.5820-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 8 calls to compound_head(). Signed-off-by: Vishal Moola (Oracle) Acked-by: Ryusuke Konishi --- fs/nilfs2/page.c | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/fs/nilfs2/page.c b/fs/nilfs2/page.c index 39b7eea2642a..d921542a9593 100644 --- a/fs/nilfs2/page.c +++ b/fs/nilfs2/page.c @@ -240,42 +240,43 @@ static void nilfs_copy_page(struct page *dst, struct page *src, int copy_dirty) int nilfs_copy_dirty_pages(struct address_space *dmap, struct address_space *smap) { - struct pagevec pvec; + struct folio_batch fbatch; unsigned int i; pgoff_t index = 0; int err = 0; - pagevec_init(&pvec); + folio_batch_init(&fbatch); repeat: - if (!pagevec_lookup_tag(&pvec, smap, &index, PAGECACHE_TAG_DIRTY)) + if (!filemap_get_folios_tag(smap, &index, (pgoff_t)-1, + PAGECACHE_TAG_DIRTY, &fbatch)) return 0; - for (i = 0; i < pagevec_count(&pvec); i++) { - struct page *page = pvec.pages[i], *dpage; + for (i = 0; i < folio_batch_count(&fbatch); i++) { + struct folio *folio = fbatch.folios[i], *dfolio; - lock_page(page); - if (unlikely(!PageDirty(page))) - NILFS_PAGE_BUG(page, "inconsistent dirty state"); + folio_lock(folio); + if (unlikely(!folio_test_dirty(folio))) + NILFS_PAGE_BUG(&folio->page, "inconsistent dirty state"); - dpage = grab_cache_page(dmap, page->index); - if (unlikely(!dpage)) { + dfolio = filemap_grab_folio(dmap, folio->index); + if (unlikely(!dfolio)) { /* No empty page is added to the page cache */ err = -ENOMEM; - unlock_page(page); + folio_unlock(folio); break; } - if (unlikely(!page_has_buffers(page))) - NILFS_PAGE_BUG(page, + if (unlikely(!folio_buffers(folio))) + NILFS_PAGE_BUG(&folio->page, "found empty page in dat page cache"); - nilfs_copy_page(dpage, page, 1); - __set_page_dirty_nobuffers(dpage); + nilfs_copy_page(&dfolio->page, &folio->page, 1); + filemap_dirty_folio(folio_mapping(dfolio), dfolio); - unlock_page(dpage); - put_page(dpage); - unlock_page(page); + folio_unlock(dfolio); + folio_put(dfolio); + folio_unlock(folio); } - pagevec_release(&pvec); + folio_batch_release(&fbatch); cond_resched(); if (likely(!err)) -- 2.38.1