From patchwork Wed Jan 4 21:14:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13088966 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 5BE28C53210 for ; Wed, 4 Jan 2023 21:15:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2DFCA8E0014; Wed, 4 Jan 2023 16:15:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 21AA98E0001; Wed, 4 Jan 2023 16:15:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0B9E88E0014; Wed, 4 Jan 2023 16:15:25 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id F283A8E0001 for ; Wed, 4 Jan 2023 16:15:24 -0500 (EST) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id CF02AA03C4 for ; Wed, 4 Jan 2023 21:15:24 +0000 (UTC) X-FDA: 80318372568.28.E3342B1 Received: from mail-pj1-f45.google.com (mail-pj1-f45.google.com [209.85.216.45]) by imf18.hostedemail.com (Postfix) with ESMTP id 23B1E1C000F for ; Wed, 4 Jan 2023 21:15:22 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=IJQ2lGSL; spf=pass (imf18.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.45 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1672866923; 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=L90Su4X0B6ZDbXSVecEDf/ou5Q5FXQ0WnoUVcaVOv6Y=; b=akHOytaaDqu/oXoNEQjCn/2zEYoJDlcBPbOHdyh7O4DDgqVwRxVo9fH93DG/6JxUh08J7L H8jd368bbZ/xUveHPYgkCdRutFvRg1kwYWuBjgLR3unbanTEgF7PNU2mLzGv1uSocq8Q31 jGe6dJ4h+J/vC1efNvIqqW7RJrhuqt0= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=IJQ2lGSL; spf=pass (imf18.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.45 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=1672866923; a=rsa-sha256; cv=none; b=6kg0lS+NSuO2BYPgjAd+EulxgdBwjOM+ZWt33AAkGmgzF0Txlt8d50S2iDCjWDm87npsqw opv/V4vxaDCRDbP41b/QdIM3dKiMKSeDvTOAt1u2dcNjVoilseAqYco0eBLiGhVoy+z32d eUbASsmz1BbG7/xX/A2i/IBLWQJVC3E= Received: by mail-pj1-f45.google.com with SMTP id o2so32019340pjh.4 for ; 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=mXxY0oPbrgwn4uM3X+MYbQbKYcuubJQMHTNppIitkIz/GJKe2Fe54tDVQTHDHW6Zbz jcc3pmR4ewqFKxE2Yp4N1RSg8cCh/WN04xxG2xGnxAOWaTW1+GzIGn4+gwIsTM6wNPzJ jx1Jdc3Pz0FHUnroLoOusKcGR3hQ0PGhNhMh5rO2ONyBWaqCFG39623/z7Fw/nnRhfhO svnOpMt4YJogedrKe0t4kB81rdTm+/dF3UwtvhzLQ/qZka//uZzHjBFnFAV79Ne5hN74 gjL+sPTpznDdibhaulSaYwN/ig5xPwUqlacMgpzsNXEkxZrwmvEbVlcQ0WZqGYMPOaXI MyCA== X-Gm-Message-State: AFqh2kpThv+JySNeioLVVq65fiuxs5OWXpB5OYpt1/HeyWvKIOOfh3xr lE45oyYrLkMqfV57MXfG27w= X-Google-Smtp-Source: AMrXdXs0jILNZaSP5jFG9YIUbLTH48SWLc/tHrgI72duQuw1JM4+CAQ/qirxeGWB7GaMFZz6MKkM3A== 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 X-Stat-Signature: f4dtze9upmrf3bf9g7abtwufqwamn1me X-Rspam-User: X-Rspamd-Queue-Id: 23B1E1C000F X-Rspamd-Server: rspam06 X-HE-Tag: 1672866922-170649 X-HE-Meta: U2FsdGVkX1/lzdtK4uQgFpkh4M/vseI4QDFy6L2lhp3uN2kl2Qdgy1aOcxmN8+PHf4wvjF7gAowSzDVKlSIrGTi7eA+MewFoR9R5j7bi+9cGIW4CpJUAxsB4NdwsaThqVqxClGsZQ1r0+1l/fWvS4+6yQw6q/O6T5rTlughzW1YtXpFtm57XCAqrmQR+PRaLsujCxNI3Ut+htgzpf6rg9myDxFe0BoQrw/mLF5KLBN/hmMY480w1Ypxp9v9z+XxQg9AqMNHI+mGVl15QANfbrEEvtIn/RX4rVLu1WQ3BEm4vk5+qb1R3PcNI7k/5gIpclAuBMviOVpjcSJcwOW5oPhhtgRb8LAp96cW5KusXdopNTvPllSIShXZwOHvTp1Z5bExxotyx5W0lgtVIyl2AyZewHJLVr7a90zHZXp/pRaD9e/KxWpcEJWkViqtu4xnmTY1jSS7GGDc7VE/ZshiK+RseyrwOiXdOTkEFg00ezvs7LAJVe0X8IzjwNq7r5Mqdyf/BhI8BMXq3Y/4/PpQ1Zw8rb/PWdjhWMCe0GLPQCmVrIqOiCmJ3lZ1FJvqHh3JQFjqN7kAj9IPEpZYrwsTAmX/HJp8FVImTqeI5nNy7WKCGUgk+yCcHcSRiMtE4LgT0nQl3FS5yj4amc0vGwU3nMtoBN0l6L+2wvWhl1MInM8hxf0Dc69FtBYtDvrO5ERVs8bNaZ0rYP4/qLHHRBahPB/cW7uCt8LqfA4rPOoCs4ROCaH/Jhxq/RxuY+7Jk15Xcu9WeRShhm4WEsOOiFCUoxNRe38V4s0b1I73E7o2DqKZSmHqnfrL0l/qZZ5kXyUZNOEVsPUxogHQvW9cVudSRWI+PhqkSpUp3EYE8twGqgGfn35Ihaj+3GF9FBwIxOwDVbs3pnqHnVa59BviVmVKt+NqvqzymLrMydWaQfNPuhF58qLqd6ZRgDJbpl5agwchUUXQyZHnI6YqKzK3jaAX SZ1Kp0sl x00fNy6M8EMO2e1/CCXu+QxAZrsGStJCDeX+4masjjeNB2GPt+CPcDvmobOCV7kuyWRHxNqNCaX5R6FzZY41/u0CTDjBICwXsaWWesgsjeGLADcbMysxG8hq/kqmV5ShgwpnYL445HHcMtblU2Puej3nvRLanpYwV0wsTuZDmP1Nsr02tTSPc3Q+oZ+a/YOQN54kq5l/zda5aB0e2w/fdfzKc5RMShB7doUOi7qvayjd+oAjGLzELyOZ34VIFg2b/fF3x/GiKQUZItlYM3kPlfmqsPg== 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 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; }