From patchwork Wed Jan 4 21:14:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13088969 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8AA0CC54E76 for ; Wed, 4 Jan 2023 21:15:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7BFCE8E0017; Wed, 4 Jan 2023 16:15:29 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 749568E0001; Wed, 4 Jan 2023 16:15:29 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5EA588E0017; Wed, 4 Jan 2023 16:15:29 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 484D78E0001 for ; Wed, 4 Jan 2023 16:15:29 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 1DD4DAB272 for ; Wed, 4 Jan 2023 21:15:29 +0000 (UTC) X-FDA: 80318372778.23.B1C95DD Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) by imf10.hostedemail.com (Postfix) with ESMTP id 5F999C000E for ; Wed, 4 Jan 2023 21:15:27 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=glpIa7fa; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf10.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.41 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1672866927; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=zdjIiLbt6NZs/+ugsh8p0DToyI6+NA6EFXmKyQS/uaI=; b=C/dCgZsKw9wDmlYQ66kRavaSEjmmwl1BALWigJIUVuPpcAhAklFgDF7vX/eEZSFdwHttwb pNcKW4Po5wMNYV1aEq7wxOE0gBbKWxobavki5YhiQ81UCLaq0XgKTChepwIqPDJDIRKXQa wNaj278hWVx6NbHb5EMPICUBmeSYvzQ= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=glpIa7fa; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf10.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.41 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1672866927; a=rsa-sha256; cv=none; b=C2RvdGpI3pX0wd2/sxllS6VdT47w1sz4QoFhCqfJcDK1jToDdUcwQVarYwPDmLxT4Uk8Dj edHtazBnjaTO7fvzP40/jjRnbER0EG3g7oaPJpgCydEL7s/CgKBKI4vgImA9ovdUVV/y7y d5Ke0dTrp2uCpvUpGt2kkBDrQ8AsfIc= Received: by mail-pj1-f41.google.com with SMTP id h7-20020a17090aa88700b00225f3e4c992so27603266pjq.1 for ; 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=uFlno5ba+RwfbBIdz7091ADsfaAEIwoEY/+jbFPnptXeOZ0VnOlsqb5IJA0jKL9Kwk Lq7dGsYje7EoeEoNtADneJGDIcDFYu6n8mUZMmoaXRFApdhCNkltgnlsYh6AWqTujvF6 VC56VYjVyxUa93p/gXKCnBX2F8v/uXcn9XDUBdhcg3dW41btrv1madTckAcN5EhHCp+9 hy+sLPQQ9+9zoPA7fyCMueDG3hpL/dP6HW66EUE3eP/u1HSVJ79wO66e/bUd3lPpPDDF YG7BR0BdWV/nKLW8qAV3i/qrsEEeLyraRRNBFeRJHOE1AgW+9mCqaNnedF4Z1H0Sx8Gt 06bg== X-Gm-Message-State: AFqh2kqQf/mEpkKf9v1FoEPM8/guxDIcdZOxE4S+RBk33Q6zQJUs1IRf ltiKRsAd3ug8KtwqREgh/ZA= X-Google-Smtp-Source: AMrXdXueuis6NhJlGTgG2VFmI91e7ab5OxbM/PwA6uv8A4+49g3wkiIGZ6yZWeV3aNkAfE4Gmx5MoQ== 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 X-Rspamd-Queue-Id: 5F999C000E X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: 4naue14xk3ttjfbfpb87owyf33p6cn31 X-HE-Tag: 1672866927-741450 X-HE-Meta: U2FsdGVkX18IphUL+vBJuaDQ4yLdgGiez4NED3YohimcNJEfM1TEtBpAhpffmObU/sc6pj1WBs0uFs8Nkd+YrzUGMDLYMRlcA3zxHlVFUVWxzziSiebrL8dA21voD6Y3f0jmrh8187FAP0Vvwe7S40GRY4cIGrE7/GzZizFJuF1hcZlP3nwiE793BjQ69X5gzFF740FPNSYGgyY0pzJPuj2Js0taZx+CJdr1btfeoZL9wkvj1OiowZFtYvE7JCs3i2JA8DJCXgmLv+vj0/F+jlgAyRSxt/qKG+Khyw4uQo05qMtc+BE2DZWS0escNxr1semTBJ1tBhFc/AaAmvtLAKc3xOio7w798HmSxxTFWiQlOu5F/nZnoiR1RYD823kCAuIISQ17xETAyi/I7WLutMTgYrGysd4kkWpJaUEwhZi4j3a29MkOA1N1llprBX4YmmItu1I42Umwg7WUhi+2+RFrEYQo08H/IQsYkPH+PEJGLOfktUEZd0hUdVV3fnQq3Y16FsHasWZ8+FPN6dhOBXdMc8H8B/l3RDW0hO7oqHGAWRu3Iwv8G5IuLgXrzMyW0rQPf7ley/mDjkmkNmf+Az9Dj1IXU1tk0w9Lfwy2VVZ/4pEONC3MyDNxk8rFUSY60XeqjfT12VqOSRY636vByJNZNwPVOisR8/LW4bTgyBRmp4GnTonf9MBs7BMzLvsTmW8HTgBGSUN5/n5GVa1Td9Ej/WPVec8OsbHZUh9MbwqCqhzk59TZuxNG6w+BxCudKVLLUngLbcenDcpEdkJH/JdT9rRQz1RKjpHX9RZ3MDjOnbD6yzLgHi/TlNUkp1UnlztEDYC8CtfXRuvUyAx5H6WMdDYbDfGDw1KFKUvYHmB//kXig2gtWpNtsvWnk8Hd/RRwls/UNImt6+XdVKUOAQF3enP/vJ7v3H1SJeR6cdP/JiQYi+dy9aaWUhRjVUdEMzl2KfTk0aPL/XQOBXb nfRBQpXD PgVZhYIP1uZUjAAmYjlzxhb01hGZhuq444Xw1s9hsCctRuPtnscTXzIbvKtH5isZeuZSJlW0Hb6BWmD8S7NbF2x/hKgUiVH6b3J++YGBjzGt8qVo6Dgth0X/GK8POi2DswXtISaaZGDwMxlvn01eB2Zgz3fn8Q3rZj9lyxkqiJYfN0yhjMJzNFtHSIR2muizhLCcQggLoGz6O0Dj+EouTWy1IQ38b9jTRMyDzG8i/QA1ZQ8L2wPE5IUcFo+qEpq+rl39MSJU8hU0iN79cfC10zFgGqA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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))