From patchwork Wed Jan 4 21:14:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13088955 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 BA570C53210 for ; Wed, 4 Jan 2023 21:15:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 501848E000A; Wed, 4 Jan 2023 16:15:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4B0B88E0001; Wed, 4 Jan 2023 16:15:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2B69F8E000A; Wed, 4 Jan 2023 16:15:08 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 155738E0001 for ; Wed, 4 Jan 2023 16:15:08 -0500 (EST) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id E22A412013E for ; Wed, 4 Jan 2023 21:15:07 +0000 (UTC) X-FDA: 80318371854.25.00AEB92 Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) by imf07.hostedemail.com (Postfix) with ESMTP id 32B6640018 for ; Wed, 4 Jan 2023 21:15:05 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=CNESCgcU; spf=pass (imf07.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.179 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=1672866906; 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=h/F8d0ryK33J83PP3KTKD8iJBJ7iw3NcsaZlwvBQl84=; b=t6Hjz1SQLKo8O4uBOTUw7ZeEs0xLMcVIknUBiu6Ebn7ZGEVa+N5sHyohROkwzbdfxE2E8Q SBsnfmsitFMbHGZgsnobS9ZY0vD2aHvdVij3QuhXRP/MvHN+d9lmuHZXsFnSe7i858uqyY 5MDkpFgeml3HELOY+XMkhsSd6lxSkcU= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=CNESCgcU; spf=pass (imf07.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.179 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=1672866906; a=rsa-sha256; cv=none; b=FzuEHsR0y/BB1Gxs8M5wCFUZeeXCdoCUiX0Y3925SLTAHO7pg32o6nkdJt/oogFvYUQTlN /1FZ09BHSQ0Ngd+PK9d4pFOSWEArdxYedIEj6J5t+7VA3rFa4pryMtjQ7kyhmr2FukpPaG eS/SC1fc4apIIXt0RHiZ7AX9OhumT6Y= Received: by mail-pl1-f179.google.com with SMTP id b2so37199040pld.7 for ; Wed, 04 Jan 2023 13:15:05 -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=h/F8d0ryK33J83PP3KTKD8iJBJ7iw3NcsaZlwvBQl84=; b=CNESCgcUv9kyk6ZyuvoP2d6/MvhM1pCGilvS2/lZfNbmctlSZWFKUqCSvhFIz1agh0 MrXYUY/IjeyZdKqV04XP1+w+s563MfL6+BGDibaZYFnnmEIV6pxQQi6KtEvnE/Zh6S9x N3YHOD+Wv8qtv3qvpXgMLZUQwwOCEW7H7eRmd/WlRcZhTkbK/UvDIqsoezAJMA0lHvvS kWJCDRpjIbsqJnvVQ/ULbh6fTn6+ffdvyUTkqPbElybf60JgjpuMKt4o2uXOPIr/TfNE +OyO0tT4kunau+qPwxmhXHoh0V+QCydNCNYwJsT/xGh1U9dwCtvIvQ+8IlclyBNEC2Z1 /zNw== 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=h/F8d0ryK33J83PP3KTKD8iJBJ7iw3NcsaZlwvBQl84=; b=qcb9Uz4ZKQdV3yTxLUvr8fB32ImGq7TNj7iMZuyWPwa2U+vMiOo0tGIMG8qZ0oHTCZ dt6bwBt8SO6QNM1kAVqsO8UrTz31tfpC8vuirk+1mOCIQOBKMiCA8sqMVOQHtBJebfbk /VE+MwFaS933n0MzcNa4Vqa7q/WSqJEjoEMy9dozzVmdHwy56VHbOerdWyQXdmQInpk/ Dt8fUzIBow9ZTeIYQY0guhLgxyOogT/Ldfl6C5HWpxpKhcd9FRBr/ozNkiWHokM221j6 t4SxqtfDs2r6iOp1jsy8sV1w4kPDaJwF3NUQDnTN38CA6wPhRF9Xf5WhxhaRQNSkYjHp qADA== X-Gm-Message-State: AFqh2kqAVKWAsLzDa3Jyh8F4HWJloa2aj8WersGWjuJwFZ5KbtSPMfbF aZP+ETqnA8IujoolwRt6G68= X-Google-Smtp-Source: AMrXdXuAX7hDzmiQPGibqegiPGsPttVBZ/qOOsjXqjfaA/v0yCiadzuJ0YGwzrUP0RByey/eocKZSw== X-Received: by 2002:a17:90a:8b05:b0:226:7fcb:c215 with SMTP id y5-20020a17090a8b0500b002267fcbc215mr10576703pjn.17.1672866904962; Wed, 04 Jan 2023 13:15:04 -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.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 13:15:04 -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)" , David Sterba Subject: [PATCH v5 06/23] btrfs: Convert btree_write_cache_pages() to use filemap_get_folio_tag() Date: Wed, 4 Jan 2023 13:14:31 -0800 Message-Id: <20230104211448.4804-7-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: a9we3axcbguny4f47hxjgw9t8hczntz8 X-Rspam-User: X-Rspamd-Queue-Id: 32B6640018 X-Rspamd-Server: rspam06 X-HE-Tag: 1672866905-390450 X-HE-Meta: U2FsdGVkX186CSKIGUNW/19lLMMW3qPi9BrUqkZneo5n0QBEkPtKK/FJR1bDzL5o/xZFzVmBVs9B8FTVxL8TbBfzXdwzcBh1ehK3Ele+YannPi+mtzuKLkBEZwjnvE9tnqCXgxM1CXh6NjTb2r7y6VIG+XuRGTMQ0z3mGjemGKO8OedaFuWiIOQk+cWMsFVSacWvvxwuQWRDVwJpXliBD9GATw5x1qhq2GnKAtMIMHKlchWMdw2AFUs5Hem/rBgkDKwrkAiMTxptFEkbuvki4ug7MRyFiUbGs2YiG/SUDooymZbahKYUCRhPgX9Xu0YIv9KhSJ4W3WfLd49/4khW2bTaVRmahPEQL+TreFy83+6dArKOr2HzGhlgD9nkQA4HtAyaJTtiS3csx1SgvneDc8BLadxpCUgEGOYWNP87tp2hjvtcpgD0Wv1AlnJ1M/TITnAwn8paXdzQ1tlo1dGC7CtDfCCcIfxpHGjb/BUBjzOyjYxpudD7l6fnxtuv4RJtjW9Y5cRRRruiHiO1ccYiKc10+TUftYW8QpcT9AFVfvG0Z+oYcgdTfo6sqiOv87tUbjZFvONVxh5ia1o61mTNeQ5pKDkv3whoQn7CggV5tomxBKfMFn+1Sp8Z81IDXPcPJRXS01yA7LMjfXrJvIOejpO+pV46XBEEVe+HEn3h2oQ73ti8svYp6SUAIWhyF+VloQr3zmWbm9BwRTpXR3IwYbggrWN4Ddi4VQM369lsqNZ7R6DmZk50B25LB8ncHvgd7Ha7oMVCLwkuNuC9E0Q0Drotg/3IYjvI+FoFgvasBUWKPoJM6qNza0QqMChOq3uAs7nhfTFfOAqJMlZidGpZJjCKHOtqq2Dy9iW9ZYrj3JWH7IGCAWn8JYmEgscS2LD6quHMjB3pGhedR4vhqKy3LXTIZoWfylivLrrn921y5X5LHJPCM2BDDOK1Ois7PnyYBVp6n3nwbEnh31OMtp/ CFXf7spo vDwyQySZcPv5HT6+hJXFSI7Mr5xlqLzDBL2uO9rMGqzM4PCchJtuVRnEuKSDawPqh3Sl9jJspCz52O7NUOumpUJByDOcLKsDF3fLQN4dWg3i1VIelt/LKgmZCulUUB4jZKlwxeW6AM8NFKkZUMwDNeqdHnz4TUBCmiJDgp7ZB/0RWgPX4oHgs9zUmFJ+ATtV+WHWo0y8OdQSlV8+J8z4+rpVn+/cPQotuizTp9HaIPV7tGU0qzJyi7vFlij3NTRMRpRiCObuENivRJslUDSVwhto/u+5j0CtZRzhk X-Bogosity: Ham, tests=bogofilter, spamicity=0.001199, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Converted 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: David Sterba --- fs/btrfs/extent_io.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 83dd3aa59663..64fbafc70822 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -2845,14 +2845,14 @@ int btree_write_cache_pages(struct address_space *mapping, int ret = 0; int done = 0; int nr_to_write_done = 0; - struct pagevec pvec; - int nr_pages; + struct folio_batch fbatch; + unsigned int nr_folios; pgoff_t index; pgoff_t end; /* Inclusive */ int scanned = 0; xa_mark_t tag; - pagevec_init(&pvec); + folio_batch_init(&fbatch); if (wbc->range_cyclic) { index = mapping->writeback_index; /* Start from prev offset */ end = -1; @@ -2875,14 +2875,15 @@ int btree_write_cache_pages(struct address_space *mapping, if (wbc->sync_mode == WB_SYNC_ALL) tag_pages_for_writeback(mapping, index, end); while (!done && !nr_to_write_done && (index <= end) && - (nr_pages = pagevec_lookup_range_tag(&pvec, mapping, &index, end, - tag))) { + (nr_folios = filemap_get_folios_tag(mapping, &index, end, + tag, &fbatch))) { unsigned i; - for (i = 0; i < nr_pages; i++) { - struct page *page = pvec.pages[i]; + for (i = 0; i < nr_folios; i++) { + struct folio *folio = fbatch.folios[i]; - ret = submit_eb_page(page, wbc, &bio_ctrl, &eb_context); + ret = submit_eb_page(&folio->page, wbc, &bio_ctrl, + &eb_context); if (ret == 0) continue; if (ret < 0) { @@ -2897,7 +2898,7 @@ int btree_write_cache_pages(struct address_space *mapping, */ nr_to_write_done = wbc->nr_to_write <= 0; } - pagevec_release(&pvec); + folio_batch_release(&fbatch); cond_resched(); } if (!scanned && !done) {