Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp13798476rwl; Wed, 4 Jan 2023 13:17:01 -0800 (PST) X-Google-Smtp-Source: AMrXdXufIq1NW1OFVLmiyIa1S++hv8Cz01lTWgjntHhbhu9XM36v+GsC0AYbm2wDEXgcUPRKFX8S X-Received: by 2002:a17:903:3255:b0:191:f83:636b with SMTP id ji21-20020a170903325500b001910f83636bmr53738591plb.25.1672867021153; Wed, 04 Jan 2023 13:17:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672867021; cv=none; d=google.com; s=arc-20160816; b=d05V09y934iqc23ap50CKPHfdpp3Ic+IaeaMTYCNjI/+3luaxw4S9wvQTe45LjNl1g /2zOltl3jchgN7umtl6i6PxJHQ43INlVBuBoBsq4HTqHKoqZ2/Qz4OHeaeJMVkNUoTS8 H3I/NUOayziCgPrW78/ZkgiR/M5+dUbfZbuuK63YtdJO3cH+QtFJsueKrgc2pFldGzlH 9/gUmkKNfHXIaOGCJgYAq/XILRa8CPisLjPIsaKcSGw3JEHrbrY2CtTxIs5soFXqBNdf nxbgfNUYLwEQeUk0ratRXbEE24ErwAtodQ1c4knzJWoOQGRS5Z48u0VTcUw3r/+UAinb Q4Mw== 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=1A8uEBKFHCoGcGMJ8iE8ujYAy/L1/TcTKI0S1xJuhhKGmbAQWZu+th5i5WdpAmkXq4 iEPAbeVf8nR+r0sJMMCiPeDlfQ7GnjXbVlMbmpt1yQO3zCSp2Fjen00YH3IUgmVj494J wHnE7nmBZN7aIz6p3KH1e9ZkFCdOW/2/J3A8I3iTPnfnebpwgyRypdN9aC1pU85BqLkH /Hh2zpFx38PkJRFabihphQzy73SWmUGIFuG9jfpXp1JXjBe0c3chMmG2Bm2rjdP5aYcE T2hZTvcnZWWuLPMq9yBRUPLjeSqWrGdFqoC3but3Ro5UgkuvjV+ZRK7l0hLiD21pbPAQ zr/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=glpIa7fa; 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 s13-20020a63924d000000b004a2e257462bsi9228869pgn.211.2023.01.04.13.16.44; Wed, 04 Jan 2023 13:17:01 -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=glpIa7fa; 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 S240658AbjADVQK (ORCPT + 99 others); Wed, 4 Jan 2023 16:16:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240359AbjADVP1 (ORCPT ); Wed, 4 Jan 2023 16:15:27 -0500 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BE451CB3D; Wed, 4 Jan 2023 13:15:27 -0800 (PST) Received: by mail-pl1-x636.google.com with SMTP id b2so37200719pld.7; Wed, 04 Jan 2023 13:15:27 -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=zdjIiLbt6NZs/+ugsh8p0DToyI6+NA6EFXmKyQS/uaI=; b=glpIa7fah0tr/iN8VTblVZOLKx6udw1Y6CMH9y932LtgL0yAdBTRzwDIj0zvhgD39Q E1sL9pDcu27gNo9eBb2VjNhIMTDlKXVfRv6jhGeAPXWY0rUHIfhMoFfE3XhufWQTIbMH E2KvefozTkDS3/Hp893OF3S49VHllnT3CB69+mEDG9UtLBa4m/skO7yUjlUTWoasN5ZG NU+lE/pxu55tM0OK9vSbnCVSEU358m3zsG6W/CVnAseJloUEUnw/6cEJcYNAvsfouAqL w9cFz18Y11YtSUOFogC9JICjRGGamrfqBabqoubTBObtLZcvFhc86wyCAt/PfmLLGeYC HJsA== 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=jG7x06hPKWm72mzhB+AtwH7U2AuBVHVrmo0rlgq4gA5+HPwCnemdworYaR3BCa/slu 0AX0TftbGjT8wppDlTTroFZw20gvR0sFayJXAsfPjEt0t/4Xl6VBo42Z3u9C5k1tT764 Zsd5Gng3RSVppUrqZZMDrvWYmR+0uU7ikFkJaicTpf330kUIouLz/ahBD7e+lyvpqfLm h6kDaZv4MQwBMKekNLHGaTkN8xBYJW6Mv2dFFuBy0ovaA1jY6giKUYBbk/tdarboJiWU CBE6nGTFxkfw4tTkfoyzNEK//hdmmMrw9RJy3+OV+3xiLIUqDnaonanjPU/BBkL2593z Omzg== X-Gm-Message-State: AFqh2kr064JokLRyV4pNQ0CB2AVouyJYq/NafkPDLm1H5txs5DahYCMb cT5Y100JlTV/TJ5t3KKCvETQy4JA8Z8qlQ== X-Received: by 2002:a17:90a:4ca7:b0:226:317f:f832 with SMTP id k36-20020a17090a4ca700b00226317ff832mr21893775pjh.39.1672866926361; Wed, 04 Jan 2023 13:15:26 -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.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 13:15:26 -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 21/23] nilfs2: Convert nilfs_copy_dirty_pages() to use filemap_get_folios_tag() Date: Wed, 4 Jan 2023 13:14:46 -0800 Message-Id: <20230104211448.4804-22-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 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