From patchwork Mon Oct 17 20:24:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13009465 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 3FCA6C4321E for ; Mon, 17 Oct 2022 20:25:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DEBA86B0099; Mon, 17 Oct 2022 16:25:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CD5116B009A; Mon, 17 Oct 2022 16:25:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B00036B009B; Mon, 17 Oct 2022 16:25:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 907C86B0099 for ; Mon, 17 Oct 2022 16:25:13 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 539121A0EC6 for ; Mon, 17 Oct 2022 20:25:13 +0000 (UTC) X-FDA: 80031570906.18.AF60D3F Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) by imf06.hostedemail.com (Postfix) with ESMTP id 93877180034 for ; Mon, 17 Oct 2022 20:25:12 +0000 (UTC) Received: by mail-pj1-f52.google.com with SMTP id a5-20020a17090aa50500b002008eeb040eso142230pjq.1 for ; Mon, 17 Oct 2022 13:25:12 -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=HDAaQjWw9mFQrxjxUUwcIUCSC2HAIvgNCPk+fwsNTgA=; b=KyZrIS2cRBI9Wi/s6j+k5Un+7xp/wwbjLfcNmkVss+gpEVM+6g9eB8E+kDr4ib/o9h aHZiqvGPcTO1RO0jkEq+CHtdYaQKQfVuoWerdbvVDifz5h14hCHY1ghQf1SL3/CEdh11 opq+bBxZbhYQFO+7l9ipSWqSYpcVET1qxgS/dFbZ3YpA8WAY5aRBjLdlXQ+GF1IEYumz mhbeFFWVxeBoA+sLdrLdfFPXm81t+2pA2/aP8VFL3BoQvWah+LWY3LmumYhfXUeul7r/ qn4+/zr/qr23Eqfc68ILRUEWUJNu0aVAW3XQ2taH9/TvZGJMRKjkxGOL4AtxxdlkSFnb Lm5w== 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=HDAaQjWw9mFQrxjxUUwcIUCSC2HAIvgNCPk+fwsNTgA=; b=Fk34rgHdYMIIEs9ee6kMUy5p3BiLkuu1Kpj6JMnkVl09ENTiOa0dmmJ8B97Ppkc96t 3paK6QUv63DMCPztSaxC9i8iMSnkouZI+qhfSEu/1vUsz7XRsEm0dYfNNfrJoLtrClAw OLId6mIu6+VklHNSWHTd2gGyNibtlmjOBdjEK98tjWsuV0276HhRJfpfmPoTL34FHN/O PenaxknFwO5/YyzQ5C8cMtIrqYD3BsXFZaHyxigtdiIUMohrZRUn+032ZZsNbl2LBhek wJCn8EXfbV3jdewox648hRKNdWokGt4D8y3lGlo8as3UNaus0w3KtRMb/tN/kMsAThWX gQYQ== X-Gm-Message-State: ACrzQf1ACg4a+hhj6oRteFitjbnsDeua/EcFHvTf8HCxl9MNN0tGCv+6 X/b0HWKMqT4/xLjcoMaA0Xhdpfhx0GqVyg== X-Google-Smtp-Source: AMsMyM5Oo/lMY32Rbjb2P42pIGit9i9BhaRia6oUIpcpnkGGb4iF3F4dLHfVbSpgqfYoEpbtvaO4MA== X-Received: by 2002:a17:902:d714:b0:17f:5813:1df4 with SMTP id w20-20020a170902d71400b0017f58131df4mr14158278ply.148.1666038312014; Mon, 17 Oct 2022 13:25:12 -0700 (PDT) Received: from vmfolio.. (c-76-102-73-225.hsd1.ca.comcast.net. [76.102.73.225]) by smtp.googlemail.com with ESMTPSA id pj12-20020a17090b4f4c00b00200b12f2bf5sm145037pjb.1.2022.10.17.13.25.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Oct 2022 13:25:11 -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 v3 18/23] nilfs2: Convert nilfs_lookup_dirty_data_buffers() to use filemap_get_folios_tag() Date: Mon, 17 Oct 2022 13:24:46 -0700 Message-Id: <20221017202451.4951-19-vishal.moola@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20221017202451.4951-1-vishal.moola@gmail.com> References: <20221017202451.4951-1-vishal.moola@gmail.com> MIME-Version: 1.0 ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=KyZrIS2c; spf=pass (imf06.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.52 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666038312; a=rsa-sha256; cv=none; b=Jk1JNAeQFEtHZShXCr5V5u6gBXr8y5tLEVyB5mmMdRHyId2AFVmzoNFxwvVZuURA5Wk5Lq TcEZx1DJ0NDveHQC52J+Kd2308FccWLVi4oxX4Zr1nATXwAVdrUHiUY0XKMzw8KmC6aIup njeqBeU76flLayP+qw2LFU6FCq5DXMs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1666038312; 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=HDAaQjWw9mFQrxjxUUwcIUCSC2HAIvgNCPk+fwsNTgA=; b=k5+pzd8FTR2/EKsJYpbItKme7Cji3qQc/Vg+pkY6qdk8UGXErcW4tYEZHZw+09AxqnwDlk O/7Co+ZaViZPGzvhXgk6CY9oh1ObsFbBVRLMaTkVHk49G4AN9EXPnw7vfxPEOj7wmporpj g1MtdT9yi1ahRZcc9nmTkvjtdNUimwo= X-Stat-Signature: 3ftou9c3mpbyahof8sppxkckpw7rz4ff X-Rspamd-Queue-Id: 93877180034 Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=KyZrIS2c; spf=pass (imf06.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.52 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspam-User: X-Rspamd-Server: rspam01 X-HE-Tag: 1666038312-248087 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(). 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 b4cebad21b48..2183e1698f8e 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; }