From patchwork Wed Jan 4 21:14:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13088950 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 706F8C46467 for ; Wed, 4 Jan 2023 21:15:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E9E8E8E0005; Wed, 4 Jan 2023 16:14:59 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E4EA78E0001; Wed, 4 Jan 2023 16:14:59 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CC8FE8E0005; Wed, 4 Jan 2023 16:14:59 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id B2F088E0001 for ; Wed, 4 Jan 2023 16:14:59 -0500 (EST) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 8FE2E80C4D for ; Wed, 4 Jan 2023 21:14:59 +0000 (UTC) X-FDA: 80318371518.28.9E33F13 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by imf11.hostedemail.com (Postfix) with ESMTP id EE78940018 for ; Wed, 4 Jan 2023 21:14:57 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=bjZkMxIP; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf11.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.178 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=1672866898; 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=Yo+m9KCho02Llmwjmz5bDSbKVzw32DqjrZ5KrSHhgyc=; b=Ru1674ke7biYXpHmqXpd9UPDFeOe60tnghYnuTNjzbvpTpIwmjfk5XHOm6P8J+Hu/I5sLi 9jTqdOY7zc6AkZjgQz5eVAgeVfw4ufdnX5Anod2EwQ+zaLO3kkJf4fbPLtukrF50Z9406N RbdGwR6abJGwhhPESThF/3Tu88cZ5hc= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=bjZkMxIP; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf11.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.178 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1672866898; a=rsa-sha256; cv=none; b=ovJ0U53K3Dxy6S0FmcgSG1CbGmY8F6K6pygq7UGS4x2oDk5FfHpzrbOXMEoAbFuWs7eNCl +m2g1VxsRrsnPojWJAduYYk8cIHWUICsLocvxJkRwc3nj89RvKqQ7LY9o1bipbA5G3afgJ BaES6Zi2NIzAeFVXJIzE/2uJz1Qn9PE= Received: by mail-pl1-f178.google.com with SMTP id jl4so30935588plb.8 for ; Wed, 04 Jan 2023 13:14:57 -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=Yo+m9KCho02Llmwjmz5bDSbKVzw32DqjrZ5KrSHhgyc=; b=bjZkMxIPNZ3wmKI3QGSepT81I5OzcwJOIb/dnupKeJzgemoOZcjM4yfreHA+pwVbeP HOd/bgUCet0z9B/XX2tfep3wWWWYLyeCIHFa1NDUjFWQdX5A572uwUJHv92lvCUSn0jH nDD1ayF0cF1sYXZY6D7okVUr906wpDImdUvSkzV/8th2CAYrKdz3orCKBweWTHnMlK4j 8Q9LXTwaogmTrXs5Gj4PAGJAZD90/jRoTwO/o58iZ0J59ckgaPVRY99HTFyy5G/KNc7Q k+iq8jJPMbsMV3H/So6AzW1W8RbB4qBsSsxHHBAFfFQVhi108BAllJmmP6SyPMsZeGbG 6mUA== 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=Yo+m9KCho02Llmwjmz5bDSbKVzw32DqjrZ5KrSHhgyc=; b=MhDEKpUA9L1v+QQUoCTnKUC0d3mud2FQGQmLV6LXfQwDIh6OkwSWv8t9zQEEp1fhxJ D9q7h6K81gMfw/7qhT1dchQ7t4nQPkSBWZzq/n7IR/dB9PiB16UzManwb22WbfQC2ypD D0UjTYQpbSzDkAgG2+0/QYsWCpJHRvdPGVbSrFuEVSgqw3uIWUdBri1VU1qEolC3yO9S +Y67GxSxcy+nOP/JMv/4KGcYWWJ6Vt78xSESXTbtWvgQnS148Kn+ri6U7fGIBs8HhNGI aBTFGDM330jxOt2C9R894Upu/H8du/vPLDdoacH/7vUQkmgnPPWefBohHHAeHmIm1SIh l7YQ== X-Gm-Message-State: AFqh2kpMbfgoYBRa5W7LatsEa+cQcYYhFEowSKFuMk+EmWSC+mS2wdX5 BDKFJ9JYg6i1VOPHw/9nwvk= X-Google-Smtp-Source: AMrXdXtzyCslo5KrrtE6aj4KE0tZMImyQpChectqYz62yJ5Pkw2zwmGtohmj+/DGwHCRBdZk95hgJQ== X-Received: by 2002:a17:90b:92:b0:225:eda7:13e with SMTP id bb18-20020a17090b009200b00225eda7013emr35757516pjb.40.1672866896879; Wed, 04 Jan 2023 13:14:56 -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.14.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 13:14:56 -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)" , Matthew Wilcox Subject: [PATCH v5 01/23] pagemap: Add filemap_grab_folio() Date: Wed, 4 Jan 2023 13:14:26 -0800 Message-Id: <20230104211448.4804-2-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-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: EE78940018 X-Stat-Signature: 9zagu6ijkhph3rztbfaxoahrzmcp1h8g X-HE-Tag: 1672866897-521526 X-HE-Meta: U2FsdGVkX1+KiHTYE71qz8Bq8QpWzjy1wleW8y4MBt/WG3KhMSZNjXt+TCczX0hBqnWYGDzXoa/B9GHgGHXoHKXlWypWGAVWLOWa6/t6cGTbaZ2yVDhWVV9erBJky8UfO0BvM90X7uUVtMD6Et7AtVcfVbNlvIuzYd5dAj08C5dcY59Kz9fOjikH56AF4ZaCmLWZdNQBvVjz1Zxad9+PNEoIZOQRDLHldgqejtd7vy5WpYnPTD+HoCQiiHxR/Ur766u6ohUgqlGl3NFzMtzstWd/Hk1DJSXW6o0SmVrheIkHY+Dk8d1X+s6E87gKMyL563WAeRG2YqImV15UYUNRarShiCmA5mjGKJVGQCx3tAAPrFwPrHvlFKWnBYsxdUH2Y8tCyMX1xk21mQKu58u4FMIJW8C/AZ8eE0qxy3/AsBCOYw4njXJlPpALV8RQWEl4h+sg2987I2aF+8IG/qP0mLKqxuKecBIIfMeHs4ToRWXS7dcTg3wTpiPZakOSzDRZoajW01KTDX/tQ6qpZUYrB9slxEaWkW6/uGmKvkvyqNowhxB1fxffklVmZdl8P3yVeCmOfJQQ7J7LjKtiHsbcheYVGnLoP5PFxAKArYYc1DStSO+07IBa8QQbijaGrEge2NFCAuDiUzEuVE+QqP3dy9XcrKq4oEGGInykvQBhL0Y9EwtrBWKPsrkCrGcPvjyhCCobX4qIhlpQ1znt6Hlkjni0tJTPJtoov2G/cap7yg3co18gHW2wmJHueGP/bNgZzz2mgQdPkN8NVcrLg/T0JUwgmJ90Q8ySJEXp3PBiGFZPrW/bEPCt3LFWld0fRMoSo3We+jyi4O1Ki+2YNgxhIM82rIop7yuXeBp2hOhCmM8AE5ttpyqmH2iGvNfwgtAoAtAXicjLIPEH9ArxrH/O8RQemzd+6CpQaEeHO+nnREnfrNx1Rwwr9dEHjSfjzjb2Q3x3iCT7oL660lxo7jR C3VyQq/Q ewoDThTniMKaIhzbt0V+ZejeLkzFG8I4xCTlKc6/TlnivG4ta1ByK3wZo0Qt5UUy1IEDoRJZtlhrP6CzYF0TPMhO7yrWWEFWh0kkTGOqif2rCKYvFTC1FzlPZkH/6kH64zFKPQMxxXU1lnAB71Kwl85EhNJRJ1Kcn6tOoMDT7taP9R+/7UGOZYGIIPthgyms2QludDsp2gbeuufwrX7cfkOst6TbDIBdinOD6M+dnSrDaj9Yr8bw8LbK7ve60eOyoyNorFYHpzqzEMqlQ4vtVyeiFiEFuZLMvSczk 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: Add function filemap_grab_folio() to grab a folio from the page cache. This function is meant to serve as a folio replacement for grab_cache_page, and is used to facilitate the removal of find_get_pages_range_tag(). Signed-off-by: Vishal Moola (Oracle) Reviewed-by: Matthew Wilcox (Oracle) --- include/linux/pagemap.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 29e1f9e76eb6..468183be67be 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -546,6 +546,26 @@ static inline struct folio *filemap_lock_folio(struct address_space *mapping, return __filemap_get_folio(mapping, index, FGP_LOCK, 0); } +/** + * filemap_grab_folio - grab a folio from the page cache + * @mapping: The address space to search + * @index: The page index + * + * Looks up the page cache entry at @mapping & @index. If no folio is found, + * a new folio is created. The folio is locked, marked as accessed, and + * returned. + * + * Return: A found or created folio. NULL if no folio is found and failed to + * create a folio. + */ +static inline struct folio *filemap_grab_folio(struct address_space *mapping, + pgoff_t index) +{ + return __filemap_get_folio(mapping, index, + FGP_LOCK | FGP_ACCESSED | FGP_CREAT, + mapping_gfp_mask(mapping)); +} + /** * find_get_page - find and get a page reference * @mapping: the address_space to search From patchwork Wed Jan 4 21:14:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13088951 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 0C578C54EBD for ; Wed, 4 Jan 2023 21:15:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6AF808E0006; Wed, 4 Jan 2023 16:15:01 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5EA238E0001; Wed, 4 Jan 2023 16:15:01 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 48A8C8E0006; Wed, 4 Jan 2023 16:15:01 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 3BB4B8E0001 for ; Wed, 4 Jan 2023 16:15:01 -0500 (EST) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 1480D1A06AB for ; Wed, 4 Jan 2023 21:15:01 +0000 (UTC) X-FDA: 80318371602.18.0F50308 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) by imf04.hostedemail.com (Postfix) with ESMTP id 7173D40008 for ; Wed, 4 Jan 2023 21:14:59 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="X+JhwQB/"; spf=pass (imf04.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.170 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=1672866899; 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=KWc2oMWZrabUsNL93YYBg0xBgzl7UJM5P4FHRP4dszA=; b=XF/1sksl2OUbjWnQbYrJ1V3B1tbm0KeYcB9ajBRDEOV7ydGiE2lXm9YCOZMJzJD+W5ryF8 9U0vgIOzlEMt3DvCzmmElH1fUM8bMIw36Ci4UB4QFQgmeuGVSV9ISaogoFefP9zXiJrzeu CIhX21nIQTk0c7J7mtkFObL6s81nKtA= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="X+JhwQB/"; spf=pass (imf04.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.170 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=1672866899; a=rsa-sha256; cv=none; b=CpZ4gl6b5Sz4pPzf3vYKp22O8Zk8UsHa6O33WuemCMX+CdYxUqmKW7bc41jM5Ki7Mypr7A jzBUr6aSUEV0S5EXj0F611o0gcoilxozqruyT7Fqj/LfO+bW2lIph5zfa7INVAiH8mF2Az 0e1M9+qVzqvxt95ycwWnmB/F8BbrtsY= Received: by mail-pl1-f170.google.com with SMTP id d3so37194071plr.10 for ; Wed, 04 Jan 2023 13:14:59 -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=KWc2oMWZrabUsNL93YYBg0xBgzl7UJM5P4FHRP4dszA=; b=X+JhwQB/YFpkv9O3Sz2RIqehaNfUYePllMKYDSfYMVmQ80S+7Znm3qUhQQutUgGzcL 0uq/hVoyBfqjmkDpyVZm/VIPt68FQqEGQ82Nd+zz6E+E98NXjR4XSpPj/MXztZhY0W/5 2SnakvGDdpx0xcZLQD7UZxy8cVZY3oo6XDRKLX6rp+1lZ5XfYRhOxIIbBxK+QOE0O7oY mvbbq1JpLOKHZ6D7c98chruQCpXs68i4ZX3rFltoX/XuVJPECIsdkN1cooENDtzYQJT2 bRwgzwaxOKhTwxGYYDaTYxmm4WsaqrwCXgLa3BEJo54/4GqC8mZRZtI56zwUYC6qebL9 Oo2w== 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=KWc2oMWZrabUsNL93YYBg0xBgzl7UJM5P4FHRP4dszA=; b=rj/cXstDlCIxmwwKJR9p1B32Qx99R2MLIukeULwTGLX+mi+QFz81eoGTqLeoeVJK3y 03u6aCHZmd5gcDA4wRY/9yrp3YmrGHAKIQInmS99ifXN0g/lhoPswyoSH53nVCzXPGqR 5jYHLinVZ321q7JV8RWVzhyQWV6WZGb1z6aZfAaSa96OunUmWbY4aTAH6/ITfiVyngAb Tk3lIlcHBKcib9wLOm4clMV+L3Esl8gvvLNKQ30uB9Qek2jMIAxNZKgVj98vM9qgD9y2 Q6Yp6fG7w2mX098GJijmddCGL6w68XeeKQPYWKZEenGObVCVcqMRCkEvcdVo7+kQlkHT r2TQ== X-Gm-Message-State: AFqh2kqFVeyu0rokX9dGnPiJR6D8UB9HqK7V4VOg7rfsAbfol1PzvO4O irrHknZFtY9zYsydDxrfMX4= X-Google-Smtp-Source: AMrXdXsQLnyc09jFT7hjT2KR1nJMp1M067OD5YrApEuRuIFS+9J6bRUAVKGRrDQmj0MgbIV/5rlsug== X-Received: by 2002:a17:90a:cc2:b0:219:9973:2746 with SMTP id 2-20020a17090a0cc200b0021999732746mr65437761pjt.0.1672866898346; Wed, 04 Jan 2023 13:14:58 -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.14.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 13:14:58 -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)" , Matthew Wilcow Subject: [PATCH v5 02/23] filemap: Added filemap_get_folios_tag() Date: Wed, 4 Jan 2023 13:14:27 -0800 Message-Id: <20230104211448.4804-3-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: 11i1b37higgyt6osai4e7db1jjeiej5n X-Rspam-User: X-Rspamd-Queue-Id: 7173D40008 X-Rspamd-Server: rspam06 X-HE-Tag: 1672866899-468021 X-HE-Meta: U2FsdGVkX18CiCG0v/xd35ySElXOmJtvFzPN8ZgQN+pFaCmp2gdgkfcRgMaSSNP8dSUwx22icghVZ6FNjAG7rnGxB/jpYGTS6Yv8SBeJj1PAlNsBiDMF2GT4GtZiULY+9NJW3MTkTGrz2KA0/cm2/jBfRAWylmzm60pajvlRWxQNFf9ozzlaKwAbmZsFuxCsTQU8nEMKOprhOrc5BcOmWHAcluUueOcI8Bix7KYYAUhmuEUTKaXgzwGyVqtOiAMhkyTbxx4JCnzBDJXasSmGMLiEM8ovJHcRUBD42b7STY9ptcATBROR3GPTTgHkCooGKoYiSoXV03qbe76JVyO1MAU9J06KlI2dqA2A++fjME7Q+LMFMmQm4ThUAy9DWQdnuIEiWR3BXY+9dUejkYtf2+Rh5i7GzBqAm+HUycU/nVzortb/x5yatxDSMwHJxbzoFZFX7YpjVOzupbFrNQBkjkoB99xQrRDoOsXEsiz5ozywmgt+QvlgOIK3JpV+5QIDijAh9w/2p8GJCsXYP8upQKu02SmfGNznIHK12EsGTsD0ZRiBOPAhnjqCLwgOSTUCt0GOMQU/thTywWnKNKTqqMAI5z4M0pMejJ37AXTL4GCkRqJGKVOZjjN9n7TQkzGcN+GFyK3h8KHi5cbeL4XRXfkL2DRKo221xhumvkfiWRwEFYPBra2NK4BnCLM+k2snXlw5Ud8NuQL+tLjK8inqzQjU/1p1I2q7JozO0H4T7ksxHZvV3Yw7ax00plQl8piNZbccv0ESyJjFidR+woqfq3vNJg1lAelLK1xJieWOP5CS6ls54UH3BNRyzYTEWg3FZ2R1Py7j/f73ecKpHUePf53fIdFC4m3VVKGcJIJxardPeD8+ZdF21+APhN+ty3qAZl4/OimcGPUjkDoGWl2LNeKwOJCPyagA1iudPhq4XIMClIQtG4EAsiOBND2RkzxLARLcyeCW6MCIvLlt8lg 6UNrzv5B rN12lWCHTVAKz+avKaw2BisN7bCa0KNSfsvsaL4Oooi0mZLrn2d8WU7doJrdNxdlawo4dAAro01AShSHLB8g1xFwu1e0xxMadazBmShhH5sugFq7BYCrXuDteD1WQFeS6lixbNoioyVeG7YhFLkJ1QAAG1yaINCMqBTP1KhQoHnT7xxAuiAK3/2q1sPNLLAqLc9TUIKr4Pb+al5P+k/8faNkoa5kpl7L841Qzq3nVjYQz5SG6Zr+Do1cpx3vkfOoY6KEVq5INIW7v+6Ip4b94yVcmMBO3bG4RZIGd 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: This is the equivalent of find_get_pages_range_tag(), except for folios instead of pages. One noteable difference is filemap_get_folios_tag() does not take in a maximum pages argument. It instead tries to fill a folio batch and stops either once full (15 folios) or reaching the end of the search range. The new function supports large folios, the initial function did not since all callers don't use large folios. Signed-off-by: Vishal Moola (Oracle) Reviewed-by: Matthew Wilcow (Oracle) --- include/linux/pagemap.h | 2 ++ mm/filemap.c | 54 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 468183be67be..bb3c1d51b1cb 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -739,6 +739,8 @@ unsigned filemap_get_folios(struct address_space *mapping, pgoff_t *start, pgoff_t end, struct folio_batch *fbatch); unsigned filemap_get_folios_contig(struct address_space *mapping, pgoff_t *start, pgoff_t end, struct folio_batch *fbatch); +unsigned filemap_get_folios_tag(struct address_space *mapping, pgoff_t *start, + pgoff_t end, xa_mark_t tag, struct folio_batch *fbatch); unsigned find_get_pages_range_tag(struct address_space *mapping, pgoff_t *index, pgoff_t end, xa_mark_t tag, unsigned int nr_pages, struct page **pages); diff --git a/mm/filemap.c b/mm/filemap.c index c4d4ace9cc70..291bb3e0957a 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2281,6 +2281,60 @@ unsigned filemap_get_folios_contig(struct address_space *mapping, } EXPORT_SYMBOL(filemap_get_folios_contig); +/** + * filemap_get_folios_tag - Get a batch of folios matching @tag + * @mapping: The address_space to search + * @start: The starting page index + * @end: The final page index (inclusive) + * @tag: The tag index + * @fbatch: The batch to fill + * + * Same as filemap_get_folios(), but only returning folios tagged with @tag. + * + * Return: The number of folios found. + * Also update @start to index the next folio for traversal. + */ +unsigned filemap_get_folios_tag(struct address_space *mapping, pgoff_t *start, + pgoff_t end, xa_mark_t tag, struct folio_batch *fbatch) +{ + XA_STATE(xas, &mapping->i_pages, *start); + struct folio *folio; + + rcu_read_lock(); + while ((folio = find_get_entry(&xas, end, tag)) != NULL) { + /* + * Shadow entries should never be tagged, but this iteration + * is lockless so there is a window for page reclaim to evict + * a page we saw tagged. Skip over it. + */ + if (xa_is_value(folio)) + continue; + if (!folio_batch_add(fbatch, folio)) { + unsigned long nr = folio_nr_pages(folio); + + if (folio_test_hugetlb(folio)) + nr = 1; + *start = folio->index + nr; + goto out; + } + } + /* + * We come here when there is no page beyond @end. We take care to not + * overflow the index @start as it confuses some of the callers. This + * breaks the iteration when there is a page at index -1 but that is + * already broke anyway. + */ + if (end == (pgoff_t)-1) + *start = (pgoff_t)-1; + else + *start = end + 1; +out: + rcu_read_unlock(); + + return folio_batch_count(fbatch); +} +EXPORT_SYMBOL(filemap_get_folios_tag); + /** * find_get_pages_range_tag - Find and return head pages matching @tag. * @mapping: the address_space to search From patchwork Wed Jan 4 21:14:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13088952 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 58C0AC46467 for ; Wed, 4 Jan 2023 21:15:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DBFB38E0007; Wed, 4 Jan 2023 16:15:02 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D65058E0001; Wed, 4 Jan 2023 16:15:02 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B68C18E0007; Wed, 4 Jan 2023 16:15:02 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id A94778E0001 for ; Wed, 4 Jan 2023 16:15:02 -0500 (EST) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 7A8921A02B1 for ; Wed, 4 Jan 2023 21:15:02 +0000 (UTC) X-FDA: 80318371644.05.E611CD3 Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) by imf26.hostedemail.com (Postfix) with ESMTP id CDA87140017 for ; Wed, 4 Jan 2023 21:15:00 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=B4tZImsN; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf26.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.177 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=1672866900; 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=/ONYMO0PIN9dk55uWmFjeEGp9OM+yknAPJhSRMx3xaw=; b=YcXWL4KzdEaog3XtSu+y2hutKP0EcyO8UuICmGS+2X3dAWZO6MjRi3FRhEKFUeCn5RejJG 2EyAYpz6w7TlsLsMfs4pKJRewBXyDRp0CXActQTqgdSTUpkzkZ4CdzNFhRSheYZh8AdpTA aQLbqJJuUebEfNumOJNs21t/5TKX1C8= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=B4tZImsN; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf26.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.177 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1672866900; a=rsa-sha256; cv=none; b=6CM8mdIs+0TkcJzeQKS91bRw4tuf8asR2xd3M4OL9DliymK9Go9c8YW2DTgOrg6uJiOUea VNuzyqk3IAUOsm02W6YCx0vf7BuaVDcyJnuNQSOarUjhuLg4M9ILRa+qyjePpFRQrtjSj/ YvArbnOFyD++blOMFBq6FTASIV/TENo= Received: by mail-pl1-f177.google.com with SMTP id p24so14703956plw.11 for ; Wed, 04 Jan 2023 13:15:00 -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=/ONYMO0PIN9dk55uWmFjeEGp9OM+yknAPJhSRMx3xaw=; b=B4tZImsNKLYbwaEqQjZ6y+RmfYlF9uPZ5GCZplXcCJF3iTUDgroyLgSP3mqYOoL8tg YUfyLoz3u5XgGnDE8mGVieFI7uGrvjpm7MV2567un6rA6WUGTCXfddQ3eRYqgtAPAsej ouYl8YS3aBd3N56Obqpj4h8BMtdtujYYIOVDFk+W7HfSFDJTTHDe65xJxpTl3VgqIUmo pI4SkMbuMEFagQxYzTZziQxn82J39o2Z7ocFmImgkgV9x4eSLUJZQMl3FydDHvRMUEpG u+rOOzvhF8F30SkjJIA4rPh2WDlpUGXokQmXmXOoIKmRVkH4a151vkBklfMzbbK9lmfe ilCw== 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=/ONYMO0PIN9dk55uWmFjeEGp9OM+yknAPJhSRMx3xaw=; b=66QPPRAXUhQeVQUAl9SiOx2qvjxlvbOwtXn7x1uZ6FyvOh6Gvg0z9aeDOOWUeoN3lg lxc1r1cKKphtbzjP6IOOo5GI1kuVh3qOC34IO3+49TGzCN9VC84HHGLpmS3wStjle+13 w5X8shpb9dKUthCY2lJgrkKa2jSAYvynku1Wb07XmtY5qUNfaDdTFRyBvxdEKnnePF6T r3OnR6yrMffAmqJD0Ez3AvuQPKzxMuSQhRaY0ZDRYeBny/5lHD8vrdj1FXVLpFKlAeJU dH6wv2yEjQxm9dH7bzEb1FXxmDl882yYebuS0yqsUR9U4IV9aN+bFW3vtKAh5Y4N6DKu Rdqw== X-Gm-Message-State: AFqh2kofAFBLwY9xtOwtYaPX83MsIeJVQhvuKtuRY+hB9EonZmlJkuKv ilDWNPcpSQ/VpJIuc4DFJ4oseydDvODBmw== X-Google-Smtp-Source: AMrXdXvZLValNoGwSyObnfnQYoAH4bPSeKaHZWatAKcSnlYAPIvL07xJdtB6+9NqIK7AN3tdnyykVg== X-Received: by 2002:a17:90b:2485:b0:226:b9ed:1788 with SMTP id nt5-20020a17090b248500b00226b9ed1788mr2782434pjb.31.1672866899803; Wed, 04 Jan 2023 13:14:59 -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.14.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 13:14:59 -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)" , Matthew Wilcow Subject: [PATCH v5 03/23] filemap: Convert __filemap_fdatawait_range() to use filemap_get_folios_tag() Date: Wed, 4 Jan 2023 13:14:28 -0800 Message-Id: <20230104211448.4804-4-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: CDA87140017 X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: stcziux4ywnt7jtaxci7pjfz97wrrm1h X-HE-Tag: 1672866900-3471 X-HE-Meta: U2FsdGVkX18qU8jIpzAsSyV9W6mt2JhSRQ/PiFtVP4T/MG2xAtlH8WpzeDOJe3Ito1YMi1/wBjucGWYe39Nr0l85rgDG6ab7natkUKDE2yhDustO1AdCfPERkvvo5DvFzwcJEqG/nOfSLpr0nq3ilPKOAnK5XwIfh0JTsluBNY8kNoI1a/VacmxF05M/nq2UOF06AQC1YNkzFGgnWOHG6CkTcQ4JL+mdd/BaarLo+4L2eIM3gsyHAaUp0sk6KGZavQN+bSIWP9XNQxyzt4G7FqHIkZfaJoW0EIXuob6v+EnowdAnrX4wwXhBdViQkQHlGw+FqaCqZRksllOlk+KFl4xGllnmcnYkAZUvx7Wc6pX2JPbJMtPNO8/YrtdkzLNmHrp4uvVbXbne/DX31e0z/pYuGRj3INXyfjvfy/9rhTmwJPq8mWUbEuwRpbKDdOuu8zuQiTtUpjtKyxBXm3U4G0wS2n1hpYcvYJyX+oBKb9inMbTJ+8e+x0bNlCTILFbAj+taEJ/FgIWJslSQL0D5VRCE+jN6VvOBNj3MikneVToR4U52EN74D1AoFn0fmKM3rzdGWCOB4hkp/O1eKo283kmTCq36nxhD5l2vJo8fpriPWpTwdLZjOU+HxR/urZPejWuMSiJYHtzlnBbtKEoom/5LxmMrQ2KlQCcayVdDuZj3GuUvH/jPiXrkCPMATBi2m/Bg6g30DetQLQbDHxBEfRPR3K3mtUdW5+kUydQBMUu3oDZP8kKlMse6pI98aEYE8cU7fNpXuoweOMkHR3yft1dqXYgC3JKRzu7K7I1aBr1I6oMJMGBeBcbt9WC0qKyc+3CBBDX1J4BBHV4NhZBrRgEUvd85NK2u/+w4E/Y1PQOelPlICCamq4wtLFOjFdqk5vPX13Al3PY8ajydfMFg+Nhgalp4c2KqPZU+CEu1AoqD8/Ot8AheinMNjQ0GDeySoOMDNCr9vTHietB3Cj/ xev5tXBp tmd+j+DAcHIfEoNcwGCX32tTdnpNeBtCpwVHPMk5+7LQEVRowGOH2poiwWzrnw4N6SaT+Ny1CypcWbVtwlm4pTBu7UXtV5fsB9Lr//HeE3ojIMEhLTAoYDnWZ8KQExAyVGfyCqH7b3dT9tJa1e3pE3Pr7guA/zRW1ZqWHKtt8YOK/F7dP2H80BAlM9RuNUcZJyiiLSL7/0YHd2N05MjZFqDMYr9zw0A+q6PDdfY8axytErwmDzSVbBkf+ijzbfcVXjGOD18rfMIgo3uXK7sE6EHyrtvy4i1kpl3nH 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: Converted function to use folios. This is in preparation for the removal of find_get_pages_range_tag(). This change removes 2 calls to compound_head(). Signed-off-by: Vishal Moola (Oracle) Reviewed-by: Matthew Wilcow (Oracle) --- mm/filemap.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index 291bb3e0957a..85adbcf2d9a7 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -503,25 +503,27 @@ static void __filemap_fdatawait_range(struct address_space *mapping, { pgoff_t index = start_byte >> PAGE_SHIFT; pgoff_t end = end_byte >> PAGE_SHIFT; - struct pagevec pvec; - int nr_pages; + struct folio_batch fbatch; + unsigned nr_folios; + + folio_batch_init(&fbatch); - pagevec_init(&pvec); while (index <= end) { unsigned i; - nr_pages = pagevec_lookup_range_tag(&pvec, mapping, &index, - end, PAGECACHE_TAG_WRITEBACK); - if (!nr_pages) + nr_folios = filemap_get_folios_tag(mapping, &index, end, + PAGECACHE_TAG_WRITEBACK, &fbatch); + + if (!nr_folios) break; - 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]; - wait_on_page_writeback(page); - ClearPageError(page); + folio_wait_writeback(folio); + folio_clear_error(folio); } - pagevec_release(&pvec); + folio_batch_release(&fbatch); cond_resched(); } } From patchwork Wed Jan 4 21:14:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13088954 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 94F7AC54E76 for ; Wed, 4 Jan 2023 21:15:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EA0278E0008; Wed, 4 Jan 2023 16:15:04 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D8D688E0001; Wed, 4 Jan 2023 16:15:04 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BB7578E0008; Wed, 4 Jan 2023 16:15:04 -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 AE5868E0001 for ; Wed, 4 Jan 2023 16:15:04 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 6D7224058C for ; Wed, 4 Jan 2023 21:15:04 +0000 (UTC) X-FDA: 80318371728.20.15D9683 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) by imf29.hostedemail.com (Postfix) with ESMTP id C1FDE12000A for ; Wed, 4 Jan 2023 21:15:02 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=PJJR7HrE; spf=pass (imf29.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.170 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=1672866902; 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=uFWiZotH2hHO/dqZz3ekRRXvMmeZ6crkehTB/0Ti1xA=; b=z1o0IaG1BE5Rjs/OHzorKMDbTZJ81UpB2kKEbVPfAlPP9tJtzEQJ7vm3Ouugs+uFz/RYye Nq4m/cZ2WPg701OznlGdgJTZqyBDtaUSNJvVwol3jpc1dH5Rf5q9i0V9h1kfK4eZpJk0DW ny9E/mZddq5cbmib7Vfu746knzbGueY= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=PJJR7HrE; spf=pass (imf29.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.170 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=1672866902; a=rsa-sha256; cv=none; b=2N6rY+9syIZ1HEVVh143GMnwv9sfvVUExfBtgFebJx26O+ODfPCCd5YPR9IijeKzBXToBJ gL0LxjjjeKWhs4wCh6MKcNuXBBg3IYIpH23VpXOmhF5vyYXcLI25HcQJ0bqhYq8kF1JUFj 6+XqC+mObKwDK22GSIW8vBf5NRQO4co= Received: by mail-pl1-f170.google.com with SMTP id d9so20452141pll.9 for ; Wed, 04 Jan 2023 13:15:02 -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=uFWiZotH2hHO/dqZz3ekRRXvMmeZ6crkehTB/0Ti1xA=; b=PJJR7HrEap3tSH1Krm3xKRqYuv2+ZnILQzCAZ4FvA6g7y0di41mF1AmB7b4LucnLPW 9SnkknLaQi9JPN7HiqQursF5IJIh8x4Go7xxIzVvYbBtPjzAmZtsns33bPkPsrt+hy50 mCiKeevBosZyzcK2IMA4wvhDdxllKMI0cCC9SxOGeZRrOeURvnO4TDKbleugnCd9p6Lb 743pneGz2xpnNZHO7fCMj35WHO1f/RGQIweETnZKQ8XOTIemf3fMpTvzMTMPSOgKVRuz JEcncOEIDLTioi5zOdKBwUNvJ1hrNSt/h0sKN3+bcLYhECKpZRcloIieHM2fofEPAV8A w3mg== 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=uFWiZotH2hHO/dqZz3ekRRXvMmeZ6crkehTB/0Ti1xA=; b=ykgOjVhm0DILefyFseIC5TgiLrlgLTKPfbAc0PZMHKZuhfAYdpAVMVL1OqeFNBjHBB llhUHVmW+MBVD1GwNu9KTRI3NIpkaxOfGxtR7ukHm0W2xsG5/D7EGiAY4xXZU/tvRKK4 ok9HCPF9/kLn33Shm8lcn2Egrty4jh/T+1/cXE/ZVsIWuFvll1WHb1+IVff042Bndz4d JHVYwIoHvGFMJ4s519mCxO/v1tv33AC63CLRfV7Xhkg4Ji6HH/utpWnKMCjhspKYT79/ M3tVwJ9d4w+W4SRCMqdXEFCMWf9qOvW0twJirbCY224e/9zwEHrfEoAtcMds/mir4x2w ohLA== X-Gm-Message-State: AFqh2kqEFjnIBoVIgAiPMiaUpE+EHOEAhlDl/ulH/7gbkYLRBaP2/NA1 hOYTQujyR+RuPbptgJqFhBg= X-Google-Smtp-Source: AMrXdXs3J6LoGMu8noxjtrKyXAiquvbz4xl3hf/x2raO3jwqWxe++Tv6pvIGcV6rBxNIAYQX5K7/nQ== X-Received: by 2002:a17:90b:4d8c:b0:21d:ef10:d6ca with SMTP id oj12-20020a17090b4d8c00b0021def10d6camr50592886pjb.45.1672866901534; Wed, 04 Jan 2023 13:15:01 -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.14.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 13:15:01 -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)" , Matthew Wilcow Subject: [PATCH v5 04/23] page-writeback: Convert write_cache_pages() to use filemap_get_folios_tag() Date: Wed, 4 Jan 2023 13:14:29 -0800 Message-Id: <20230104211448.4804-5-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: xkaktzqqgmuw1ig734un465ciexxu467 X-Rspam-User: X-Rspamd-Queue-Id: C1FDE12000A X-Rspamd-Server: rspam06 X-HE-Tag: 1672866902-674178 X-HE-Meta: U2FsdGVkX198qmLPjQQoXovqV0YRJkyIadDJy67Zkgu34+ycnnF28IVgd7of4V3xetiYqvtmjWi2xbRuq98bNlanvEqUSWBLN4uPA+raY9Jnd8Y3DZDJr3f61ZRHHMEfLpoP5KqlPicYlOzKtfp71NzqMZoNB+ybxMp1AGI/lL8bawENYf6PeNnbKFNaYUUbKQERuw9fC5BNi23DuNqXsPpmYvg4tqSFrjPcEAasa77KXE7/sPvGdCtg5mPsxAO9Z/uDJDS/TQGR5p0io5n9+NUf2C9ih4z+XHqZgoI0XXzwozHXVfxV+OYzfN2tfONTjgF8/dOzES9mCXlh475H3C2bGwl8DDWYgz8w363+Qtjfxm1hiiTeACdY57XVScJ6pHUp5/s2cdPdITKU6XPTnyI26jEMYt2SpLxIdXmZ7S0IjjnfseHUTIYf9fCn7p54KioqP0kP11NI+lkd5mUkFdI/4Hx8u80gAvae00mShs5Pj0RJ/V/0+XeEkRUoAW30TeO+glstgefcp3zdZt7Cv/cQj6D4Q+eLCtx2LNbtNGZ69tWpUctdSPhLtartBIXx9ymio8ctJqA12C/dxkHReV9TdU7uspe13nVoToMorZGg0xx6+Q/HH7k+gZMTpUC3kxcYYljiFHg6LSuCYpvAZyQjxBE1lS71kaa8GsTu3uRg+xo62WHytX9TZTdTLTmU13vdUK02Svw2gwf8if9LmQQTkPADpk0VnoerkMnsQBMU8gyKyYOdJRH17FL2EglMaqIlmHescyODyYgfQqJNxK8uKaLMekm1qcPxNzW+sk4DmIvOOX31T9E2V5IhXBOrPeX/QE2xg6nw/Hfm4ZDU3zoDOZuIWqdGJHQoQX48bEjlNjTJkSPWC1B1Da4V4O/hqfZZ6SqP8g6MkvtBqMpoDG9Il3jeccaJYobylishNmACxiIgdezbQX8qwwjS3NxqdLv1e70pjkzYMpIwimk /n+j7Tt2 MHn5HJ9gvSARKbmzzMVg597Wragl6pJpTkVzSqkiGoVQ16rsANY1ZuFEpZx8FYtzuyjN3aX7OQCFbKx6QiWtgB322mgMJy7jWDKkqrMbZCF5YROPvlktMkztnfpllXuJQ+TlX0UaELuAPhjyKGLFSX+JT/v4Ts8F1af9AI12YFFZnP3Vn5+ClCEQGTKQPtAyKRBZ61hQ1V/1zJVnV3XjwDyGqFAItQZvsbNf/H4Py9R2FlANHC62fx67L1yWkP6ikWt2eJS3zLzeIUxLvVxVhJ/bLiuKHXBPDrZLl 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: Converted 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(), and the function now supports large folios. Signed-off-by: Vishal Moola (Oracle) Reviewed-by: Matthew Wilcow (Oracle) --- mm/page-writeback.c | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/mm/page-writeback.c b/mm/page-writeback.c index ad608ef2a243..5d61fa9eecc0 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -2398,15 +2398,15 @@ int write_cache_pages(struct address_space *mapping, int ret = 0; int done = 0; int error; - struct pagevec pvec; - int nr_pages; + struct folio_batch fbatch; + int nr_folios; pgoff_t index; pgoff_t end; /* Inclusive */ pgoff_t done_index; int range_whole = 0; xa_mark_t tag; - pagevec_init(&pvec); + folio_batch_init(&fbatch); if (wbc->range_cyclic) { index = mapping->writeback_index; /* prev offset */ end = -1; @@ -2426,17 +2426,18 @@ int write_cache_pages(struct address_space *mapping, while (!done && (index <= end)) { int i; - nr_pages = pagevec_lookup_range_tag(&pvec, mapping, &index, end, - tag); - if (nr_pages == 0) + nr_folios = filemap_get_folios_tag(mapping, &index, end, + tag, &fbatch); + + if (nr_folios == 0) break; - 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]; - done_index = page->index; + done_index = folio->index; - lock_page(page); + folio_lock(folio); /* * Page truncated or invalidated. We can freely skip it @@ -2446,30 +2447,30 @@ int write_cache_pages(struct address_space *mapping, * even if there is now a new, dirty page at the same * pagecache address. */ - if (unlikely(page->mapping != mapping)) { + if (unlikely(folio->mapping != mapping)) { continue_unlock: - unlock_page(page); + folio_unlock(folio); continue; } - if (!PageDirty(page)) { + if (!folio_test_dirty(folio)) { /* someone wrote it for us */ goto continue_unlock; } - if (PageWriteback(page)) { + if (folio_test_writeback(folio)) { if (wbc->sync_mode != WB_SYNC_NONE) - wait_on_page_writeback(page); + folio_wait_writeback(folio); else goto continue_unlock; } - BUG_ON(PageWriteback(page)); - if (!clear_page_dirty_for_io(page)) + BUG_ON(folio_test_writeback(folio)); + if (!folio_clear_dirty_for_io(folio)) goto continue_unlock; trace_wbc_writepage(wbc, inode_to_bdi(mapping->host)); - error = (*writepage)(page, wbc, data); + error = writepage(&folio->page, wbc, data); if (unlikely(error)) { /* * Handle errors according to the type of @@ -2484,11 +2485,12 @@ int write_cache_pages(struct address_space *mapping, * the first error. */ if (error == AOP_WRITEPAGE_ACTIVATE) { - unlock_page(page); + folio_unlock(folio); error = 0; } else if (wbc->sync_mode != WB_SYNC_ALL) { ret = error; - done_index = page->index + 1; + done_index = folio->index + + folio_nr_pages(folio); done = 1; break; } @@ -2508,7 +2510,7 @@ int write_cache_pages(struct address_space *mapping, break; } } - pagevec_release(&pvec); + folio_batch_release(&fbatch); cond_resched(); } From patchwork Wed Jan 4 21:14:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13088953 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 19084C54EBD for ; Wed, 4 Jan 2023 21:15:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A7FA28E0009; Wed, 4 Jan 2023 16:15:06 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A32948E0001; Wed, 4 Jan 2023 16:15:06 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8820F8E0009; Wed, 4 Jan 2023 16:15:06 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 78F2F8E0001 for ; Wed, 4 Jan 2023 16:15:06 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 352F5160951 for ; Wed, 4 Jan 2023 21:15:06 +0000 (UTC) X-FDA: 80318371812.09.93D1EA9 Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) by imf08.hostedemail.com (Postfix) with ESMTP id 8AAE116000E for ; Wed, 4 Jan 2023 21:15:04 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=FtYpbP6Q; spf=pass (imf08.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.173 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=1672866904; 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=V2mmRSbNA08/uL5X+kgeGS/ZlgopWrLZQOgB2XOAgyQ=; b=mv06Yk71sz8KpwJFptOxSn17KhDC91kStB50FJ92Mi1W17vlDdpsbKCE2EW4qaOkgAbkOq pdvtbLjb86t6blKpj+bCypCZBHWgY0CbUaagmw+C5g253xeCoZu4zflIyU0ae8KJzRuD2f EpWLf6t3ZcPOuiSFF2fRr9iaddYG2zo= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=FtYpbP6Q; spf=pass (imf08.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.173 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=1672866904; a=rsa-sha256; cv=none; b=3vCh6Mcvn4xPmrudWAOxiQnucXNo0ibhNrAVy2vWGQY6CupgSz8YQJ45/pt9VpjZpKJDfn gXnbN56i7EGZX51sP90erZbrysFJYFZ41cO2nU9hOA8lbqTfV6twQiuNZADp0xo/fRVK8U 8q/P56j08h4V6H2BbNN+Q8oJ9vZXmIA= Received: by mail-pl1-f173.google.com with SMTP id d15so37214696pls.6 for ; Wed, 04 Jan 2023 13:15:04 -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=V2mmRSbNA08/uL5X+kgeGS/ZlgopWrLZQOgB2XOAgyQ=; b=FtYpbP6QDTs+0lZleCDk5ZEuYILk9YbbUBPUPSrk3Ld9sQDe/AXWgt1NFFEtyzVwVd 27XIJK2uMXpNSENtPUU9mTolqKYBkyqWBRgiNaPPr+6HKOkzRrfFG7vh51FRnD5XfrPm d3yU7xjojsyNe4TVkT6sdDculOxDV3WAY5LGCcI0ZY86e981vkbE2Keq4xL4jQlm+JDy 0+d7ZCBTlVPh+hBTPdMLgdJw4vZmFBuuPBlkVC18R54ZYLTjgjJSPd6APtzi8XuZocdm Vq+WqxTzB5n+aGbr09OvMJrslxbC/mLCAMYTELt30+n+Q7WR+zOqoKkaC27cWNkSuDUT 61uA== 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=V2mmRSbNA08/uL5X+kgeGS/ZlgopWrLZQOgB2XOAgyQ=; b=NzQemHNyQxTtMsBRIzKQzTtn7YlQTp35PzU4CGdAUeiCaTZLDYUCBvK+HaEtVZmO6z 4xfXkwoT3Mq5Vm5gwx4oM4gsBwpgS1M8GiYJTk7uLmrVBMu97yUTJy4EWWQh/WDUFDWp 5nmSOmoQigMatlLW/UDGHkfudvHJ+D4XlMeF9N3w2pX1/1B8QBJmkybl9SztPF0Bbwri vI1u7ORiu3kW5TSCU6d6rornejTNHuGw1vWy5dI0sPm6ppfiEjuFZID1oVd7Wyai3bTD NLHxviXQThGpqZmYZKCplPmz0VDcf7jG69GrQ7wtt3w1wNb6ERWfsDCgxYHBr/CyzbBm bfAw== X-Gm-Message-State: AFqh2kpRj/cLfxVUnYZQs2s7pS4YuCusGjBlfQVlASkj0NLtoKTlygef 2WCzEK06ioxmjtlfiMCC/6U= X-Google-Smtp-Source: AMrXdXsgqtpANtSCNZq+/gUhsOvEJLufITPz0tuKGVLeAke3wLXVvQoumIbsLoPmk9yfZKpeAUrvrg== X-Received: by 2002:a17:90b:2291:b0:226:43ba:54af with SMTP id kx17-20020a17090b229100b0022643ba54afmr18504817pjb.2.1672866903454; Wed, 04 Jan 2023 13:15:03 -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.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 13:15:03 -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 Howells Subject: [PATCH v5 05/23] afs: Convert afs_writepages_region() to use filemap_get_folios_tag() Date: Wed, 4 Jan 2023 13:14:30 -0800 Message-Id: <20230104211448.4804-6-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-Server: rspam05 X-Rspamd-Queue-Id: 8AAE116000E X-Stat-Signature: uigxr8rb4y7gqgtnuxf1e9e9qknedbx3 X-Rspam-User: X-HE-Tag: 1672866904-99405 X-HE-Meta: U2FsdGVkX1/cHiWz+osXAjFG9MoPd6eDcFIlDrhOjHtXL3NIsZpvDLgqXCXs7sUcOX3BGYrboATMXwTZL9uxDM6UnlbkC8sy5WCwbUwNmt5/rYdUTTfHBobA2aWFokiiaWky/zUrFO9eF1ST8HCRVAXecY50fZXhki9gw+JI3pyrIvDP4qLTUCFPsOPgiz4RsOd2lJRbwsaZCODZRA9Jq7ciHN0BKgvUwAmKEYbnGK9rfEVf1q0Vt7ncACGSvUooCtXK6GcEQgs+1bh8q7nab4G1eYI/uGJ9/gzFA+cutWL+SfbG0sVIKeNXkKKwsGWef8+BwiKNZ5Bm9JgBI3te2HHmmF5Yc88R09cCh1z+5nThoxOoERoT04T17kOaW1Pps7pp0HASsB7zEpzRrVgKPcSUZlyPSvK75lkXx8aSlu0QFd/tnZZkZcjAdn7cMKkwe5Ae2tc1vmahQHREIFHTZMoTs5nHQoDDs606nRFkPsIOUB5Ue1LsSiGexk3j/ADt/uOidACt5wo5uwCi3jUmK7EZbw/SB/fvIaIYBe60WkNQbSaRRCFWfhVULYkqJp6VkdrTSEn+L6bIXt1z5Rr3qLSPGy4pMvK7LPvTCz+ScupBhcRr9qIaUld1x5bNsy9QysFv2F7kwzbwcVlpw9kXULWBAS+Gma2h6IGkTOjGYObpmO40fhj4UkOZtsku0dVxTdrt4KxcYfXPI8RSnCqHTvUPD7V4DJ5+0d235asdg6Q8i6d7JHpqlxEgU4jNHch0R80uZZjr/Aldvy7biMHZQODu1rdY9F1rc9B67RquNfIDHTHMAmHKVWwZGTWcLBYbC8VQFKgr1Y7XvNrmCrmIa7Q9SSb+iaCdmmS9FeEgeVY+WvnmPmHQCnROWLm8szux1EIKbasNJmTMctSlFe95P479Vc2fiaXzhj2YMdKwlJjlI3mN6wL9eVgyzKgvOZExJhEkHoXgoG5OxzY81ze BdGT3K2t /pqAtXXScyt0hahRXoR8GExCIu4CmflkjAfkuq4BTkg9LzgiOFFgdxHrHF4bOlsoa4Vd+AgTPwCjxSEXYuTpWu+dCyEW2cI4qJ501829Nr7a/QBDQgGmOU4zsp3E5S+ZMZpv9vRd4ntw3ysg4tno8FBuVxCQzxYUI2EOjC22FHutgBfc3KYtyUWwHkBKHJ4voOvmfhepuCi03rZNCS1y1OqRsYdzb4wFlzaRxhIopO0fdAmWojgeaLdiHBOxEqOix2t+LGao68SPBTofB6jPREFW6k9qOYVyRokvC 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 to use folios throughout. This function is in preparation to remove find_get_pages_range_tag(). Also modified this function to write the whole batch one at a time, rather than calling for a new set every single write. Signed-off-by: Vishal Moola (Oracle) Tested-by: David Howells --- fs/afs/write.c | 116 +++++++++++++++++++++++++------------------------ 1 file changed, 59 insertions(+), 57 deletions(-) diff --git a/fs/afs/write.c b/fs/afs/write.c index 19df10d63323..2d3b08b7406c 100644 --- a/fs/afs/write.c +++ b/fs/afs/write.c @@ -704,85 +704,87 @@ static int afs_writepages_region(struct address_space *mapping, bool max_one_loop) { struct folio *folio; - struct page *head_page; + struct folio_batch fbatch; ssize_t ret; + unsigned int i; int n, skips = 0; _enter("%llx,%llx,", start, end); + folio_batch_init(&fbatch); do { pgoff_t index = start / PAGE_SIZE; - n = find_get_pages_range_tag(mapping, &index, end / PAGE_SIZE, - PAGECACHE_TAG_DIRTY, 1, &head_page); + n = filemap_get_folios_tag(mapping, &index, end / PAGE_SIZE, + PAGECACHE_TAG_DIRTY, &fbatch); + if (!n) break; + for (i = 0; i < n; i++) { + folio = fbatch.folios[i]; + start = folio_pos(folio); /* May regress with THPs */ - folio = page_folio(head_page); - start = folio_pos(folio); /* May regress with THPs */ - - _debug("wback %lx", folio_index(folio)); + _debug("wback %lx", folio_index(folio)); - /* At this point we hold neither the i_pages lock nor the - * page lock: the page may be truncated or invalidated - * (changing page->mapping to NULL), or even swizzled - * back from swapper_space to tmpfs file mapping - */ - if (wbc->sync_mode != WB_SYNC_NONE) { - ret = folio_lock_killable(folio); - if (ret < 0) { - folio_put(folio); - return ret; - } - } else { - if (!folio_trylock(folio)) { - folio_put(folio); - return 0; + /* At this point we hold neither the i_pages lock nor the + * page lock: the page may be truncated or invalidated + * (changing page->mapping to NULL), or even swizzled + * back from swapper_space to tmpfs file mapping + */ + if (wbc->sync_mode != WB_SYNC_NONE) { + ret = folio_lock_killable(folio); + if (ret < 0) { + folio_batch_release(&fbatch); + return ret; + } + } else { + if (!folio_trylock(folio)) + continue; } - } - if (folio_mapping(folio) != mapping || - !folio_test_dirty(folio)) { - start += folio_size(folio); - folio_unlock(folio); - folio_put(folio); - continue; - } + if (folio->mapping != mapping || + !folio_test_dirty(folio)) { + start += folio_size(folio); + folio_unlock(folio); + continue; + } - if (folio_test_writeback(folio) || - folio_test_fscache(folio)) { - folio_unlock(folio); - if (wbc->sync_mode != WB_SYNC_NONE) { - folio_wait_writeback(folio); + if (folio_test_writeback(folio) || + folio_test_fscache(folio)) { + folio_unlock(folio); + if (wbc->sync_mode != WB_SYNC_NONE) { + folio_wait_writeback(folio); #ifdef CONFIG_AFS_FSCACHE - folio_wait_fscache(folio); + folio_wait_fscache(folio); #endif - } else { - start += folio_size(folio); + } else { + start += folio_size(folio); + } + if (wbc->sync_mode == WB_SYNC_NONE) { + if (skips >= 5 || need_resched()) { + *_next = start; + _leave(" = 0 [%llx]", *_next); + return 0; + } + skips++; + } + continue; } - folio_put(folio); - if (wbc->sync_mode == WB_SYNC_NONE) { - if (skips >= 5 || need_resched()) - break; - skips++; + + if (!folio_clear_dirty_for_io(folio)) + BUG(); + ret = afs_write_back_from_locked_folio(mapping, wbc, + folio, start, end); + if (ret < 0) { + _leave(" = %zd", ret); + folio_batch_release(&fbatch); + return ret; } - continue; - } - if (!folio_clear_dirty_for_io(folio)) - BUG(); - ret = afs_write_back_from_locked_folio(mapping, wbc, folio, start, end); - folio_put(folio); - if (ret < 0) { - _leave(" = %zd", ret); - return ret; + start += ret; } - start += ret; - - if (max_one_loop) - break; - + folio_batch_release(&fbatch); cond_resched(); } while (wbc->nr_to_write > 0); 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) { From patchwork Wed Jan 4 21:14:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13088956 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 329DAC54E76 for ; Wed, 4 Jan 2023 21:15:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F3C6C8E000B; Wed, 4 Jan 2023 16:15:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E4F778E0001; 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 C54208E000B; Wed, 4 Jan 2023 16:15:08 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id A77098E0001 for ; Wed, 4 Jan 2023 16:15:08 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 8203FC04D1 for ; Wed, 4 Jan 2023 21:15:08 +0000 (UTC) X-FDA: 80318371896.21.05E23BE Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by imf11.hostedemail.com (Postfix) with ESMTP id D5FE54000B for ; Wed, 4 Jan 2023 21:15:06 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=E+BBLApy; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf11.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.178 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=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=WpQ0T1hY90TiWrye/zwz8Fk0gosiIhGGJdVRGuIm1GI=; b=uKSetJ5g506/b6e30uEds4I+fSd+FyAwaGn1/EzLB6eGkNTMadA+uo9PJpcDAJQC/WnEmP ddjnw8AARxVUVR5TKNlCf1ZbrGhk9tUAjLWWQWwhgfbP+c4AzO4M2hx436V44IfM20IKcM EE3ykQk5XVywA2jSBMESrliuJW/9Rzs= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=E+BBLApy; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf11.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.178 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1672866906; a=rsa-sha256; cv=none; b=aTyIXTwyBxVMj1Hz6uEKY1828Sv6lEFKO9BbvERXSSeuNgzCmN/P6S7X61mkXlo2aPRBkF kOmMAAO/huz1vcw3Rtk8k4M/AWQ2jH4keaL9mLrTgxZCPcvTYj12QuLv5v7rqWXlcJNgQa 7349Gcf8941Cz8stD8pel4R8mu5m8DI= Received: by mail-pl1-f178.google.com with SMTP id jl4so30936190plb.8 for ; Wed, 04 Jan 2023 13:15:06 -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=WpQ0T1hY90TiWrye/zwz8Fk0gosiIhGGJdVRGuIm1GI=; b=E+BBLApy3NOf4wopcmgQT3kNLqU1Hr79oQuMl3hR4qfUlPWmBHbnGAZdWjmWQ2sPqR KD3vqU0o08iqRQDMZ+Dx71Uxb6FKKwlTAVnatYSqFEFo2ql7zVbgfTN0jI5SnejCghpW Yp2dxAkOFXpIR/EP01TN2Qi1KZfVkx0gCM6uZyj6KEkdh1uwBHmlMJb1jYaj5mpjWFdJ YKq6x1i+oKVpuPiMkiFj7F6T2fVMDzxqmVK0DBQsS4p2ok35IbL+fj4QgWC5A6B2GSq/ rquvFqryD//D0fhKfDeCa0GAp4a8mm3vC0NMLAwoabxYnh/OEdzg2OeVrhSmFb39plUP r7zw== 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=WpQ0T1hY90TiWrye/zwz8Fk0gosiIhGGJdVRGuIm1GI=; b=4Ipvd71IOsfrdaMyTnVnJVQEMyMltcpWnr1nsWKUzeGN65Wf5qZ1AT80Uc7NpaZCVY iWgoNUy65WjHSXjTDdLi4SAc6cNPrLyeWfyYz9OVZNjQNAgYsoGgck5+ycaUgo276lFM zFGw/pUSxiB6/Xf48xYoKlHs67xF8ohz9fN3usLibbO+e1aMHNZUOgpTOGyRvbcxXjiC atalsa+ewoGzMJqOVaW9LIRk7aXowT1NA70KnPV8HLgMhOlQdliUhkdlx5pm9xp3kuBr sOIpDCP8a0JCTsIbW21tQZFBbF6DNCX6Y0ENAKUe/wkUctmxGIi1azA5IhaIS9Z9V0qF +6eg== X-Gm-Message-State: AFqh2kp4eQ4pW0WBIH1YQ5wGhzgziurgQoGcahUwcygi2DuPKApf5PP6 LsrcjZ9ohXoxBkrGpGN/7s94IvKICnJJFw== X-Google-Smtp-Source: AMrXdXvMceiLQv8Bi2VTCFImf53/8/DB9Gj8r1k+O8qLsqokGEHS38Bc3wLTcycpGKeKQBiAhwaRsQ== X-Received: by 2002:a17:90a:fb87:b0:225:d81f:d463 with SMTP id cp7-20020a17090afb8700b00225d81fd463mr43386479pjb.26.1672866906363; Wed, 04 Jan 2023 13:15:06 -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.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 13:15:06 -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 07/23] btrfs: Convert extent_write_cache_pages() to use filemap_get_folios_tag() Date: Wed, 4 Jan 2023 13:14:32 -0800 Message-Id: <20230104211448.4804-8-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-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: D5FE54000B X-Stat-Signature: 7enzgx9arjj859qnmdsreeh5dze4a4sg X-HE-Tag: 1672866906-829942 X-HE-Meta: U2FsdGVkX1/qqoiU/nOnjP1liIBtn6hbBP8OYAVxMrLxMWSVer0RBEiFGXtCJ2gIzWP+BD0j0evtmMWJTby8TJ3wIgir1CSQVNCmKMdhQmaQEduSnzJHUB2p5rYUp5QwiA1z7wl/reafsybJSs34ruTCJfKvKfbRGCxb79UgEcQSfRljG7iJlfw9nlVm+6HYK9dgT0hJOQl3xLvUJHUhyKsATmxzYQgicXDY8fMaoNkJaA/VWmsBzffHNRXgchNBzUgHw8zJM42xqHhpuUMK3wGU2JoijFGs81rlp/jqLhAru1kujT59/+dejG2/gTp1Fiwjl1br7RJMcP03R5c4Fz7T+Iz7qEtMjuAx5hsNlKBsPAHaeXLfrFsWO/mznseJ7p8SbM4GiT8OchYIC9QqnAfI3qTaLaDj8VAENvCTEn3S6MhCNMkQH2iGqddYvwe60HVOldPyqI/AUonbh53hILd5SGY5CWMCXWwYKdcjGyaiw59Cqs1TxfpUMVUXH8OwclqdP+15BPdjVoxrI1mp0G08F2Scus70aJ/z/YR6qf9o96MLk6nwsq5/gnGpQGL8/Ue/86gBnpjex5VI9i/jniFDTeIAsJi+aFK/EgiTGAApaaRsHwSFLbc2y5/bsgw8fA/7KgAD/m4WZCuBu497QyWSp2HWQg18Y0XdAuKvaPpfmffeXq0q4+N1veTSfmns1VblqL5zp1nlFgcpN4QPS4z5eC6XpJuta1A893txB9UP1otiBJpStRT/BpWxhNa+7XKHszTNyhuMGm+0gvZPKgxWDuAoROJB34X1qyIXS3Of+OoMFo9/h5HqjNhYAFe8ZNpZPoo0aFMS/BxoYs4ePNNq0VtS7k2YJiWRuQ8uMQGqkMYfy99Jk5fIyF81nRdoVtiGy1ICyt8wxaQJ7RwfYBqMxGLp8VE8Hn0a7uG51wUSWOL+7ZfjZz1/KmAa0fk/3PynGzKgJMSQ1+w0zdu 4NGPRpys d86C1ez81uCEFelQHHqgdmlB7ZL+BTcTL0agJK9Ru3BQVJ9Zv/7zq7AvhbunyZPmIzNCOZnrnda5ql4UcAosm72xuICArE92jwEOfuiq4zNBAPFcnZIIhOHgAmU70xToXUoYcwaaKBbTTl1eacZ0RoYsYCwYCX8bPktH5k+EDyBG+ZNILV4BksQ8kGUPRxw+XLO4rw4raRAuvqeWJyk2JgVJMCG+QrHgSo7IJ3ksbIxONwhvAY2wU38R9zfm3vx1FxG4670Hi4mkhkeX3vKjz/O78ZJFW5/m7SaMj 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: Converted function to use folios throughout. This is in preparation for the removal of find_get_pages_range_tag(). Now also supports large folios. Signed-off-by: Vishal Moola (Oracle) Acked-by: David Sterba --- fs/btrfs/extent_io.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 64fbafc70822..a214b98c52fe 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -2973,8 +2973,8 @@ static int extent_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 */ pgoff_t done_index; @@ -2994,7 +2994,7 @@ static int extent_write_cache_pages(struct address_space *mapping, if (!igrab(inode)) return 0; - pagevec_init(&pvec); + folio_batch_init(&fbatch); if (wbc->range_cyclic) { index = mapping->writeback_index; /* Start from prev offset */ end = -1; @@ -3032,14 +3032,14 @@ static int extent_write_cache_pages(struct address_space *mapping, tag_pages_for_writeback(mapping, index, end); done_index = index; 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]; - done_index = page->index + 1; + done_index = folio->index + folio_nr_pages(folio); /* * At this point we hold neither the i_pages lock nor * the page lock: the page may be truncated or @@ -3047,29 +3047,29 @@ static int extent_write_cache_pages(struct address_space *mapping, * or even swizzled back from swapper_space to * tmpfs file mapping */ - if (!trylock_page(page)) { + if (!folio_trylock(folio)) { submit_write_bio(bio_ctrl, 0); - lock_page(page); + folio_lock(folio); } - if (unlikely(page->mapping != mapping)) { - unlock_page(page); + if (unlikely(folio->mapping != mapping)) { + folio_unlock(folio); continue; } if (wbc->sync_mode != WB_SYNC_NONE) { - if (PageWriteback(page)) + if (folio_test_writeback(folio)) submit_write_bio(bio_ctrl, 0); - wait_on_page_writeback(page); + folio_wait_writeback(folio); } - if (PageWriteback(page) || - !clear_page_dirty_for_io(page)) { - unlock_page(page); + if (folio_test_writeback(folio) || + !folio_clear_dirty_for_io(folio)) { + folio_unlock(folio); continue; } - ret = __extent_writepage(page, wbc, bio_ctrl); + ret = __extent_writepage(&folio->page, wbc, bio_ctrl); if (ret < 0) { done = 1; break; @@ -3082,7 +3082,7 @@ static int extent_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) { From patchwork Wed Jan 4 21:14:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13088957 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 1B004C54EBC for ; Wed, 4 Jan 2023 21:15:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AF7418E000C; Wed, 4 Jan 2023 16:15:11 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A7F848E0001; Wed, 4 Jan 2023 16:15:11 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 834A88E000C; Wed, 4 Jan 2023 16:15:11 -0500 (EST) 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 6BCC88E0001 for ; Wed, 4 Jan 2023 16:15:11 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 3CC7B14053F for ; Wed, 4 Jan 2023 21:15:11 +0000 (UTC) X-FDA: 80318372022.02.2CA825F Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) by imf04.hostedemail.com (Postfix) with ESMTP id 6B01B40012 for ; Wed, 4 Jan 2023 21:15:08 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=ANmSn8BX; spf=pass (imf04.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.170 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=1672866908; 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=wfZkCFUzCyr5OXa7ytE85YOM9f5TCt/N2uJtwdJBiOM=; b=lecJV9tMeV5Cdx8bZoFq7VY4hke7jK6YxJdNePSjdCcSMbVbS2kOucqla4A1xlEr4v7haP 0TOAj5VMjLwxncqjoOgCFMBhfrPrkur5ci1UzkEF3AzpVMaAkIEOF540bWxtFZoCUyhQey lALXD8VAalXr1UZ0vINPpt77wtRmsI4= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=ANmSn8BX; spf=pass (imf04.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.170 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=1672866908; a=rsa-sha256; cv=none; b=J3M4+auDJ+zEKyUDwBhla783K45HR+4zVPnT+Jv0uspKdG8op1gOOG2hiE4ezTPj07CVFT dB1jXZK//DJxda3Y4hUAOffUOLeBmHuD+Era8yxMG9/M56tQmtBlJBhQtBjtv4Rs/ke5J5 ORRkvYpuJ4oNpOHkZIwaP5RYt2cQmxc= Received: by mail-pl1-f170.google.com with SMTP id d3so37194760plr.10 for ; Wed, 04 Jan 2023 13:15:08 -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=wfZkCFUzCyr5OXa7ytE85YOM9f5TCt/N2uJtwdJBiOM=; b=ANmSn8BXHVDz0ywhmRcvLuF8DmLMxQ93lpCBxWPoHvl/LSFXfzY43Ai3sHGITPHyQv UGZzlKZDcI52wvQqJokP4vvvyYwFacbOTKHFKBLZTgqtGB7SlcKPR1/yEL1Rk/1RY7FV tlrzh6yP+L+Y3+ZGkeUhuel3RvMqL9274p714tcLuggAYT99ceFPsKAH/YBG+2giTF1e eyw4SncaR+Kt5OfkjfrFa7F9COcHovEDwjB/dlalyP7DZPUQV2SabwF4hhl1H5GEIbyF 4m8vBFV3aeKB/xxOyyrXqMrlT7asP5ajHmmGEgqtrEunzP8BT+cK8xe4xARR13Gku/PW jpgw== 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=wfZkCFUzCyr5OXa7ytE85YOM9f5TCt/N2uJtwdJBiOM=; b=kZhlIH+1RABDoi47i6zSsv06B5eUR6T6+km5fc/xJU2eAFrTZ0T5eedtms00G+cOWE ncCgrTSQYVgp0rV6zi98X3ljq/rfqKCb/p0ffiwnINUgWuKIv8T26j2W+V/0TjXFI2Jb Sop5mxzY8kL7gwXDWWePqGwD0L+eJ0ef2KPq2mpWCuOLHFvFwzyUscI7TwdEgoO6/JGN 1rd8iGXKkJ4GxzY7E9+q8iGfFTAzeYIwuPiuWaKuaTyLeG3RkMy8Or5cnLq/wbd0+bFL V9kQKlu1W9LCZqE8bqkuCI7MfKnozemUZ4h6dF8qsb6ww2Jw6nCuQApyUBIUJwwFY4is 9PWg== X-Gm-Message-State: AFqh2kqLZVOCwfCvsYOtfRVbPtZZMiscmA8EyR2ARBcEfOUKTY7PSLGa eMkbiAIhiRVA6jXdzwXcrazmSQNwRU6SJg== X-Google-Smtp-Source: AMrXdXtAkt1PiXf89KpZT/PVVs6pHX6w2TYw+klecmBeo8HqViRecFRkPGwHQvT7jR7OxpCa8lhGxg== X-Received: by 2002:a17:90a:5d08:b0:219:4578:6409 with SMTP id s8-20020a17090a5d0800b0021945786409mr52643871pji.41.1672866907758; Wed, 04 Jan 2023 13:15:07 -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.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 13:15:07 -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)" , Jeff Layton Subject: [PATCH v5 08/23] ceph: Convert ceph_writepages_start() to use filemap_get_folios_tag() Date: Wed, 4 Jan 2023 13:14:33 -0800 Message-Id: <20230104211448.4804-9-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: bb94mgrody6kmofbjbj9urmq3fmwtoxo X-Rspam-User: X-Rspamd-Queue-Id: 6B01B40012 X-Rspamd-Server: rspam06 X-HE-Tag: 1672866908-165049 X-HE-Meta: U2FsdGVkX1/YTAmoFi8wri+AS8BOd7RUsaEB8oEMT4O20qZPtvD3Xh27BpwQk+3Nod5WDMQstxDCWAwfyJTLM8k/MJ6IMj9qQ1/jeoovuWIlxW9qGsqkzjqsZhBuR0xNUHFnPiHVTKB5pJ1tX59/d6t6bleQ9NZjnDt6SKZjOXEf0dhxwxoiHB3uWEnQC21NebIjNNPo03Ow+cJt4eeYWNRmkx0RjYRcQ5l3mZVfqtM7auLJKdbqpey0WGdVy8BLAzwy8+zFdfPdwmxR/YV7MVPX8ofMo7w9HFI/ZKueRL/clEbW5kqSlxiKvYLpmQKxb/BszjezW1v5fIPCMSwME6sW44BjnuoyUwXEVq4udPPAqidWuZGxtO0y7hGSe+6akBEiiITI2e5RXpCHh2364dnmYOWd4yCIYFn94kbXvvaEblnW+gI45A3kccno6fGsicIqIQ6613u3BeV/ASmpUQe/YFIk0WRVN4rlFlVRK9EzDF74CeTzp2luDc32diKTUvRqsH8CX/+mPWw0IbriQyUZOvM2y+t0kXEOD6DqkNZgLrtnfB0TiQXHD4ag1LCiQpgA88H1d4EpHXuIQ1cBEg7HHjft3Zre728ed+hseasOUxjPKMMYoCSf4BL6BbGSHPpICUkURdZdmVC47apErWYRSW35fPtskysyBkLWW5zoeG4GplMP2xYo02ANii5yyVeVh4JXwUeZ7NCHzoJTjES9FtBLZZM2QJHUMKsK8J8yqqXkl6ZwCMIIVYzxGP9fXOtpHQc55plJyzKTnMA+Bn8JE6JdmRfaJmdVmBDdNEBSb7SXTQMXmihfeSYzp2Y+Il74q0YquVi1uYVLM2uNrtSrCp3qC+lak05q+2XRMNL8MjVnpAvy8rAgNrHwhebm/nZaLj7ktT+fepY8BwSd1nA7C/wef63vrz1QHtCCR6/XZ7p6Yoibo0tu5sVImcOZQMuq46Gdlkz908Euww7 cNHbSapK wRHVwIuHT4vRmw0XYsgdbYAG3zO6eTjc6Rt18tP79s4dmVeXYpbPPDPK2HKjq0Yhc1GmgIVhBQwo5WAByuNwaTxEWyIhect0G/ngu9Y/fZbWsg9rG00wKAGpilRkkNw6UEKpKRddNXMbUKDJ03ctgzg1CgYKpLoi7jIyOmlqa1DnFNPGaEcLi7EdxzOAoD+ucJZkqYHoq2cKj3ooiHXPaE3qlqDZuVPpSokTWdgzGzWyCToeZEGg5HqyRKhqYzCkOIuZAATbmNYxHRB3VUuux67Z23oI62KNVzKuA 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 a folio_batch instead of pagevec. This is in preparation for the removal of find_get_pages_range_tag(). Also some minor renaming for consistency. Signed-off-by: Vishal Moola (Oracle) Acked-by: Jeff Layton --- fs/ceph/addr.c | 58 ++++++++++++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index 8c74871e37c9..905268bf9741 100644 --- a/fs/ceph/addr.c +++ b/fs/ceph/addr.c @@ -792,7 +792,7 @@ static int ceph_writepages_start(struct address_space *mapping, struct ceph_vino vino = ceph_vino(inode); pgoff_t index, start_index, end = -1; struct ceph_snap_context *snapc = NULL, *last_snapc = NULL, *pgsnapc; - struct pagevec pvec; + struct folio_batch fbatch; int rc = 0; unsigned int wsize = i_blocksize(inode); struct ceph_osd_request *req = NULL; @@ -821,7 +821,7 @@ static int ceph_writepages_start(struct address_space *mapping, if (fsc->mount_options->wsize < wsize) wsize = fsc->mount_options->wsize; - pagevec_init(&pvec); + folio_batch_init(&fbatch); start_index = wbc->range_cyclic ? mapping->writeback_index : 0; index = start_index; @@ -869,7 +869,7 @@ static int ceph_writepages_start(struct address_space *mapping, while (!done && index <= end) { int num_ops = 0, op_idx; - unsigned i, pvec_pages, max_pages, locked_pages = 0; + unsigned i, nr_folios, max_pages, locked_pages = 0; struct page **pages = NULL, **data_pages; struct page *page; pgoff_t strip_unit_end = 0; @@ -879,13 +879,13 @@ static int ceph_writepages_start(struct address_space *mapping, max_pages = wsize >> PAGE_SHIFT; get_more_pages: - pvec_pages = pagevec_lookup_range_tag(&pvec, mapping, &index, - end, PAGECACHE_TAG_DIRTY); - dout("pagevec_lookup_range_tag got %d\n", pvec_pages); - if (!pvec_pages && !locked_pages) + nr_folios = filemap_get_folios_tag(mapping, &index, + end, PAGECACHE_TAG_DIRTY, &fbatch); + dout("pagevec_lookup_range_tag got %d\n", nr_folios); + if (!nr_folios && !locked_pages) break; - for (i = 0; i < pvec_pages && locked_pages < max_pages; i++) { - page = pvec.pages[i]; + for (i = 0; i < nr_folios && locked_pages < max_pages; i++) { + page = &fbatch.folios[i]->page; dout("? %p idx %lu\n", page, page->index); if (locked_pages == 0) lock_page(page); /* first page */ @@ -995,7 +995,7 @@ static int ceph_writepages_start(struct address_space *mapping, len = 0; } - /* note position of first page in pvec */ + /* note position of first page in fbatch */ dout("%p will write page %p idx %lu\n", inode, page, page->index); @@ -1005,30 +1005,30 @@ static int ceph_writepages_start(struct address_space *mapping, fsc->write_congested = true; pages[locked_pages++] = page; - pvec.pages[i] = NULL; + fbatch.folios[i] = NULL; len += thp_size(page); } /* did we get anything? */ if (!locked_pages) - goto release_pvec_pages; + goto release_folios; if (i) { unsigned j, n = 0; - /* shift unused page to beginning of pvec */ - for (j = 0; j < pvec_pages; j++) { - if (!pvec.pages[j]) + /* shift unused page to beginning of fbatch */ + for (j = 0; j < nr_folios; j++) { + if (!fbatch.folios[j]) continue; if (n < j) - pvec.pages[n] = pvec.pages[j]; + fbatch.folios[n] = fbatch.folios[j]; n++; } - pvec.nr = n; + fbatch.nr = n; - if (pvec_pages && i == pvec_pages && + if (nr_folios && i == nr_folios && locked_pages < max_pages) { - dout("reached end pvec, trying for more\n"); - pagevec_release(&pvec); + dout("reached end fbatch, trying for more\n"); + folio_batch_release(&fbatch); goto get_more_pages; } } @@ -1164,10 +1164,10 @@ static int ceph_writepages_start(struct address_space *mapping, if (wbc->nr_to_write <= 0 && wbc->sync_mode == WB_SYNC_NONE) done = true; -release_pvec_pages: - dout("pagevec_release on %d pages (%p)\n", (int)pvec.nr, - pvec.nr ? pvec.pages[0] : NULL); - pagevec_release(&pvec); +release_folios: + dout("folio_batch release on %d folios (%p)\n", (int)fbatch.nr, + fbatch.nr ? fbatch.folios[0] : NULL); + folio_batch_release(&fbatch); } if (should_loop && !done) { @@ -1184,15 +1184,17 @@ static int ceph_writepages_start(struct address_space *mapping, unsigned i, nr; index = 0; while ((index <= end) && - (nr = pagevec_lookup_tag(&pvec, mapping, &index, - PAGECACHE_TAG_WRITEBACK))) { + (nr = filemap_get_folios_tag(mapping, &index, + (pgoff_t)-1, + PAGECACHE_TAG_WRITEBACK, + &fbatch))) { for (i = 0; i < nr; i++) { - page = pvec.pages[i]; + page = &fbatch.folios[i]->page; if (page_snap_context(page) != snapc) continue; wait_on_page_writeback(page); } - pagevec_release(&pvec); + folio_batch_release(&fbatch); cond_resched(); } } From patchwork Wed Jan 4 21:14:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13088958 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 7FECFC54E76 for ; Wed, 4 Jan 2023 21:15:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 48C058E000D; Wed, 4 Jan 2023 16:15:12 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3ED868E0001; Wed, 4 Jan 2023 16:15:12 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 267898E000D; Wed, 4 Jan 2023 16:15:12 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 176C88E0001 for ; Wed, 4 Jan 2023 16:15:12 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id E2C7A1A06AB for ; Wed, 4 Jan 2023 21:15:11 +0000 (UTC) X-FDA: 80318372022.27.ED315F0 Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) by imf01.hostedemail.com (Postfix) with ESMTP id 39CFF4001A for ; Wed, 4 Jan 2023 21:15:10 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=V1E1lT+8; spf=pass (imf01.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.171 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=1672866910; a=rsa-sha256; cv=none; b=POnFZarJ8IhgTBU8M4Jmes1AiWUuEsi5jD36cNGCaMJVGwBorclc5TrIDRx9z7YF6mjZv3 nq2iBsZSCkjcZams2F2CaxpkpxN2kJyKnZVTMJ+o7NqI2gwZ2xl5yygi0XVE5GrWdJ8IJF hDiaUdgRiTYSAbAsWKc5HySS6zKS080= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=V1E1lT+8; spf=pass (imf01.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.171 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=1672866910; 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=o5rMPwcVI+xSSROnSv680xsAXd0L9APPXdNmyKQVwfk=; b=77RqKsBk+5qh9Z2nrn5mOLtJE8lv9hl1guT17/JTCve+9foZAv0XOuk5mJX5vm8S9kvTEI WgVbUqTJ4wVnDxLLEG3Ogxq4MmWpXVSlWECfZ8dFWGRGgsgu2n28575JhiOsPfOPAS19vg ESUAkmf5m4rbwknGV1/LtBo0fSK2YgY= Received: by mail-pl1-f171.google.com with SMTP id g16so27542143plq.12 for ; Wed, 04 Jan 2023 13:15:09 -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=o5rMPwcVI+xSSROnSv680xsAXd0L9APPXdNmyKQVwfk=; b=V1E1lT+81O0Bma5i45Jhgrf33b8ZyAtb2k6sBn232f4UkEzENvpQBKf03VCx514eGY A6/X8hia12tEOrxhlqm2jbfpueF7iUxDQK73Qfx/HnU0C1qeC98Y/FJf4DdEA7/pzkhJ 0R9L0J423oCq4U1iJLCVDadB2Wt5+nvV5hLoYRWJbhwd1xBn6WpVA0bJU8YE7e7wpuN2 7595aSPavZoug9A+uF4GQmMXauKv9jF+a45BkfZqX76YcFFkYKhW2/vAA8fJsRJSuef8 gAsMn3ncTXpb8uuk1BimZcT4C8iNt/aS5nfn00OIYDqHLLwCBHXgWFjBa8QQEThwOWQl z5zg== 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=o5rMPwcVI+xSSROnSv680xsAXd0L9APPXdNmyKQVwfk=; b=I6Z0l+sea7FPkU9TqqqkqM2UfDrQtP3jN+YGSJTm5qfMnnqO60PVT/j5kQeV+Ydl/M 4XUZ5UhHLTrwGZFX1c57rqEITuwPObG67AS9oA7juKbIBJF8w8GvW1ERTuKH8zz4dXPs YVd1a/pBii3ECuTW7cEhBfaz3Y3OIWY3kr2foxbjJ/GT8tERsttJm5KCLkRYsAuC12Nb 1E/iqJEajJrkoMCS/Kj+cCCvCEw+x4f8hUNV38LCsM70Z7i/FnTab8Fw2R1zsCNKXZOA w8hEVqfy2PpiWYFr6RT13po8i+jywg5G3mEX37cOK0p8+tE0h8JKHqSnaMRRRUfPE1lj FqGw== X-Gm-Message-State: AFqh2kpuz+MkhlhShjp6szTJRLQEP9Aw3Xe6b9YfYZLCVj8K9vKff89b XRT/0gAbsMlmL1imcNI5HEM= X-Google-Smtp-Source: AMrXdXu6t3Nt2/819SMAwDAr2w3gRs9/WxQKALxtb70CxJaSaRfG2mUZCKyO3UNaiTmg39rKgXBHzw== X-Received: by 2002:a05:6a20:cf62:b0:ab:ee20:b003 with SMTP id hz34-20020a056a20cf6200b000abee20b003mr46906430pzb.14.1672866909161; Wed, 04 Jan 2023 13:15:09 -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.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 13:15:08 -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)" Subject: [PATCH v5 09/23] cifs: Convert wdata_alloc_and_fillpages() to use filemap_get_folios_tag() Date: Wed, 4 Jan 2023 13:14:34 -0800 Message-Id: <20230104211448.4804-10-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-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 39CFF4001A X-Stat-Signature: qku3p8aw3nc9w43bph5y4gjewwrh6d3m X-HE-Tag: 1672866910-750925 X-HE-Meta: U2FsdGVkX1+pWxIs+J21nEdZJ8DfrYqBbqZutwm5xD9T9pobSS2zjNy4+ytKDyBNOR6GVgGSKaDYwjFJmSZ+lSysQQsVsDoXm2WGeKhhBQvTgEm6gey5afWsRwp3YKMQk/RCmVFM3LfpanXd5A9cyZ/UHQB4WHYiXFeuYHexQpjdhGZ16gt7mNCfhKs09qSvH7aHEhSCLTIA8T9VXoj0K75/wxEw3WTQR8z2dgyQRJdOtj4oTAt6uKq4PYqnQQhXw+SUlj0KIK2mlcztJT7eNXLKpKrgnPPTO03YiJ7VobBtlIE72BGev3ymS8dRz4r2OLsowWobGW4WPBDEMlfmAtCJ/K1fymkrNAvb9q/2S4Qe7nvzfwfo5oqskkbLMOK9jyEm98q2u6vlnGJsbZbSxyQKNlzLOfUER7asYxRwMfT3WQk/dbZl7/g1pmFecvJJnrFZ8gMnwBrJiFQcV7RzT9MM3dzebn8B2iWcya45LPqwrmJV0LhqeHJkYiLVINF+nOvgGc9cEBb88jc9sEvPLpP8LQMCZzznzYS3mU9c/kzKOScJ3va+nkmQU5BZ5e//ksgQCT9KcBc9nmBK9t4EJVbglVHd60gEa3aHSikaxxHKXbrmFAdx5i3bxjWhZJsEbfu2ePOjKqBHRFDnRy4vVVRZOeFbGVb955naxCZkbw2HFz7JZhuVE5FHh60V9I/DlmAui3FFN33FfuW6g1tP+5rfHGtU1cxfj+pEWEIKT/llnNACYnWAQ9RfVHaLZJNVWGg2BSaZgxz1Qa4NKFqHIX7irxpxbwRK6VZwto3GBmucFn13L76i/mdWjuPrVqB7Y9Eni7Q8gWCIAybAWTua6WcerwJlewhwSWu3g6BsI8kkN23XU7Rxil3emrYE1uXZQWzEGAf6ek4GktEpT6cs7tMgO75Scp/46ZvkPCEta52lHEVHO1X5DvY9Ruu6XHhv4D77l0wl5RimiSttCEG NsEAzoYi MDcYmWyRQWbZ+cXy6ty55SYwhbEx7ClPoYTlr7SqGexsfvjU/dnQplLUh3brBsmyk/YCbixb9BfGlfBhYsxGpO1iElGd1N/bCTykAxZbvV5MvX6JPq5OHJ8GVSWQtTPkOFcvr/Gugbim5W6hVHgevYyUCYqBVEIx7pIKscRsvq3DE72RvNfLe3Kdo7PLPl/NLHAFP8S7Gn1xK1q6/xMHQfKgiq9ez0Kp1j0luXSckEyb/aMum5FNCSLeqkYYG4H2O5UqRhI/o0wvY8nfTzs5FBm5mFhKaOG57gUWj X-Bogosity: Ham, tests=bogofilter, spamicity=0.024659, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This is in preparation for the removal of find_get_pages_range_tag(). Now also supports the use of large folios. Since tofind might be larger than the max number of folios in a folio_batch (15), we loop through filling in wdata->pages pulling more batches until we either reach tofind pages or run out of folios. This function may not return all pages in the last found folio before tofind pages are reached. Signed-off-by: Vishal Moola (Oracle) Acked-by: Paulo Alcantara (SUSE) --- fs/cifs/file.c | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 22dfc1f8b4f1..8cdd2f67af24 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -2527,14 +2527,40 @@ wdata_alloc_and_fillpages(pgoff_t tofind, struct address_space *mapping, unsigned int *found_pages) { struct cifs_writedata *wdata; - + struct folio_batch fbatch; + unsigned int i, idx, p, nr; wdata = cifs_writedata_alloc((unsigned int)tofind, cifs_writev_complete); if (!wdata) return NULL; - *found_pages = find_get_pages_range_tag(mapping, index, end, - PAGECACHE_TAG_DIRTY, tofind, wdata->pages); + folio_batch_init(&fbatch); + *found_pages = 0; + +again: + nr = filemap_get_folios_tag(mapping, index, end, + PAGECACHE_TAG_DIRTY, &fbatch); + if (!nr) + goto out; /* No dirty pages left in the range */ + + for (i = 0; i < nr; i++) { + struct folio *folio = fbatch.folios[i]; + + idx = 0; + p = folio_nr_pages(folio); +add_more: + wdata->pages[*found_pages] = folio_page(folio, idx); + folio_get(folio); + if (++*found_pages == tofind) { + folio_batch_release(&fbatch); + goto out; + } + if (++idx < p) + goto add_more; + } + folio_batch_release(&fbatch); + goto again; +out: return wdata; } From patchwork Wed Jan 4 21:14:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13088959 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 2BA9BC54EBD for ; Wed, 4 Jan 2023 21:15:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BE6EE8E0006; Wed, 4 Jan 2023 16:15:13 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id ACC808E0001; Wed, 4 Jan 2023 16:15:13 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 946648E000E; Wed, 4 Jan 2023 16:15:13 -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 8537E8E0001 for ; Wed, 4 Jan 2023 16:15:13 -0500 (EST) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 518041602BF for ; Wed, 4 Jan 2023 21:15:13 +0000 (UTC) X-FDA: 80318372106.13.ABFCD12 Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) by imf28.hostedemail.com (Postfix) with ESMTP id AB70DC0019 for ; Wed, 4 Jan 2023 21:15:11 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="O/D+NyPT"; spf=pass (imf28.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=1672866911; 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=bHssniIq+RlTj6I0G4i7GbLR9EaGoRL5pu7+dnl0w2w=; b=19FIDFimQu6PM8auo8jEzY2purQ77IeIEGCSg/+jDcqYCbOVVt+JN7NCO30pECRPxeVQ8q zAYpkx+oos+hDF7QYyZpZkz2b1+ZIblKB5bxCwLW9sGbmiOvnUN7Q5qLux3saA6ayq1Gp2 5zPU32QRQcvrhiD33X5s/7F5zx65fA4= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="O/D+NyPT"; spf=pass (imf28.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=1672866911; a=rsa-sha256; cv=none; b=fvJaCMiGr8MgKRaXcpQktb89r9nh4zrrA9WK8uy4NIiQVNaMDZ11dW8AkTKeNZyMjN+NDN MUmOeskCN+DRnEFnYwvVYodr1pwkNVHCgBSA5IGg4TS/X+l5JPLeywQy7UagwmXBqo4u0v vTEp61FqsM9Vgi0oL2MNc0ueNTfII/c= Received: by mail-pl1-f179.google.com with SMTP id y1so1704606plb.2 for ; Wed, 04 Jan 2023 13:15:11 -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=bHssniIq+RlTj6I0G4i7GbLR9EaGoRL5pu7+dnl0w2w=; b=O/D+NyPTy4M1sTh+3k/lC1rj/VKJWtCGwMlhTfn6qpBhtlxCb9k3sWDk9Z0oOhWhza 3YwunlQmpmQxHIwc3slP5cWFOfArgatFhNuDOerJW0qUBaI5Zgn5t2tO2YQmHBKWt0/g MFSh/uQIxzlLLmgNa+OoXc3BzfvnfBPdtpNgXKui16mDPVeraZQtRKVUTS73rT71TPkz aIA4qX4NfhLb32N2QF9lXy9drDX9/rkV28NsYpAoVy0G5yfIgIIv+sWh1wOSNzvEDIG6 wJ4oTDHW5KSfgFq7up1/6mIHSjyF7qj/i6841phIxUGWM6AsJ76lWkCXX+vMLrxxAo9V fPYQ== 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=bHssniIq+RlTj6I0G4i7GbLR9EaGoRL5pu7+dnl0w2w=; b=5h+92ESVhNac1XA2Eus04bhFdAJqkpWatZYkUp/LVO/5WkuT0X0ZmC+DenkX6v5FWK nN8NTGPRAikjvKTy87A30WVFmJ7WVtGSFMBRTaRnff83v2Vfv5jQee/VDl8ne6+jDUz8 Gte2slxs/V1WsOo2dK4WldnNjQh66B/dKgjxalQrETXT41U8QSktQ3GJSAFuqYXQQF2T JuFeUT3l1StaPAI+DUp9k4vKOxmhgyXOWmi3yClEg5qsfJp4Ao5oy37BUllj3TVCLX6e BCp+5D6gCiQbKFq9PCbLyTYlGJhWbXL7h5B/v9Cb5qabP915MPtLV2m4guRtKGwqN7IF UssQ== X-Gm-Message-State: AFqh2krAT3q4UG3VuOrL6UmPgnvD6kwIb+XK3OrhnXmD2+eEd79naZ5u ALUUMx85//8a+snmSZhcdMI= X-Google-Smtp-Source: AMrXdXvz9PRTiN1Iw35FsCYmgqPK+8WXm1LuX9COnFA/dLcxFRJCp85h7YOKjNSg0G/oIOwdsOogTA== X-Received: by 2002:a17:90b:3793:b0:226:744:d46a with SMTP id mz19-20020a17090b379300b002260744d46amr31270463pjb.41.1672866910524; Wed, 04 Jan 2023 13:15:10 -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.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 13:15:10 -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)" Subject: [PATCH v5 10/23] ext4: Convert mpage_prepare_extent_to_map() to use filemap_get_folios_tag() Date: Wed, 4 Jan 2023 13:14:35 -0800 Message-Id: <20230104211448.4804-11-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-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: AB70DC0019 X-Stat-Signature: 8aqdoqbhf4fwtqxoakbgyhhyudr9u1su X-HE-Tag: 1672866911-153481 X-HE-Meta: U2FsdGVkX1/+zXcE3G6eB0mjj8WSHnQMNzCDVuRDkpuDSjzojoJLZppfOtCS8ud6h3S/XdeLeDW6S2SOYncmXZjIK/lsadAEonVHBQGGmn9qHNckK8IDoGrCEwLIOIDTcvGtU6YZVXwH1/nyv6FqEpaG4h4sCfqRytjrZbVrP70P91PmC2Hmib4iKuvLx+pEwKP7Ez6eLc0KOFuicom58l7m6qshHKeSYmfr9CJR8fRAUhu2YLMYBSQdYhbBmhsikiYpGUg345Wc7o6z1qqhwID1rAfWGw2EKj32xQxyBmCu2BRTha3ao6jksBS6LTcLrHuBRunDTrKgwZKB79fDD1yDJmII/GrCBJDK1NbqLDWue6XwAc81DPSbKiG75g9EC0uPwnRiiJCFHFUou2ds8huMOfbES32bDrEkNpqm5qceDGDAUE9KbNEzUfW6lMIgbVpHHdREzB/+Rr0I12FFWDiEPx0kt5w/v1k3mJoj5efWT6GzRUSKPSCgJOitHDLmPcbvvjII2KQ451KABTPZUx4WKdybgarBX27EMV3RH0uJ5/ctfcF9xzSwL5MHKADoJUJ4Uq5HbxfI4c2wj5Fk123u54sQhxJSP0/ksAzT53b2fEvEXb2bSYa1VYzbwKOjyodBM/7bWrOz2dN4SNGXTqycnQr5f6YEM886/VItD1VuhvvrLhgmEhKW2LuEGpRk5x1f0ypCiajqhFmH+58udULAFNQZyMmVOM/RtFsF8yWGXwkxYyZkmxVBHxeVDR26p+DxFdO+tON3u4AljGX528iZ2n+4bwNNVd9Wc1m7mmlxpXGpZ5hq4X74sawa52Wk42CYIBO0UMklTOGlxG8vP/VQlP8VLFYRTWsCv47qmIvEdctwfR7DxyPPNaZwzruHjSMN8ch4CfDyLukHrBxaeHG97oTSeYt7Qug01ottTwlnuWoKZt5yTHKaSFI3MaDzdCJm6cIgeSRTtJqxoTl TB1EdpbI frw4kyfOHQVzEMczOVZGm7gFCt09Z0b36COjjH5ChFI9oc2JAXDGYT+ogpHk7avzsfWdZ5jjzQLLMRutL+Mdb9jvaZu9yrPwiRrDTNOYWF47NvoI6aflJds6Y0Z6MPBaqXVK+R5cftFIpdrV0pKZJYbggn3V2bVSj8gr0jyPGtTy7i/gfgEq1boHkOS1IPpNIbcoob6G2/v6FxEHnRsMJBr3bwAlpzpTN8FIhKf/vmGGcAn/fxpJTx94eYEWoBkP9OrbyLRx0017F5QmMnTZ8grEUfmyX2NpDqFUn 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: Converted the function to use folios throughout. This is in preparation for the removal of find_get_pages_range_tag(). Now supports large folios. This change removes 11 calls to compound_head(). Signed-off-by: Vishal Moola (Oracle) --- fs/ext4/inode.c | 65 ++++++++++++++++++++++++------------------------- 1 file changed, 32 insertions(+), 33 deletions(-) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 9d9f414f99fe..fb6cd994e59a 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -2595,8 +2595,8 @@ static bool ext4_page_nomap_can_writeout(struct page *page) static int mpage_prepare_extent_to_map(struct mpage_da_data *mpd) { struct address_space *mapping = mpd->inode->i_mapping; - struct pagevec pvec; - unsigned int nr_pages; + struct folio_batch fbatch; + unsigned int nr_folios; long left = mpd->wbc->nr_to_write; pgoff_t index = mpd->first_page; pgoff_t end = mpd->last_page; @@ -2610,18 +2610,17 @@ static int mpage_prepare_extent_to_map(struct mpage_da_data *mpd) tag = PAGECACHE_TAG_TOWRITE; else tag = PAGECACHE_TAG_DIRTY; - - pagevec_init(&pvec); + folio_batch_init(&fbatch); mpd->map.m_len = 0; mpd->next_page = index; while (index <= end) { - nr_pages = pagevec_lookup_range_tag(&pvec, mapping, &index, end, - tag); - if (nr_pages == 0) + nr_folios = filemap_get_folios_tag(mapping, &index, end, + tag, &fbatch); + if (nr_folios == 0) break; - 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]; /* * Accumulated enough dirty pages? This doesn't apply @@ -2635,10 +2634,10 @@ static int mpage_prepare_extent_to_map(struct mpage_da_data *mpd) goto out; /* If we can't merge this page, we are done. */ - if (mpd->map.m_len > 0 && mpd->next_page != page->index) + if (mpd->map.m_len > 0 && mpd->next_page != folio->index) goto out; - lock_page(page); + folio_lock(folio); /* * If the page is no longer dirty, or its mapping no * longer corresponds to inode we are writing (which @@ -2646,16 +2645,16 @@ static int mpage_prepare_extent_to_map(struct mpage_da_data *mpd) * page is already under writeback and we are not doing * a data integrity writeback, skip the page */ - if (!PageDirty(page) || - (PageWriteback(page) && + if (!folio_test_dirty(folio) || + (folio_test_writeback(folio) && (mpd->wbc->sync_mode == WB_SYNC_NONE)) || - unlikely(page->mapping != mapping)) { - unlock_page(page); + unlikely(folio->mapping != mapping)) { + folio_unlock(folio); continue; } - wait_on_page_writeback(page); - BUG_ON(PageWriteback(page)); + folio_wait_writeback(folio); + BUG_ON(folio_test_writeback(folio)); /* * Should never happen but for buggy code in @@ -2666,49 +2665,49 @@ static int mpage_prepare_extent_to_map(struct mpage_da_data *mpd) * * [1] https://lore.kernel.org/linux-mm/20180103100430.GE4911@quack2.suse.cz */ - if (!page_has_buffers(page)) { - ext4_warning_inode(mpd->inode, "page %lu does not have buffers attached", page->index); - ClearPageDirty(page); - unlock_page(page); + if (!folio_buffers(folio)) { + ext4_warning_inode(mpd->inode, "page %lu does not have buffers attached", folio->index); + folio_clear_dirty(folio); + folio_unlock(folio); continue; } if (mpd->map.m_len == 0) - mpd->first_page = page->index; - mpd->next_page = page->index + 1; + mpd->first_page = folio->index; + mpd->next_page = folio->index + folio_nr_pages(folio); /* * Writeout for transaction commit where we cannot * modify metadata is simple. Just submit the page. */ if (!mpd->can_map) { - if (ext4_page_nomap_can_writeout(page)) { - err = mpage_submit_page(mpd, page); + if (ext4_page_nomap_can_writeout(&folio->page)) { + err = mpage_submit_page(mpd, &folio->page); if (err < 0) goto out; } else { - unlock_page(page); - mpd->first_page++; + folio_unlock(folio); + mpd->first_page += folio_nr_pages(folio); } } else { /* Add all dirty buffers to mpd */ - lblk = ((ext4_lblk_t)page->index) << + lblk = ((ext4_lblk_t)folio->index) << (PAGE_SHIFT - blkbits); - head = page_buffers(page); + head = folio_buffers(folio); err = mpage_process_page_bufs(mpd, head, head, - lblk); + lblk); if (err <= 0) goto out; err = 0; } - left--; + left -= folio_nr_pages(folio); } - pagevec_release(&pvec); + folio_batch_release(&fbatch); cond_resched(); } mpd->scanned_until_end = 1; return 0; out: - pagevec_release(&pvec); + folio_batch_release(&fbatch); return err; } From patchwork Wed Jan 4 21:14:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13088960 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 C16C5C53210 for ; Wed, 4 Jan 2023 21:15:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7994E8E000E; Wed, 4 Jan 2023 16:15:14 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 749638E0001; Wed, 4 Jan 2023 16:15:14 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 54E278E000E; Wed, 4 Jan 2023 16:15:14 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 4676A8E0001 for ; Wed, 4 Jan 2023 16:15:14 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 28C13A01E8 for ; Wed, 4 Jan 2023 21:15:14 +0000 (UTC) X-FDA: 80318372148.09.83DFBC4 Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) by imf07.hostedemail.com (Postfix) with ESMTP id 797CF40019 for ; Wed, 4 Jan 2023 21:15:12 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=HbtlZrra; 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=1672866912; 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=yH5uknizJ+VZ3ByJbVZj3rNFJAjGpaD6mNiQZQbwTDM=; b=1BbfqXpzr7AhsjpcwZuPTYk4Qcv2IKvuAzC3xyjpymkDR+C0afoyXg0ettc36Jv0Bm4T0r 4tPUIX49USmyjb96BtPp/fs6XOdE6HGziOwQ3i/irQGXZUkKLILV8gfwfhfuZxNcMJhkzB uj+j5hkjYhbZ/aYwP1Mat+n84Ip5O3Y= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=HbtlZrra; 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=1672866912; a=rsa-sha256; cv=none; b=Tk+pq1P9E+U0ANKsWlWVNyVbLNWDcYGCKt+IaKg1V+VNiLzJy/rK4t+r5f7Ua/RULPcgL9 t/SpeAS7TelHx/alRMAk5Lpp5sp5ryDmrzwh35jrzVnol2iCcHDQY7GtC+8eYwNJob29JX 9e9Z6lU9xjB5lrHFofn0z2y5BM4vER0= Received: by mail-pl1-f179.google.com with SMTP id b2so37199584pld.7 for ; Wed, 04 Jan 2023 13:15:12 -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=yH5uknizJ+VZ3ByJbVZj3rNFJAjGpaD6mNiQZQbwTDM=; b=HbtlZrradnwPMjbOnk5CSSrEWLtsrycMj6Tm30jqV76XWo9P/G6G9QfGZXA3hEuuO0 yNLMx+3+R2fxnnyrSrsdtAH0YAmNGiTL388KwyzROfoONWg1jTa9Ux254/uWey0xofFS ZcN1YVGa74THrAOxSXWb1EhxG2YA/LskeaMec+FBsOyEUefqmBI414yyRv7F6qtfnFnG AKTzOXJ+X4W+hyL+EGENc2vkpZu+8+kQREVxb3SQSXSnUiBROYLOIlwHYGmrLdygYais EBeKayC0rdoQzyAgQz2uWHzmW86g0Hrl3uDZm7ONl8JUgVLCxAkjfMiNh3ua3ACkBAqv sniA== 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=yH5uknizJ+VZ3ByJbVZj3rNFJAjGpaD6mNiQZQbwTDM=; b=eCJpHSx7wWUxhML2w6OG3lWMQxWwIK9u5OlxDACgWtHnISlqOoJ3Rx7vMdDzP5W1UP NKDD4Wd4qNN4FwBovfh8IiyW3ye1IKNRWIBLD9Fy079udhouTwtxhHKbRhT20ZadEQNa sYTlsTdKGB/PtBW+BZfLpewNlXZSFTWudOxh6/I0fR6f//7nSUmsFWtxp8Wf/KVFQPr7 TdooBd8jIeqqS54I7z8AUdk799ek96K7jwzmvjkkCpfjdPN6dD7BtdXmZdp8XdiqHTGB UAbbSm6CAbx4h83yaMb+B77Y7sZ2+Me1r50aanlstBSJTuNvGgMe6v/k679u4xfPC4f0 60IA== X-Gm-Message-State: AFqh2kqVEZ7L83rxZmL7hJN4+hVtuxUxSAoBre+sH6S3LNfWU9qwqkz5 RPgBciSJRgX1tjQDeNc62yY= X-Google-Smtp-Source: AMrXdXtVQz3vUnk6SvLBb/uxtWWFs3KjCzby6fY2kylk/nf26hkuu2Sk6nOiS0bo0LRTvW+QMbKhXA== X-Received: by 2002:a17:90b:520e:b0:226:ba10:14e9 with SMTP id sg14-20020a17090b520e00b00226ba1014e9mr2765079pjb.12.1672866911945; Wed, 04 Jan 2023 13:15:11 -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.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 13:15:11 -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)" , Chao Yu Subject: [PATCH v5 11/23] f2fs: Convert f2fs_fsync_node_pages() to use filemap_get_folios_tag() Date: Wed, 4 Jan 2023 13:14:36 -0800 Message-Id: <20230104211448.4804-12-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: dsa6iq78mze8f3z7sus5s8z4dywdccgs X-Rspam-User: X-Rspamd-Queue-Id: 797CF40019 X-Rspamd-Server: rspam06 X-HE-Tag: 1672866912-525749 X-HE-Meta: U2FsdGVkX1/TPSfsXo9lHecWK0wzUgaDkWlCGUhTU1p7txvAtxCsUmBzOIewVQqitzOrFnSJdggTgRhKzpObEJ0NY1GrjizCge0sDcvLRthcd68983Gp2wlSRvXQE3mTA/eirDY9V+DfBgCXsQYMiARPNgqoBjN2YlzpU34OyI/BP/81ilvvro426OhIYr8reI7I3RMkxDKQU86ykHwRQ2D9FWnDMBmxrgIbpkoFfFAHexqf4AqhRWoqTiGDr1Y5NmeqOdz/3KwSrN1sLcZEA3wUnJuhJmSPWN60i1YhN+0fOrtgGmqFi/MPurI/HrXXfoTeV7NnwvOUgjeVv+7CJRo5UYpxOOpDPVv4/kfFa6j7kxBvtRKc2kzA/yEH5Y33QuUWwfMd44VFzKLYHVDG0sC19GvricaRVnhKgLLpd3JCwTiVMlJSIGPSH4q3h2NQumBKVX+6EFLHUoiLqMk9+CF27bJWo0vnAlFypuw/iieIPJLnWLMHuOew4RfN+vGp4eS3ZxVE/Fge6sNfNjskp//WXcfLup9kyRIM2c6+2T5cxvuuAoiHmpU8BxxTjKMtQu1qMGTeRmdR15pu7lXprPTe8qzP5n+m0oxJUJE3gsSrwtzZ9V2Xmp9oavfdYkEbVCuU6ZInFwZPkDDCcf4QoR2ZPk1IGV40Ky8rJ6OlZHJp2at+50sbfzY7FuLGjPwrFFq0AOiBydANRszW+2m98ypsDpDCbXR5Tb30Mfr+2Vvm6GUwe6peImc9omlvL/Ah6KcB5HUht8Ziq2EAq3ekdMLFJ0Q9u/g2yziK1bemgKQIlzXFQzlp86e63eymmCkUwtSaid0HTyFV5/YgEQ6CmwQPZRIp1srR4z9qHXEpyYMvKTW03koFR8Qnx5q6RQuZC7BCdIB6DPwUms/iw7hp9VviX1gowIHcvRD0yesFWTOK0P9NjIq430deBviTpYfyauN8xX6hHliuoStdVAY VSJLPGcd TQ4ZTdzL3Vov2nhjM5VrVK3ED469ouVipqp4ic0EdYPUL89sX1R92oECwTqDBTydq9FWGAYBxWPThHFH/4Rxvjk7EFNr5ZZI3n6f0RGMEKixJRVRmkeOB7xUOLY5KngcF2OHWU9Ix2wvU/rv9vXH+B+5vBrnek3F7F5fsdy1KOXTgW/yxrYyCJKmcTjW1a39mUgOmInwLGvYpyjPf1iVlX1/eYDgDSKZE8S9+itM8z7Dfjx+BytdGtILN+ejfQMY++HLi2S02dl34lbs7sZ9CxtFMtv+8lGuU4xV5 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 a folio_batch instead of pagevec. This is in preparation for the removal of find_get_pages_range_tag(). Signed-off-by: Vishal Moola (Oracle) Acked-by: Chao Yu --- fs/f2fs/node.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index dde4c0458704..3e0362794e27 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -1731,12 +1731,12 @@ int f2fs_fsync_node_pages(struct f2fs_sb_info *sbi, struct inode *inode, unsigned int *seq_id) { pgoff_t index; - struct pagevec pvec; + struct folio_batch fbatch; int ret = 0; struct page *last_page = NULL; bool marked = false; nid_t ino = inode->i_ino; - int nr_pages; + int nr_folios; int nwritten = 0; if (atomic) { @@ -1745,20 +1745,21 @@ int f2fs_fsync_node_pages(struct f2fs_sb_info *sbi, struct inode *inode, return PTR_ERR_OR_ZERO(last_page); } retry: - pagevec_init(&pvec); + folio_batch_init(&fbatch); index = 0; - while ((nr_pages = pagevec_lookup_tag(&pvec, NODE_MAPPING(sbi), &index, - PAGECACHE_TAG_DIRTY))) { + while ((nr_folios = filemap_get_folios_tag(NODE_MAPPING(sbi), &index, + (pgoff_t)-1, PAGECACHE_TAG_DIRTY, + &fbatch))) { int i; - for (i = 0; i < nr_pages; i++) { - struct page *page = pvec.pages[i]; + for (i = 0; i < nr_folios; i++) { + struct page *page = &fbatch.folios[i]->page; bool submitted = false; if (unlikely(f2fs_cp_error(sbi))) { f2fs_put_page(last_page, 0); - pagevec_release(&pvec); + folio_batch_release(&fbatch); ret = -EIO; goto out; } @@ -1824,7 +1825,7 @@ int f2fs_fsync_node_pages(struct f2fs_sb_info *sbi, struct inode *inode, break; } } - pagevec_release(&pvec); + folio_batch_release(&fbatch); cond_resched(); if (ret || marked) From patchwork Wed Jan 4 21:14:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13088961 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 47089C54EBF for ; Wed, 4 Jan 2023 21:15:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 688998E000F; Wed, 4 Jan 2023 16:15:16 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 611A08E0001; Wed, 4 Jan 2023 16:15:16 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 463B78E000F; Wed, 4 Jan 2023 16:15:16 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 37CB98E0001 for ; Wed, 4 Jan 2023 16:15:16 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 19675120406 for ; Wed, 4 Jan 2023 21:15:16 +0000 (UTC) X-FDA: 80318372232.17.EB13013 Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) by imf29.hostedemail.com (Postfix) with ESMTP id 6C37712000A for ; Wed, 4 Jan 2023 21:15:14 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=nqEuKaTI; spf=pass (imf29.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.53 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=1672866914; 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=5JTMc/Rft/vIyJlvWKFcn8nkQrf+O33NuNawnN6rRgI=; b=R46fMIPNtffko2hMzBCAonHXZpmJLHFKfRz5/VfrJxLApPCDMoi67lQYlrbppxhm7Gm0kU BODMvj5WC8/xXV1GJeRyL+/3E3Hc9QFgEl7ivNy8EmNwoAUHIEfxPgnrkdKx3tm0KSAHG/ Rp5yi+gaWciPj1wge2dOQia2OqHHRWM= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=nqEuKaTI; spf=pass (imf29.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.53 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=1672866914; a=rsa-sha256; cv=none; b=mviljtWpKHBlSk0rfuHr/Oj7HSNSUjz86EXXQB6Rio7En7Vit6ozQMrxUi3fpEBveNfyyT 09KXT+QltOjJ34ADlRCpIYzEeqxH0BMLgb+At1Sh7uzRH1SrY+bYQmsU976pwKbOiPOzxo UZxeXlaoFh91V+1J85v2RgAxnJXCtCE= Received: by mail-pj1-f53.google.com with SMTP id v23so37529916pju.3 for ; Wed, 04 Jan 2023 13:15:14 -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=5JTMc/Rft/vIyJlvWKFcn8nkQrf+O33NuNawnN6rRgI=; b=nqEuKaTI9dAXbJiKNF6NFVlHonYqdpnzDFZQRbj6c6q33P4q7zmgWoLXJ3cvwJxiFU R4EchBW4P9btK5EV2Ivos6RVjg1pCqpX1sdrjygOWSOWvR56x6MAcYlVYqzqYxU9e9pD 7EqyoRZKmtKUIC4XqucME2BOGZCWoquaRcoAjwG6f440GMABya0GF45MLcEdcWoBQIPQ aSrPTzqxY2gV56movVnmY+sLkzpn2sZ/+NfGjAOpD0jKjJOna2t97nyuQoo/S3JNHjEa jJZ5wa0Qe7mURn1kHsaymS4r8Y1pr0V1FypBr74zDvcLsepES4cYIoRevgoh6RoBOUZe pZpg== 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=5JTMc/Rft/vIyJlvWKFcn8nkQrf+O33NuNawnN6rRgI=; b=LaAfMuUuNOumJjnsNqc9QD4XztXmy4VM+++Paq0uMrGRTmnET64VIsjJB2p0qrOeTc glKi9wuiBTftUFVPu+f0WYp+7rYXXFXurfTQurnLzMMqSfwLcTpmMSHi527Eu4DRHunH u3lg3yDSEzqfrP5yRx2tNyorr1VS+dQMFKQVQw72W1Iav5wLpTzM44rxIGIOrelF+t7W wugGPvzpTLxyXVZAtXUhIUcoV1wWQ/6N9IstU36S+n1W1GyrhfIWBKhUjH2uDo1QBFWv pLC/nxUeejoo9UM5VcU69VObE2kuQcN9Yi+bO5YcoRqt3HgwDii9EuvDMYzuR4IO0xfw f/0w== X-Gm-Message-State: AFqh2kpD3SqmTgwHuwJC5zAz9f9s5LksFPoiBhxHmMrtrEliccWAH5KV HdZg/nOD2VOJ0yY2TsF9irc= X-Google-Smtp-Source: AMrXdXs4LlgTrixclkrOcCZrpN6SR5Ezctmf4LJMRiV2PQ69qXIMCxzU7F8St0tY9EKMLcnxhYsTtw== X-Received: by 2002:a05:6a20:8e10:b0:a4:a73e:d1e2 with SMTP id y16-20020a056a208e1000b000a4a73ed1e2mr72696381pzj.57.1672866913342; Wed, 04 Jan 2023 13:15:13 -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.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 13:15:13 -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)" , Chao Yu Subject: [PATCH v5 12/23] f2fs: Convert f2fs_flush_inline_data() to use filemap_get_folios_tag() Date: Wed, 4 Jan 2023 13:14:37 -0800 Message-Id: <20230104211448.4804-13-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: m8u8ftxhezkh5kkpxeocpdmb31forhcq X-Rspam-User: X-Rspamd-Queue-Id: 6C37712000A X-Rspamd-Server: rspam06 X-HE-Tag: 1672866914-683709 X-HE-Meta: U2FsdGVkX1+O+yoqwQ5oyyKXOJ0lu8uTKQc/aeRnADp0bvAiHKsTR7tMXFMfmpqg0kz93osiVIMU36gFYnU5APbCMm+2e85Tgdo1x4pVlKuHtjKz0ukfZwhJUDbSjHiXgQm2VLyvxHZ2oLy0MRGoex/L916hQ3Jm88XF7o4UyU/+03hMrvxiX7BVYuI6B6ZJidK6eiXZai3pi1jZO27UwIZJUpzK/QR0thA3Iv7jbNYVb9Lb3ygp1XbQj3R1MWMsXS887S9eKor9z/tL0sKZeRMysN5oTK4sZ7wFgpMUpeclzIDsqozSWjZKvlJucS3R3QITuLb3csoLAfqktLqEpEFDF9a2mI+ci5X3CqVdpNoPLhPu1drDPV/C9JU6JGMDIw5b5x4YVHjtMk4YU0+vB03X3EebJV0jg5qkfAP5637eIXn1+uPhjy8T2PCXzxLsN+AecZ9XLXvAwOjAddJzdFGKMVOJvunanoEcRg46RhZqfScpZg1jSFBqE532oKNAct9aZNP5sDE6GhJywWrYAcPfsbxYe2RYSgCR/W3uh8pECrs0vDRs2RYmgrkwT/3SwlPetQcD1EVW1zV3o6PFqKS4lm/RkJTqRBIuQUQuafvUOPwae2Ea8FTx7t6p6x12H00sQ+8JVwh5ZTllfPVUN88wilz9HEb69e/8VakEZdaFEKrEyD69o/UM/x/E/Zvha8mtvOUbySUOTZlRjNo+memSPNDfG4L99FQUtF6PQxzxZmaJAQsHfFz6dCPoyc5SfFo3MYM25+aiL5OzbJ0s6dUB+RSiLrimj8SksT0WzIbxTgups/KfP/N6iH5nd56zO0XH3a9PnNqopFnsP8H2BBCpiaMFJeol3aumjLhnAHbLq/LTAgjs7kERRR+DUXYrusCnql0KXTrMyiUBKrk2pdsB6EvaNKQTlLZXUYGHmJWwnpjbWuQ95QE6e4BrY/Rp8dRUv5bDAU8MEfcGMp6 NuHmI5vy /iK3uCKab2m/rNaR+Rnd1O8Gb51YIHZp0jRStUkcQynKW1LjdF9H1FhCCaGoxmGLUBK7aOpTKAQf37H9dUPeQBFkXHv2YmUKSTZIDtfvH+GVubeg/eUYbtGja5pIgC5EKNSJmqNJ91721zCc9I4rPpxZgmc4zcLlFzhvaKmwTmxtvksrlLeqA7yIS460In2SCx7mwfEV3whmhqhASmFf1jtUuCVJa8vCQFYP8quLvkIOoQnB+O5H3LUqbPral1WwqXZ7KtwIk8lmJQO1d3YXPhKHqbg== 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 a folio_batch instead of pagevec. This is in preparation for the removal of find_get_pages_tag(). Signed-off-by: Vishal Moola (Oracle) Acked-by: Chao Yu --- fs/f2fs/node.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 3e0362794e27..1c5dc7a3207e 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -1890,17 +1890,18 @@ static bool flush_dirty_inode(struct page *page) void f2fs_flush_inline_data(struct f2fs_sb_info *sbi) { pgoff_t index = 0; - struct pagevec pvec; - int nr_pages; + struct folio_batch fbatch; + int nr_folios; - pagevec_init(&pvec); + folio_batch_init(&fbatch); - while ((nr_pages = pagevec_lookup_tag(&pvec, - NODE_MAPPING(sbi), &index, PAGECACHE_TAG_DIRTY))) { + while ((nr_folios = filemap_get_folios_tag(NODE_MAPPING(sbi), &index, + (pgoff_t)-1, PAGECACHE_TAG_DIRTY, + &fbatch))) { int i; - for (i = 0; i < nr_pages; i++) { - struct page *page = pvec.pages[i]; + for (i = 0; i < nr_folios; i++) { + struct page *page = &fbatch.folios[i]->page; if (!IS_DNODE(page)) continue; @@ -1927,7 +1928,7 @@ void f2fs_flush_inline_data(struct f2fs_sb_info *sbi) } unlock_page(page); } - pagevec_release(&pvec); + folio_batch_release(&fbatch); cond_resched(); } } From patchwork Wed Jan 4 21:14:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13088962 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 A25D8C46467 for ; Wed, 4 Jan 2023 21:15:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0464D8E0010; Wed, 4 Jan 2023 16:15:18 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id F12F18E0001; Wed, 4 Jan 2023 16:15:17 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D645C8E0010; Wed, 4 Jan 2023 16:15:17 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id C9C608E0001 for ; Wed, 4 Jan 2023 16:15:17 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 962B614079F for ; Wed, 4 Jan 2023 21:15:17 +0000 (UTC) X-FDA: 80318372274.06.9E94AE6 Received: from mail-pj1-f47.google.com (mail-pj1-f47.google.com [209.85.216.47]) by imf14.hostedemail.com (Postfix) with ESMTP id DD387100004 for ; Wed, 4 Jan 2023 21:15:15 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=GGaN80QX; spf=pass (imf14.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.47 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=1672866915; 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=x25JE3Kc6tv/CRPnK8Jr5HLS2sX0SCmIF/DAVcH2FqE=; b=JPKTpfhUnQKQFI0oTeWARKT6YgxdDEzxrWdoDbSxmabrp3fMWXm4fruYBBdGPq9U0OpDye CN9Vh+WyZ4I4rcwoC1qByhCkvQxl5rrK+EdO3S4lfXtHIvBPwT2OAznaf6xCjybLdnq9In AVVVNyydw+k9T6hl+W8nxS4PbycFgX8= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=GGaN80QX; spf=pass (imf14.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.47 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=1672866915; a=rsa-sha256; cv=none; b=I0afyXvvO1MLEw9DxLUwNK5rTGJN/mrto11FZUIIIKtkJO/27fHk6pcoIhpB7P1BTCDJoQ 8VPplHjd99Jv2ugc4LTra1N/zxPdYGR0J83FCrbqSpynZUW1qTY7dm8DwI3a9wY3xywwE6 O0DcRNYcS2wdIXcFY/oVVBsB/RK2278= Received: by mail-pj1-f47.google.com with SMTP id c8-20020a17090a4d0800b00225c3614161so33095280pjg.5 for ; Wed, 04 Jan 2023 13:15:15 -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=x25JE3Kc6tv/CRPnK8Jr5HLS2sX0SCmIF/DAVcH2FqE=; b=GGaN80QXsh4J1YXL+CzIWsFbPtYnvqnUAuR7BlWM5cg7Fb96IUWkf9YKtYSUX4xJiv fdrgdThz8UL3P4MZ+eHMu/4K966siuQI6iAdHR2MVQjMjV6MN1GRnO6doH2uk5OhpsZO LY78o+yIQS4ow8RQaNkPfGCKMNJtGI3xD9tlc5jEE555TQyh8J94/Gr9HVriMtas67IH FB8OUwFz1Oy3rJJOCQeEa/ZHyPHJEdTE5f3SEzIDvxTL2bZ5bnEYjE/0AQom1yTmJR+y hcZ12FlAB2hAIMkIDGdKE9vHxFNU1VPWGBB3MfQllfkg7rnUYN+U0mQERs2+5ZkIr7zC Wx+Q== 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=x25JE3Kc6tv/CRPnK8Jr5HLS2sX0SCmIF/DAVcH2FqE=; b=C+jFOAtXd/OvNuP90T8hRJO1DdulxIAf4HFHo2gRVU82e0saPo29BlFlEbyjACeHg4 qAyBGosV9gfBfkGzbhu2OSL04vyvaHovcKuPd27RUwUR7fnHsji5lqLCDW4dlqReqZtc L8j5aQb1/yo4fN5k8osNcEicmyZYuNFmIWX2wiw6CUCU5Z4oHsElae5zMcbb32Ol3L96 rH6DkGAnZ252j0ArIH+S9HWSF5DfWfR1inRsOv9cm7hgmzQr8/BClHX0isgX5CKWRx48 nr7EvOlnONmIdLaYG+8DiPEgPABlw1l10qGU/0Ty5BFVSERuUZv+wIGwVFUg4DkTGU8K +qVA== X-Gm-Message-State: AFqh2kqUoNnsFqIkyM8Qr5JykbWawUdVt3jqaEc8Zz66Y1j+xPzm9EpG AVd4BINTGF6zb+kFpAYxryo= X-Google-Smtp-Source: AMrXdXtcJ2y8j2tl71bGDNWcQ9VdexuFiNN6QmVTJEdgM9Lahf3FnPeatjjBv8JIR91dEL59PwjIKg== X-Received: by 2002:a17:90a:930f:b0:225:be98:f5b5 with SMTP id p15-20020a17090a930f00b00225be98f5b5mr45592480pjo.23.1672866914778; Wed, 04 Jan 2023 13:15:14 -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.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 13:15:14 -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)" , Chao Yu Subject: [PATCH v5 13/23] f2fs: Convert f2fs_sync_node_pages() to use filemap_get_folios_tag() Date: Wed, 4 Jan 2023 13:14:38 -0800 Message-Id: <20230104211448.4804-14-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-Server: rspam05 X-Rspamd-Queue-Id: DD387100004 X-Stat-Signature: rtpkgy3ht5f358b5f3fuhq6tknece5a7 X-Rspam-User: X-HE-Tag: 1672866915-756214 X-HE-Meta: U2FsdGVkX18SrilJ/3KH1hpxtLFvycaXE1UkzhHvIp49pVnSsD8611676m5CqVA0Nl4nglTBOz5scL1ti85ZBgzCqYMQHdQm/x6XB/2qVOIBXgEPv2NkWs5RPw3GteRDZFUbG8j6nE7CHtMtFWrA/SNJ7VZ6Fl7UUKL/Grxzv7IvBP4TRuUKS9D/3uIZm40zW7ISCne9x7obBvEaD7cOhqSknEtbeZdTyi7/IeL3t82UJPPmIGGrAYh+2Efn/vcud9SR/daIjL8+99YC7r8hUIr4w+RE2yV4FTYIoNoHpDB95oxLkSromiW/fSUYB0TqK7gVKEa7ruiv3HnAnWjuoSacRyU3t7VG3FwL03OLvBgsePt+Yl5nmtfC8JtOBnr2WI1zYQSzXunC800EbGm45tyCg4gxjg0VzEg8bMKZ2IS8ITd5Gx+HEO6rxkA3i/Q8IAfFJCWhqgK1fiiS2uD/uqWVDwWHpxHQKC778xxtmoOZw7KHYdUeNkq28thEfsqYSKdSQxcFhVS1CSSfi61nyXMX1RUTEQUdILxVSTx3Mh48W87gg2s2TsHgDLjOwj4HFA4MGjctTYc4EuryP3n0ApJWUCGorLjmCTLqsTag6/s3D8nDszeue2GzjImUn60XNLyRtu5MDVcuvxAlyeCSk5ASrmT7XA8qnFLZS1g2wthrHNuUjFphxaYFLNtFxyoUKyw9wmlQuSl0XAxqaZPX07SaGaf1QBJuSb6W6a+VqLrWETU2ax/Pyy7yaXzbdSLNkhGgVCA9d+4iEmpS+F2ZCFDSvU3OHPmquY6RgoEcy70vkYkzULccZ0COOvwdY6L9SyCPMM1E77Qni8pWzfV3j8YGMvwp958yomjiL6Q/NzC2qN7lJOfY2FR74RQvAtlWiJELSMilL7kWRiXGzxRV6Wi13w0sGOY5ZSG8WarpkcBZBadwJ3KXh9rOvyMTiaVkucLJQjEBfNHMD0kQ17x bLetmjGm E0a2+qWBjvTWMK/bPg2/k9BSRUeuLxbWp9cViPy19Yfd8L4sEHmZ5P0adyvSdXcHcELx4ELh3MzFBVq55IM5fkPetG8DsQr5qjzrK9cEmXXhxNVLsIkLXQQOUEZfiE5Tb48+sGP7MZbQaVdrPqnmnei/5R03sYAOGn50RlTnP8Gw87zaZ5vGSUMnr0kUrXICTViktVQ16VfzGObxykewId3zMKaHtbHtNQx0tj2qVQokgcRpxLZ7J51ZvUHwGYdzZo56H6u6JKEL4/aI9fBsygOKc8w== 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 a folio_batch instead of pagevec. This is in preparation for the removal of find_get_pages_range_tag(). Signed-off-by: Vishal Moola (Oracle) Acked-by: Chao Yu --- fs/f2fs/node.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 1c5dc7a3207e..51e9f286f53a 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -1938,23 +1938,24 @@ int f2fs_sync_node_pages(struct f2fs_sb_info *sbi, bool do_balance, enum iostat_type io_type) { pgoff_t index; - struct pagevec pvec; + struct folio_batch fbatch; int step = 0; int nwritten = 0; int ret = 0; - int nr_pages, done = 0; + int nr_folios, done = 0; - pagevec_init(&pvec); + folio_batch_init(&fbatch); next_step: index = 0; - while (!done && (nr_pages = pagevec_lookup_tag(&pvec, - NODE_MAPPING(sbi), &index, PAGECACHE_TAG_DIRTY))) { + while (!done && (nr_folios = filemap_get_folios_tag(NODE_MAPPING(sbi), + &index, (pgoff_t)-1, PAGECACHE_TAG_DIRTY, + &fbatch))) { int i; - for (i = 0; i < nr_pages; i++) { - struct page *page = pvec.pages[i]; + for (i = 0; i < nr_folios; i++) { + struct page *page = &fbatch.folios[i]->page; bool submitted = false; /* give a priority to WB_SYNC threads */ @@ -2029,7 +2030,7 @@ int f2fs_sync_node_pages(struct f2fs_sb_info *sbi, if (--wbc->nr_to_write == 0) break; } - pagevec_release(&pvec); + folio_batch_release(&fbatch); cond_resched(); if (wbc->nr_to_write == 0) { From patchwork Wed Jan 4 21:14:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13088963 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 47F62C54EBD for ; Wed, 4 Jan 2023 21:15:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6D9628E0011; Wed, 4 Jan 2023 16:15:19 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5C4EE8E0001; Wed, 4 Jan 2023 16:15:19 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3A0D58E0011; Wed, 4 Jan 2023 16:15:19 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 2CDC58E0001 for ; Wed, 4 Jan 2023 16:15:19 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 05DEF1C647E for ; Wed, 4 Jan 2023 21:15:19 +0000 (UTC) X-FDA: 80318372358.23.2D8B527 Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) by imf21.hostedemail.com (Postfix) with ESMTP id 338CB1C001A for ; Wed, 4 Jan 2023 21:15:16 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="Fd8n+f1/"; spf=pass (imf21.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.50 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=1672866917; 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=geJwjn4yJKU06Ftbar/y+HcHHoAvhwpeBoUnwsGYEks=; b=AyYzmkAMUg67+sGqUmJRpyyiR1PX3jpi5aAPgWvP2pyx9k/S1Y/WxG0V9oKbWS3lxi7sRT 9uZ+5MecEzcZuW3r1p/+JT3ViSCJds8hJYxyCXuhEw7wexkWf4QSVUrlybynnXHpO58wAM 9avfB+BUkBX9G9YdU/I1JGv4cfKKcKc= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="Fd8n+f1/"; spf=pass (imf21.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.50 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=1672866917; a=rsa-sha256; cv=none; b=m7leSmLVDz6p8gN9uXNGe6rlwTPJ8kBYIsQCwgkAHWP0u8tdM0CSWH0SHQgEj/+L2z03hm Y4Gp8Dc6VBoPiM4FSeS8fHObzqOeD4N7JPsjVA5oLJUYBTCGR6dBPxpmg7T/CAOOHtLMg1 JSmFjpfs3l5y0lSv0vq5h/ME8lLasdo= Received: by mail-pj1-f50.google.com with SMTP id cl14so1067255pjb.2 for ; Wed, 04 Jan 2023 13:15:16 -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=geJwjn4yJKU06Ftbar/y+HcHHoAvhwpeBoUnwsGYEks=; b=Fd8n+f1/NPank65Zw/kHWJBXTOelusyND5cLXZf9F1s+KS4ORsP19uuv4siEdxBQJT 10Ra99IFy6Oh1HDT1wvzP/oAFamJWd9Qb78Y7+Dr1J5qmNaV5uUh0D+BORnnhdkICTEi hvZ+N2BPjnPfx8nWabVIQ1bECzthUh6LIjPR0RUAG1DeoReFNu2ALc98+mFNSkzv5jSF 7ilXbV6Nd18bsqHzZbqMVX3Ckh1Ya5P58tpex0qa/qLrNBKPcUgEHDw0n2jHxI1unlNg jnduvhRGFEBTsAEtI0NgpHNFrUDMt7WRZ2kUYfejbotDf+e3vgHq5Tkx9eaJHjgYE3BO Jn4w== 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=geJwjn4yJKU06Ftbar/y+HcHHoAvhwpeBoUnwsGYEks=; b=zX2a6VRZPfD5mCXMmvc4o40WEwRwmbqRR0axcAPqSK+JDE9vVWaY/ZGqi8v547Sl6I S4juHvID4MZSbsRtWmyjgtjyBRrZpOXP+H3fxRvA6asfun9M7fWMxkORpOI24Pv8uq5E ZrN+f+HHh74xP/8lIH2zUtP5h8Zbo8y39R5YTi5MIcimXsz4ZXaT8ansAVPDJStZafD6 aV6sUQYXTBbgZ+LnyB4r1hM5lo4br6yHuZXBJzWSw/M02K0Lsao8na3mME7pyuMELf8X OHv2/aNzqKEgLKBFGZOpZ/ECB3EKY+mMakB8np8QicBL3h0ySonYVkFmkj8YIMWgDJH9 izpg== X-Gm-Message-State: AFqh2kompJ34YRrf6V7Wi7cesrRMroXtsb6C/rk6F+k9/tX0dHOgVZLV wwHKl/ACdz2PvJsM0x6+82g= X-Google-Smtp-Source: AMrXdXvBKEF5T2wnCoAj1IOJ4U73abN05uBfAh53KWBYn4m7hU5hHoJzlZNlJTGgGpr6V62AVrABGQ== X-Received: by 2002:a05:6a20:8ee1:b0:ac:3f3f:9fbd with SMTP id m33-20020a056a208ee100b000ac3f3f9fbdmr49160604pzk.48.1672866916135; Wed, 04 Jan 2023 13:15:16 -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.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 13:15:15 -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)" Subject: [PATCH v5 14/23] f2fs: Convert f2fs_write_cache_pages() to use filemap_get_folios_tag() Date: Wed, 4 Jan 2023 13:14:39 -0800 Message-Id: <20230104211448.4804-15-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-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 338CB1C001A X-Stat-Signature: 8iwj31totr69y4mixuqxy43onrcmju9j X-HE-Tag: 1672866916-233589 X-HE-Meta: U2FsdGVkX19t/V0sE1EMsqS1dfTlUrj++youJ1vTrLem7tok0f/TDK085tHKa96xHiA4urTW8AathpomU4pFBXNCITVpFawOmhv6xyi4b+Qg9JWBFSSSLhGonZaUjQ0hC0Kqdc5Yn1MO+5jLj5+kOacaJn1MgzlaXw9hRhVxG4GYrMQhFL7NgFgk6z3mdXKay0iXkku4QuokJtrqV+p4LFX3nURvrMUAdhnwZoss3flejOukXy3OFKFzXXKG+GTvM0vahp80wkgyQnnHbznWoXSN0nGrQs45RM8mdZnWbQT5m6IdeGsBPRCxfKAg68giGu7FwUwZiYt2BYsBDtMCdaOl+qEG7M2SPx5Vcivc8iIqqK04FrAal1SFcOfhxrdogWLHzUJ1/Z0yp+tiMOH4JajLHN0y883ph/CxSIwBcnMPPC4Lyk2O2JiRG0lA2McZAohkXfnI5IErdnp0hQGTX2e1/yYJaUBIo2L0fbAk+/xMY55ffJHzz2xBpwI7P+PWBL/wdJ4s3EiLGqswJZ42IBOxFFtuoywWj6Wl1dmSgjECB7RI/8DtIzngZgwRuI123jSm/l1ErDBGIZJRvNDlGUbW8hERNNzQ4IKuH2LliUvn2GUYUL1rguY3hY8WnSUjJqEHwo7OFLmaXgOpIXp3ZQyb0YyOlN5P+84uKAqYZLKTg2kGblEVivoS7KdwOEZ/pm8PVm4+8VdaWqefnzwhvp14SQCGUmIaPjHn3BoCd0NLZBZ9XyZ8nTV1UxcDK8cAPI2jt0DayQ7jiaGJDd2xAcFfpdDN90tzh+VA2+Zb3SXqjTFARN390o8sY8gnG9XrnXOgzAyp2KC0+GFuvY6KZUsZeERGNPKfWpLaCB/JrxBaoSuPkChCWhPrG1990JCoF35LXc5aR4sGqlOs4/dqwhRFaqU1kWKbMiodSzFPjZdgTDnqkLeCHfiJreuuV/Ew7NcG07KkGx29+jg0nrB 6X2XAr6I VwHGCvHwdjSQguyygFXfXIsR+wO1yJl4BT5o8JLCKinVgMxhIP86v+dfsJYM6VHLxD0D2xU5F66itu7cXxEPjMF+zp9Pj9DamLMrPEWxtN6ahcoxsz9vJwHwC16rlM7GS3HEsdKMh1oZL5tzuXX+cdGc8Dk3Cdcdw51fo787iom91kf4ln2uZ9OSvW8IvIHaOow8nzkKK79DlkLqOQApElRKK0FWD/VH6y8g0IIAs2WQhEBe9by7xlSJCtf2ucGBKS9dPQlyt+cEoEzChc83Z/5K9DA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000003, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Converted the function to use a folio_batch instead of pagevec. This is in preparation for the removal of find_get_pages_range_tag(). Also modified f2fs_all_cluster_page_ready to take in a folio_batch instead of pagevec. This does NOT support large folios. The function currently only utilizes folios of size 1 so this shouldn't cause any issues right now. This version of the patch limits the number of pages fetched to F2FS_ONSTACK_PAGES. If that ever happens, update the start index here since filemap_get_folios_tag() updates the index to be after the last found folio, not necessarily the last used page. Signed-off-by: Vishal Moola (Oracle) Acked-by: Chao Yu --- fs/f2fs/data.c | 84 ++++++++++++++++++++++++++++++++++---------------- 1 file changed, 58 insertions(+), 26 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 6e43e19c7d1c..ee1256e4fd92 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -2957,6 +2957,7 @@ static int f2fs_write_cache_pages(struct address_space *mapping, int ret = 0; int done = 0, retry = 0; struct page *pages[F2FS_ONSTACK_PAGES]; + struct folio_batch fbatch; struct f2fs_sb_info *sbi = F2FS_M_SB(mapping); struct bio *bio = NULL; sector_t last_block; @@ -2977,6 +2978,7 @@ static int f2fs_write_cache_pages(struct address_space *mapping, .private = NULL, }; #endif + int nr_folios, p, idx; int nr_pages; pgoff_t index; pgoff_t end; /* Inclusive */ @@ -2987,6 +2989,8 @@ static int f2fs_write_cache_pages(struct address_space *mapping, int submitted = 0; int i; + folio_batch_init(&fbatch); + if (get_dirty_pages(mapping->host) <= SM_I(F2FS_M_SB(mapping))->min_hot_blocks) set_inode_flag(mapping->host, FI_HOT_DATA); @@ -3012,13 +3016,38 @@ static int f2fs_write_cache_pages(struct address_space *mapping, tag_pages_for_writeback(mapping, index, end); done_index = index; while (!done && !retry && (index <= end)) { - nr_pages = find_get_pages_range_tag(mapping, &index, end, - tag, F2FS_ONSTACK_PAGES, pages); - if (nr_pages == 0) + nr_pages = 0; +again: + nr_folios = filemap_get_folios_tag(mapping, &index, end, + tag, &fbatch); + if (nr_folios == 0) { + if (nr_pages) + goto write; break; + } + for (i = 0; i < nr_folios; i++) { + struct folio *folio = fbatch.folios[i]; + + idx = 0; + p = folio_nr_pages(folio); +add_more: + pages[nr_pages] = folio_page(folio, idx); + folio_get(folio); + if (++nr_pages == F2FS_ONSTACK_PAGES) { + index = folio->index + idx + 1; + folio_batch_release(&fbatch); + goto write; + } + if (++idx < p) + goto add_more; + } + folio_batch_release(&fbatch); + goto again; +write: for (i = 0; i < nr_pages; i++) { struct page *page = pages[i]; + struct folio *folio = page_folio(page); bool need_readd; readd: need_readd = false; @@ -3035,7 +3064,7 @@ static int f2fs_write_cache_pages(struct address_space *mapping, } if (!f2fs_cluster_can_merge_page(&cc, - page->index)) { + folio->index)) { ret = f2fs_write_multi_pages(&cc, &submitted, wbc, io_type); if (!ret) @@ -3044,27 +3073,28 @@ static int f2fs_write_cache_pages(struct address_space *mapping, } if (unlikely(f2fs_cp_error(sbi))) - goto lock_page; + goto lock_folio; if (!f2fs_cluster_is_empty(&cc)) - goto lock_page; + goto lock_folio; if (f2fs_all_cluster_page_ready(&cc, pages, i, nr_pages, true)) - goto lock_page; + goto lock_folio; ret2 = f2fs_prepare_compress_overwrite( inode, &pagep, - page->index, &fsdata); + folio->index, &fsdata); if (ret2 < 0) { ret = ret2; done = 1; break; } else if (ret2 && (!f2fs_compress_write_end(inode, - fsdata, page->index, 1) || + fsdata, folio->index, 1) || !f2fs_all_cluster_page_ready(&cc, - pages, i, nr_pages, false))) { + pages, i, nr_pages, + false))) { retry = 1; break; } @@ -3077,46 +3107,47 @@ static int f2fs_write_cache_pages(struct address_space *mapping, break; } #ifdef CONFIG_F2FS_FS_COMPRESSION -lock_page: +lock_folio: #endif - done_index = page->index; + done_index = folio->index; retry_write: - lock_page(page); + folio_lock(folio); - if (unlikely(page->mapping != mapping)) { + if (unlikely(folio->mapping != mapping)) { continue_unlock: - unlock_page(page); + folio_unlock(folio); continue; } - if (!PageDirty(page)) { + if (!folio_test_dirty(folio)) { /* someone wrote it for us */ goto continue_unlock; } - if (PageWriteback(page)) { + if (folio_test_writeback(folio)) { if (wbc->sync_mode != WB_SYNC_NONE) - f2fs_wait_on_page_writeback(page, + f2fs_wait_on_page_writeback( + &folio->page, DATA, true, true); else goto continue_unlock; } - if (!clear_page_dirty_for_io(page)) + if (!folio_clear_dirty_for_io(folio)) goto continue_unlock; #ifdef CONFIG_F2FS_FS_COMPRESSION if (f2fs_compressed_file(inode)) { - get_page(page); - f2fs_compress_ctx_add_page(&cc, page); + folio_get(folio); + f2fs_compress_ctx_add_page(&cc, &folio->page); continue; } #endif - ret = f2fs_write_single_data_page(page, &submitted, - &bio, &last_block, wbc, io_type, - 0, true); + ret = f2fs_write_single_data_page(&folio->page, + &submitted, &bio, &last_block, + wbc, io_type, 0, true); if (ret == AOP_WRITEPAGE_ACTIVATE) - unlock_page(page); + folio_unlock(folio); #ifdef CONFIG_F2FS_FS_COMPRESSION result: #endif @@ -3140,7 +3171,8 @@ static int f2fs_write_cache_pages(struct address_space *mapping, } goto next; } - done_index = page->index + 1; + done_index = folio->index + + folio_nr_pages(folio); done = 1; break; } From patchwork Wed Jan 4 21:14:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13088964 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 106E1C53210 for ; Wed, 4 Jan 2023 21:15:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 330498E0012; Wed, 4 Jan 2023 16:15:20 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 29A598E0001; Wed, 4 Jan 2023 16:15:20 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0BA098E0012; Wed, 4 Jan 2023 16:15:20 -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 ECBC18E0001 for ; Wed, 4 Jan 2023 16:15:19 -0500 (EST) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id CB470801B0 for ; Wed, 4 Jan 2023 21:15:19 +0000 (UTC) X-FDA: 80318372358.13.E96A6F0 Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) by imf01.hostedemail.com (Postfix) with ESMTP id 217014001A for ; Wed, 4 Jan 2023 21:15:17 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=YYuOdit3; spf=pass (imf01.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.171 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=1672866918; a=rsa-sha256; cv=none; b=udi0l69MvRCehZCQRSqt4QA+ao0WJoceliT0pVstZXLmdn5Zz4apgN3zYignTykVQgrzUd 3o5RiNrBDEVLjAtnjxNqlfDH5v2QICkukVtDDSonXv2MQJZeyG4+H2cVbyiMPvDZZIgIvE Y6xe0nHWllqqYgkVyf5U2F7w+f+8nYY= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=YYuOdit3; spf=pass (imf01.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.171 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=1672866918; 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=HZ+AsMarClzul4w07hpaKmVXDP421VTrEgQP9XGRZto=; b=3SnH+neApsPKUln/N6os/T0NBHuVpH0WjwUbNc3z2HY3bQvHjbg1r5Mnkykr1TrSFIe+a7 mIInf/ZsOwAaRZoCxJ/LUsVJbqo+KWrC90S9bFr258nJPPMtDDRaz3q+vjYT2/mtfFYN2d Nkp3XXDMLIfP8KanNjQEo6hkppwuRC0= Received: by mail-pl1-f171.google.com with SMTP id g16so27542766plq.12 for ; Wed, 04 Jan 2023 13:15:17 -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=HZ+AsMarClzul4w07hpaKmVXDP421VTrEgQP9XGRZto=; b=YYuOdit3NxbNrQLvQKQzYy9fInjz8epNnsAie9l78qOZwItZ1q9762RHvdjHvn0w3T Itev/qVCegvvtOsHjlnt/i8oYcY6s8Pbft4yn8UlU5hO8ANcihMCzw6L7clWMBVNlkml DdVTstYmIe6uBY+QKphA7A0vNicwDIZfmnlRaGywuDcd3L/Dz6ksmUjm69PNaduiwT0y oDarQ2Aeh8wlIFX7joZPiMSA82+zZJyehOMhZmZgTN7kokD4EtjK7YG4/3QTFsugmOWW sUQ8oex28ZiETO1YVZLLNiEuF950kwCKMCnU79wH/Yyl7cH+rVKP8QdTlOWRApZ8hx1s Ciew== 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=HZ+AsMarClzul4w07hpaKmVXDP421VTrEgQP9XGRZto=; b=F1sKaBWPuKrP9a5rXbmPmIDcfDLdq+P5ypMqTdjslP46098urOYGHSnTOIcN2W2Be8 +CrFhV1NBhnUfyr8TtBXMHxp1tCU445BuPoyMa1v5brLIQxaP+8AivBep7C42g6BPOXp LusF99zv+pdf9d/gJ3hC/IzP5bIEvhycTevO/94oKNfDtcw+GDS9usz8SssZQ+1/lGcf uPvdWx2ZYhM7lPSqEn7RK6lux56n88LIFlUQ3vwLdz69rpNUinq2JZYPIUIlG6CQv2NM WY4vfcGF+ugENQWdjCxp7/f7Is8dJ5WUbmEYVBIBvZejZ3+y44vuyeJ2MWn33uVN35/z Ilgg== X-Gm-Message-State: AFqh2kqYtrFHAU4GLhkjWBpFmCUAWO5P8YncgeosPiJSWMOqqMeo8cqZ 7B9IWbMgrU0OnId5Xesrts4= X-Google-Smtp-Source: AMrXdXtdY5GUpRFH0/rWB1ui6dE4PdO42I8quQD8+H41n2qV43RNlBpjdfLglYXYOXUh6D0WzIQFFQ== X-Received: by 2002:a05:6a20:429f:b0:ad:bd55:6dcf with SMTP id o31-20020a056a20429f00b000adbd556dcfmr72875976pzj.28.1672866917539; Wed, 04 Jan 2023 13:15:17 -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.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 13:15:17 -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)" , Chao Yu Subject: [PATCH v5 15/23] f2fs: Convert last_fsync_dnode() to use filemap_get_folios_tag() Date: Wed, 4 Jan 2023 13:14:40 -0800 Message-Id: <20230104211448.4804-16-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-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 217014001A X-Stat-Signature: dtqkh51adqzouwja4jeq979du59pptmo X-HE-Tag: 1672866917-643484 X-HE-Meta: U2FsdGVkX18sRNlvI+czdVpF/8sl8RfgEt1/X6Bd5/G68i42d30FQlD+2I0hUlgonunqveO29bfHqavkrm/Nal5CqFH6PL+tCB2IaE817tn0du6qiporf6gEipq+MFHUShnIlrfs0MzGZB1XaS7BUIPPPfoOgKW+WuqTdOYBSeB4QEXkUjreasPOuunhGMkdywky7GOpiigMa6tIokFuawI8HVp2SX3uRKzkAtHWmuVAbqne6kbuhGuagMgF9txHjW4qLz7ynbfqiGvCHUb1hx1WIVEhV3LagCVVTFx0EiDOuL0nCqVYv/LO0BxuK/w9lPFZ02cYJMTRZQJtrnRl/Y7sI2it57fOYr6KxVlHZuxuYcpSG0+73hcP0DdRIsbMSpbzoP8Q3cErAt5I1OFUWf1hbzcOnj7VZqnaMJSC+cFFvMpTFpQI9l9ogarpHFCXmo8E7NkUF7r2VBEt2SvmLbJfKZIBZFJecw5gQ4/Vaqt6Nzi8LxSnjECsT2nr8AoOQMG7Ja/S0Vw9h2922NEQNU1bTvqF++bT2Q9m6SPpu/vhhEWxEI3yeNfR9jHDs+7ND/nE6D7NSFSUB7CmGiH59fl/wlnBvK1/FbRvJYAM96750tuBZWwfLdLRW74S8B9ICGdcJfscfDqZ2r/dqloQ9vckTYcYTjN+h/aFM9SpiTnn9WxKLsAtBwyCVtwVkOrcnSObrl65qsCNHVGTpXKA6KsQsW3Bp4TRz6rODBgHbGUP1PBjf1lxfiNJJJafMjfSqVJ4TuVP4bBhbg0L0evV0kUPOQlQ01d4zIqHkx7vLomHg/ObZTRkwYCorLUbZKabOZajPGGtJKkPrbusWUnoIzMJ+MSgeMfeMC6Gy2MPsFSHY8cmuGArlc5tEjCYXW+H7p3K81maIMKwmsGuhCu649PsauEBFqAcTp7zi+SBDeLdzP3dYOc+dEPJ/ApgR4mt5BPTjQCcMQ84z2Jr2Io hg8B/l6k 8MZ1jgS4E7/3nlvsRIPJOQ/YoQjcfKpv1DA1axcOvDy6FBh0rpCT7skicyFckI4CvvSPLBWP2PTFT+4MqHc6gaZHWHtO0pmDSSTDXw+hDTiXy6iH/wMKGCwqEVpVl53hI6IYk1kNxrxhf11eTEdfBKduay4VTtfkpleJF4Ip0ScuilIR6VLVeV7IL3NpZmkKBTSkuKwSqZvBjmHefDnR5xIoBDaqUvmyL1PGt2RaWhV5SIieIB82rqAxQ96tlDjpbWcsI4Rpc7pGf+S3Fnb3TUBA3GA== 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 to use a folio_batch instead of pagevec. This is in preparation for the removal of find_get_pages_range_tag(). Signed-off-by: Vishal Moola (Oracle) Acked-by: Chao Yu --- fs/f2fs/node.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 51e9f286f53a..cf997356d9f9 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -1518,23 +1518,24 @@ static void flush_inline_data(struct f2fs_sb_info *sbi, nid_t ino) static struct page *last_fsync_dnode(struct f2fs_sb_info *sbi, nid_t ino) { pgoff_t index; - struct pagevec pvec; + struct folio_batch fbatch; struct page *last_page = NULL; - int nr_pages; + int nr_folios; - pagevec_init(&pvec); + folio_batch_init(&fbatch); index = 0; - while ((nr_pages = pagevec_lookup_tag(&pvec, NODE_MAPPING(sbi), &index, - PAGECACHE_TAG_DIRTY))) { + while ((nr_folios = filemap_get_folios_tag(NODE_MAPPING(sbi), &index, + (pgoff_t)-1, PAGECACHE_TAG_DIRTY, + &fbatch))) { int i; - for (i = 0; i < nr_pages; i++) { - struct page *page = pvec.pages[i]; + for (i = 0; i < nr_folios; i++) { + struct page *page = &fbatch.folios[i]->page; if (unlikely(f2fs_cp_error(sbi))) { f2fs_put_page(last_page, 0); - pagevec_release(&pvec); + folio_batch_release(&fbatch); return ERR_PTR(-EIO); } @@ -1565,7 +1566,7 @@ static struct page *last_fsync_dnode(struct f2fs_sb_info *sbi, nid_t ino) last_page = page; unlock_page(page); } - pagevec_release(&pvec); + folio_batch_release(&fbatch); cond_resched(); } return last_page; From patchwork Wed Jan 4 21:14:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13088965 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 A1B5DC54E76 for ; Wed, 4 Jan 2023 21:15:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 242C48E0013; Wed, 4 Jan 2023 16:15:22 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1F3978E0001; Wed, 4 Jan 2023 16:15:22 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 093D58E0013; Wed, 4 Jan 2023 16:15:22 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id EF3DE8E0001 for ; Wed, 4 Jan 2023 16:15:21 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id BF6211C647E for ; Wed, 4 Jan 2023 21:15:21 +0000 (UTC) X-FDA: 80318372442.23.B8838F1 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) by imf03.hostedemail.com (Postfix) with ESMTP id 211F520017 for ; Wed, 4 Jan 2023 21:15:19 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=JCPoNtFn; spf=pass (imf03.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.169 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=1672866920; 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=95X87nsP2uu1g0tSzKPuV0qHzijMRAuzyWHPCNhVLfk=; b=nZcDGf31Y/AcZyIzbEBIhOIT5aHa6VvK6fn8dPeqwfm3BK1Ar16QrePnrublcPAPPacMjq ascUe9Io4dX2yqdO0WoENnR+1KzfEdzMWjlsRvgvWZXgw9kWKmrMMyX8Ww8xbIBNn6PR8w 0bBU57+8Pn3mqmYiNU2whaEm2lT1++A= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=JCPoNtFn; spf=pass (imf03.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.169 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=1672866920; a=rsa-sha256; cv=none; b=lafUVrz+JCrwLcorucOAt3oB9ttTfJ6JVAeuseAz3QKJB3Drns2asTUR9GJFp1lTwTQFbk scP3VTEqEjp4v0gbyKUdUXa+zlnEjObwH5mOLQatoazLl+nosR1IRydyOMtwBuQTA4dJ+n s5gt7NNhTwIFk+wyQDwwxtCNb3+IHLE= Received: by mail-pl1-f169.google.com with SMTP id d15so37215886pls.6 for ; Wed, 04 Jan 2023 13:15:19 -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=95X87nsP2uu1g0tSzKPuV0qHzijMRAuzyWHPCNhVLfk=; b=JCPoNtFnRO14zsnrzATg9kL0JDP6tVcnKx3JUX6/3ncoBKAJOrdzAnqcJfisGtVG+1 dpzq+dUPXHOKZJgfHr44JpBFeOtfbWmIahDTecFP0YCOZ21+b2HqR4qxtZ3cxCJVSUO4 8VpfGyEp5nVdeztFirVOET5gBHXuwsM9pBvFeES2ux3EMo1g2WrhlgBtDP1DDvcKoyo9 3cT+mvBMCWl/wiVX2MJDZxNZQbsgenI1tEgLnjzakrMYONEHe9y2YdlGpG40iclkX2Tz iSga8vy8hS5O8VIUTkiKp/uJ+L9iOcKcIjs79iMUkx4gTW6zOE9upSWw0xbISSOb+PNN TSvg== 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=95X87nsP2uu1g0tSzKPuV0qHzijMRAuzyWHPCNhVLfk=; b=Duz7gwWOs5sQ3Ein71n1LO9KxQJgD/P2T3PPJlXAh44T2c6BKCLy43Hh0pGNV7HXz2 02R//+kcs//9RAt90Jbnu3LhKxjbyiXlGi2iYlkyimkDDWPieY34LQhEj9mHDlmZXX1x K2E7iVRHCfQhQkjYdY+DIld3s5v33w1jipJwXsIuO/q6xkTprVKx6zvLpns/3xMX3ZIq iNs2O7Q38XjUjbZ1+z9Qd4ilnZPIZJtkmUwYG8YOvH7BzWybo+IA104Ge5vkxRbhY34P hMwGmw5qWozkOoGWn00caHOilIGzDTUJd5PwIn8GvarOS8BeGQ57qhWES/sAWcASiwJZ gHZw== X-Gm-Message-State: AFqh2krMBFUTHjGE5CI90rEhwv0VjV+YLW2fk+6VJSs/JzGAVedWdeef sQAH5fZq1vxJdxw/kZRYrj4= X-Google-Smtp-Source: AMrXdXv+IJ/1Onv1LqxAjAHLMrh9yjoD4TbJ2m1yweDywr0DpF1fsJfqACSUi/iDN1g4t8sjVOowxA== X-Received: by 2002:a17:90b:268c:b0:225:c26d:4c52 with SMTP id pl12-20020a17090b268c00b00225c26d4c52mr47094486pjb.48.1672866918925; Wed, 04 Jan 2023 13:15:18 -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.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 13:15:18 -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)" , Chao Yu Subject: [PATCH v5 16/23] f2fs: Convert f2fs_sync_meta_pages() to use filemap_get_folios_tag() Date: Wed, 4 Jan 2023 13:14:41 -0800 Message-Id: <20230104211448.4804-17-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-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 211F520017 X-Stat-Signature: pndgxhfunq7bgsgwsyrckymaxabkm4sn X-HE-Tag: 1672866919-191501 X-HE-Meta: U2FsdGVkX1/Ddf+VQuoki/s+1O/9n/ipOjJ8o0QRsob7m2n19NtBPOaHOsB/QvarcLZsOscqQ+0r6kk/l9IbkUhvjbbyL8Un+0jwaRpOq8/IpxXSOTaWlP/eE/rfjC3SAHTwsZTPgWEvNj40t4tYRDonfYcOmcmsaqqWgyW9QYNWqwEjYrxookHDZJ3ES7rmIgHyETu4ToUyzRHr4nfNwO7E3uoV6ahXc5QpHQySmORWYbvgx2IYCKOojNVe809Hqq1bp6Lb8QJcaSmOgZN8+OxQCr3NsEvYvQCiKbib0Wlek0aj6TtOwyTe8VA5twwbIymfOjZ/b8XL8XbcoxJYBD+E3m9jxn3BpNZwpqQnb9bE+Qz9jMKMQojnNiDI4yI/1Ug/0QM3MvJXazc4CLKYotUWg4s+lyOjt3YF3G0/j2y88iVlFUn9z9hLcGCbBf5Q496gkGx5MQPqZUObxLXwTsNVQIBc6f1uHDLP3XJY0h+/qIcJhbnmgRUNfRBJTbHpUIKHNbJa8YbiabNI7HVaNfV5uaOKZT0kgEIdARfuoGj6MPLUz/j5P7Yko7KQkWHBGPNm4C4yNfVbanyjml/uxeBsUx26QV/EkgtEMjmzgrIs3uxExL8Jvvr5gvTCPSkZWS9SLlw6dZeli3oFC30QY9898kDvVKHVoNcYnT9hl1cEKU5gRowKPJLR3Uo7CvPVjyg+AEhsf4xtdpqtnYsNR9unq1KE02ZaNw5qtQ7Jish7eaJSqoimwgCVqBFWlQ5B+GRM5XeMBI4FPbujmaiXq8iZxiHPhZhLi406pv6/zE31rRx8ugz06IndnPP9UqowUiP6/aAUCiFP26bvRMytkqbrGxaGs0gQ8Qrl9+TX68l7t4OTirgLaPCF0vlpSiPEPink/XcbEJcHluFp41Jk5dnsyhRD0oaaE2nYV65vuH+OtSqNEE1FnKqzN6uU5zuO2yhGi9IHzI0pkL9SkM+ YXdin7Yp hI2O56Dpj7ABpCAYMUd3iwwa0H7s3QTFJ2muovYiwQL7u1DFoaKMlV19zZSDP/sf04x32bLnmdmXZ/AQs/+3sSNNroXUfASASOMEUWYrR5bm5EU45gP3aphZV1uB14jr4hovVcrE6tWdoPc4mBvpKFuqQGGIkEF2ZKNfCgdcZW49eK12vcsiNgEPRnz75Wx3o+a4Y9c8B2j4aEnx5rKTqv+fcnD27OpmxmriElZPQYFf6qrhVjwp8Y6RVSMciMHakZmfEfAXPMiCW66Fsd2/30JBW+kDc+qLj2Z4w 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 5 calls to compound_head(). Initially the function was checking if the previous page index is truly the previous page i.e. 1 index behind the current page. To convert to folios and maintain this check we need to make the check folio->index != prev + folio_nr_pages(previous folio) since we don't know how many pages are in a folio. At index i == 0 the check is guaranteed to succeed, so to workaround indexing bounds we can simply ignore the check for that specific index. This makes the initial assignment of prev trivial, so I removed that as well. Also modified a comment in commit_checkpoint for consistency. Signed-off-by: Vishal Moola (Oracle) Acked-by: Chao Yu --- fs/f2fs/checkpoint.c | 49 +++++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index 56f7d0d6a8b2..5a5515d83a1b 100644 --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c @@ -395,59 +395,62 @@ long f2fs_sync_meta_pages(struct f2fs_sb_info *sbi, enum page_type type, { struct address_space *mapping = META_MAPPING(sbi); pgoff_t index = 0, prev = ULONG_MAX; - struct pagevec pvec; + struct folio_batch fbatch; long nwritten = 0; - int nr_pages; + int nr_folios; struct writeback_control wbc = { .for_reclaim = 0, }; struct blk_plug plug; - pagevec_init(&pvec); + folio_batch_init(&fbatch); blk_start_plug(&plug); - while ((nr_pages = pagevec_lookup_tag(&pvec, mapping, &index, - PAGECACHE_TAG_DIRTY))) { + while ((nr_folios = filemap_get_folios_tag(mapping, &index, + (pgoff_t)-1, + PAGECACHE_TAG_DIRTY, &fbatch))) { int 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]; - if (prev == ULONG_MAX) - prev = page->index - 1; - if (nr_to_write != LONG_MAX && page->index != prev + 1) { - pagevec_release(&pvec); + if (nr_to_write != LONG_MAX && i != 0 && + folio->index != prev + + folio_nr_pages(fbatch.folios[i-1])) { + folio_batch_release(&fbatch); goto stop; } - lock_page(page); + folio_lock(folio); - if (unlikely(page->mapping != mapping)) { + if (unlikely(folio->mapping != mapping)) { continue_unlock: - unlock_page(page); + folio_unlock(folio); continue; } - if (!PageDirty(page)) { + if (!folio_test_dirty(folio)) { /* someone wrote it for us */ goto continue_unlock; } - f2fs_wait_on_page_writeback(page, META, true, true); + f2fs_wait_on_page_writeback(&folio->page, META, + true, true); - if (!clear_page_dirty_for_io(page)) + if (!folio_clear_dirty_for_io(folio)) goto continue_unlock; - if (__f2fs_write_meta_page(page, &wbc, io_type)) { - unlock_page(page); + if (__f2fs_write_meta_page(&folio->page, &wbc, + io_type)) { + folio_unlock(folio); break; } - nwritten++; - prev = page->index; + nwritten += folio_nr_pages(folio); + prev = folio->index; if (unlikely(nwritten >= nr_to_write)) break; } - pagevec_release(&pvec); + folio_batch_release(&fbatch); cond_resched(); } stop: @@ -1403,7 +1406,7 @@ static void commit_checkpoint(struct f2fs_sb_info *sbi, }; /* - * pagevec_lookup_tag and lock_page again will take + * filemap_get_folios_tag and lock_page again will take * some extra time. Therefore, f2fs_update_meta_pages and * f2fs_sync_meta_pages are combined in this function. */ From patchwork Wed Jan 4 21:14:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13089066 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 A77BAC46467 for ; Wed, 4 Jan 2023 21:20:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3500D8E0003; Wed, 4 Jan 2023 16:20:47 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2FF058E0001; Wed, 4 Jan 2023 16:20:47 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1C69A8E0003; Wed, 4 Jan 2023 16:20:47 -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 077878E0001 for ; Wed, 4 Jan 2023 16:20:47 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id CE4F41A02B1 for ; Wed, 4 Jan 2023 21:20:46 +0000 (UTC) X-FDA: 80318386092.08.31F0B12 Received: from mail-pj1-f45.google.com (mail-pj1-f45.google.com [209.85.216.45]) by imf23.hostedemail.com (Postfix) with ESMTP id 2F5CC140003 for ; Wed, 4 Jan 2023 21:20:44 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=OncBz9F5; spf=pass (imf23.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=1672867245; 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=+xmszoMF+zXuajEbDNQtanZkcgOmS+CJpLcEGks1cJg=; b=SMRV8fYEFl6jOOQjfWQn9b5xWpZKm9WfXCfhoFrPAZEzBX0rHL3e9t16rwR3MHYX29dg2F vUmh64trVucfDsKXnozk5toRUtVu09sZ8ja3HwXwuFWIt92rBqyt658p0a1LqNnr8WhlWq aO6wgURi4qrRlj1Mh6T/xQxjYLXF+a0= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=OncBz9F5; spf=pass (imf23.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=1672867245; a=rsa-sha256; cv=none; b=pC2bBV2203IdDDEvD+IeKDB4IOegll6JBayMMVyuLJtIYWwmrGMfHhNd5vNDmNGfLc1XA2 YlSFxA9GxbGtaVB11SKvH09GdmWf8KwWmCOFoETLrKJ0LT0d2tjrlnWL0AlTUIPJJr7733 PLa5igeT+rWOxklSjniXl6fTFaj6hiI= Received: by mail-pj1-f45.google.com with SMTP id h7-20020a17090aa88700b00225f3e4c992so27622427pjq.1 for ; Wed, 04 Jan 2023 13:20:44 -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=+xmszoMF+zXuajEbDNQtanZkcgOmS+CJpLcEGks1cJg=; b=OncBz9F5gBo7cV1EReOGwL58RLiuGeHUNG9zdhd9I0bXKATJ5Zhy+0GmzcSRHZkGqe GWyLzbZvdJd/L2NfcZcScrFyPQDUeVa3ZPsrKxfcBXxNsTmcxuJGYX6Si9XAN/vN44PO JWIeuxKk4kEu/XBQv7tTuvTs0ONLCiFiszBqZ22kD1lrenj6LzRTGJaJ35L4UabDI4X9 oDH4s+R9oGwf42PnMqbTSeqPtDYmsw6Hy03fA74G24fm2HmtysF71GUVxhIByHu1D1Re mLiVQ//u9upm+YXU62JZZsO92EKHd72eQkKl2tPz+jR9e+206/W8Bdj6AulQvLoDfNUZ B5/A== 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=+xmszoMF+zXuajEbDNQtanZkcgOmS+CJpLcEGks1cJg=; b=gBWJNHn3XqATpSaUc7Kk+CyFmdjOJW/g+BcmLvWEyoBmzIDCpi9gPo2gueqqdLTcWs hryShoD8NmffDR1QSJ4BSOvsys9LvFkcczS97B0CCet1Qd0KicmHi4/FUTBRdnj1Qx40 ufz6zlH60+LIVrtOINdHTBfXvCIrdsu88x/vFCXeT4Nr7qEeqSc6oBiv0uPNOwoeTzrk DIONKKnh/AfRCVmnUpCvtIWBrz1iJcuXrZqTJMHKsz25XyXpI+p6xNpNAcyrFnO0mi75 vnhTUqZBhJHawpPIM9P8GEWjP7R5XAJtL674EwrfORYdxCeI9Y9tJeKmX4PNZnTJgEhJ jY0A== X-Gm-Message-State: AFqh2ko3Dr0uZkZkAfJlKToG9OFKiWs7tYm+mLQMk6SyDjW6aCEcBm1U YGD56bN4pnxxhvREZIuIrUcWtcit922kzg== X-Google-Smtp-Source: AMrXdXvHnTnnPFQftwDqWW79TZxt6Ds+PTbYHXL3GxE41AK61UcPUBYk4efjU/wb+K+ueTETX1yb+w== X-Received: by 2002:a17:90a:b296:b0:225:d9e7:2728 with SMTP id c22-20020a17090ab29600b00225d9e72728mr40013660pjr.33.1672866920523; Wed, 04 Jan 2023 13:15:20 -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.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 13:15:20 -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)" Subject: [PATCH v5 17/23] gfs2: Convert gfs2_write_cache_jdata() to use filemap_get_folios_tag() Date: Wed, 4 Jan 2023 13:14:42 -0800 Message-Id: <20230104211448.4804-18-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-Server: rspam05 X-Rspamd-Queue-Id: 2F5CC140003 X-Stat-Signature: 31n6iaaq9x9kr1pcg71munrqifodmm6m X-Rspam-User: X-HE-Tag: 1672867244-960409 X-HE-Meta: U2FsdGVkX18SbqcYcJSC/VepcBf+2kNZkNK8lfqrCrNGPVeQGSYKU1wTv+7j7rcbrjILwIv+M5jjFjCRk01HDVuZmXM6IXkg1b3P0vBMnJVjEGN/fmC4Ifxez8kiS9/MkSkDRdGJ6I5O5fgpD8AB5Dh9HNU2pn7KowTjJm68wFf3LIlkpnlO5fTWtGxirt+ybdAm0pNJqMDlEKs8l1EONeJlCuXrb2V/94rnSzq9Y1Zjf9smOzIkXJp/52DLY+4hQQU+DllZ0t2qETz3CCFqhhxvPfH6dAMqVbqTcnKJ3prDHzRUigw6m/OFS6VMcZ/mS2QmxK6aamFm4pFQEueb4tf8fiHo349urEpLtGu/V5HKd2xM18DNbBd3Dxvz8Wb+JjTC95ol9rvfQQp0xNH8sCexZLAcR/G5+pxAJbiUo9p0xYM5oms0GUMxNmutZ10MAqOkN1936CANWkgSns3MMfwOFalJjBSSeBtn6Q1/470CQWCUqZ/EA5PROPWDFJXWc5i+DGr5RzFeDn1OZI3yMnz37IepAQfkt4sb8k4ui74rO9i2XVA3kHTOmRV1hOIlFuts/VbC4x1go1OW83e4dIwmtv4Hk5vmx83ign4YMEztYu9ALkjKEAHZ/ZPMevewH804WNGDOh9sFBW0p9OXf5ZmiDTs/5F7zbegLvF5u9PAEq8SkfeJhB6+lsXAOqiG/8sST4NWRhrrbS+WyYOBFlIWOXVQi8PwfYaYsHQz5bb4CIjVmKKJEd+9ou+5hM9boQFnHAMYEtspBkIZhXDIaEFz4LtV8l67BVG22mQpBsaVpYAqLK8oyeN6USKiOjndmUwiLsGxioyTlKY8+I6GLhptSGXiUKLOjVzCjqvfJtjiiWkj6WmyQFapaEqpk7XS+AUQNwWDuKpTjvtbawSNx6qv1N80uKwWW4XiMv3crWm3HUiOtJp6G7LkfaSQ/QtPj4r7p56Wetq5ymiqP+o UKQ+Q1O3 jFRiQBLNqUc1/PyiNTzTFHCl7Qf2adzpfX5ZcTzzNEUoDnL2xHWkkbEBZYcf5+G7Jxc5p5vaAQZ4gz9EvjFYA55BBm6OKPQnELlsw09HTRjavL/8dGUXBzzAMlXQdniay/y2CQUklJKlFjRpntBLEWD06mAIt3RcCvyc1ZJ3f6VUHu1SypjvKTA/dPdYylIqvQBpc4wFfnaj/DTXIkfw3Otnk/EpsJTxrZg+vWkRdzdqkb9wvNJgJI4G161w4uNAumH5PMumv9rdF61++1e6u126jRQ== 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: Converted function to use folios throughout. This is in preparation for the removal of find_get_pgaes_range_tag(). This change removes 8 calls to compound_head(). Also had to modify and rename gfs2_write_jdata_pagevec() to take in and utilize folio_batch rather than pagevec and use folios rather than pages. gfs2_write_jdata_batch() now supports large folios. Signed-off-by: Vishal Moola (Oracle) Reviewed-by: Andreas Gruenbacher --- fs/gfs2/aops.c | 64 +++++++++++++++++++++++++++----------------------- 1 file changed, 35 insertions(+), 29 deletions(-) diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c index e782b4f1d104..0a47068f9acc 100644 --- a/fs/gfs2/aops.c +++ b/fs/gfs2/aops.c @@ -195,67 +195,71 @@ static int gfs2_writepages(struct address_space *mapping, } /** - * gfs2_write_jdata_pagevec - Write back a pagevec's worth of pages + * gfs2_write_jdata_batch - Write back a folio batch's worth of folios * @mapping: The mapping * @wbc: The writeback control - * @pvec: The vector of pages - * @nr_pages: The number of pages to write + * @fbatch: The batch of folios * @done_index: Page index * * Returns: non-zero if loop should terminate, zero otherwise */ -static int gfs2_write_jdata_pagevec(struct address_space *mapping, +static int gfs2_write_jdata_batch(struct address_space *mapping, struct writeback_control *wbc, - struct pagevec *pvec, - int nr_pages, + struct folio_batch *fbatch, pgoff_t *done_index) { struct inode *inode = mapping->host; struct gfs2_sbd *sdp = GFS2_SB(inode); - unsigned nrblocks = nr_pages * (PAGE_SIZE >> inode->i_blkbits); + unsigned nrblocks; int i; int ret; + int nr_pages = 0; + int nr_folios = folio_batch_count(fbatch); + + for (i = 0; i < nr_folios; i++) + nr_pages += folio_nr_pages(fbatch->folios[i]); + nrblocks = nr_pages * (PAGE_SIZE >> inode->i_blkbits); ret = gfs2_trans_begin(sdp, nrblocks, nrblocks); if (ret < 0) return ret; - 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]; - *done_index = page->index; + *done_index = folio->index; - lock_page(page); + folio_lock(folio); - if (unlikely(page->mapping != mapping)) { + if (unlikely(folio->mapping != mapping)) { continue_unlock: - unlock_page(page); + folio_unlock(folio); continue; } - if (!PageDirty(page)) { + if (!folio_test_dirty(folio)) { /* someone wrote it for us */ goto continue_unlock; } - if (PageWriteback(page)) { + if (folio_test_writeback(folio)) { if (wbc->sync_mode != WB_SYNC_NONE) - wait_on_page_writeback(page); + folio_wait_writeback(folio); else goto continue_unlock; } - BUG_ON(PageWriteback(page)); - if (!clear_page_dirty_for_io(page)) + BUG_ON(folio_test_writeback(folio)); + if (!folio_clear_dirty_for_io(folio)) goto continue_unlock; trace_wbc_writepage(wbc, inode_to_bdi(inode)); - ret = __gfs2_jdata_writepage(page, wbc); + ret = __gfs2_jdata_writepage(&folio->page, wbc); if (unlikely(ret)) { if (ret == AOP_WRITEPAGE_ACTIVATE) { - unlock_page(page); + folio_unlock(folio); ret = 0; } else { @@ -268,7 +272,8 @@ static int gfs2_write_jdata_pagevec(struct address_space *mapping, * not be suitable for data integrity * writeout). */ - *done_index = page->index + 1; + *done_index = folio->index + + folio_nr_pages(folio); ret = 1; break; } @@ -305,8 +310,8 @@ static int gfs2_write_cache_jdata(struct address_space *mapping, { int ret = 0; int done = 0; - struct pagevec pvec; - int nr_pages; + struct folio_batch fbatch; + int nr_folios; pgoff_t writeback_index; pgoff_t index; pgoff_t end; @@ -315,7 +320,7 @@ static int gfs2_write_cache_jdata(struct address_space *mapping, int range_whole = 0; xa_mark_t tag; - pagevec_init(&pvec); + folio_batch_init(&fbatch); if (wbc->range_cyclic) { writeback_index = mapping->writeback_index; /* prev offset */ index = writeback_index; @@ -341,17 +346,18 @@ static int gfs2_write_cache_jdata(struct address_space *mapping, tag_pages_for_writeback(mapping, index, end); done_index = index; while (!done && (index <= end)) { - nr_pages = pagevec_lookup_range_tag(&pvec, mapping, &index, end, - tag); - if (nr_pages == 0) + nr_folios = filemap_get_folios_tag(mapping, &index, end, + tag, &fbatch); + if (nr_folios == 0) break; - ret = gfs2_write_jdata_pagevec(mapping, wbc, &pvec, nr_pages, &done_index); + ret = gfs2_write_jdata_batch(mapping, wbc, &fbatch, + &done_index); if (ret) done = 1; if (ret > 0) ret = 0; - pagevec_release(&pvec); + folio_batch_release(&fbatch); cond_resched(); } 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; } From patchwork Wed Jan 4 21:14:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13088968 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 B320CC53210 for ; Wed, 4 Jan 2023 21:15:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B91088E0016; Wed, 4 Jan 2023 16:15:27 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B41D48E0001; Wed, 4 Jan 2023 16:15:27 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 944368E0016; Wed, 4 Jan 2023 16:15:27 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 8789B8E0001 for ; Wed, 4 Jan 2023 16:15:27 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 65A2F1403E1 for ; Wed, 4 Jan 2023 21:15:26 +0000 (UTC) X-FDA: 80318372652.16.7B006E0 Received: from mail-pj1-f45.google.com (mail-pj1-f45.google.com [209.85.216.45]) by imf01.hostedemail.com (Postfix) with ESMTP id 9BCA040002 for ; Wed, 4 Jan 2023 21:15:24 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=JiIf52J1; spf=pass (imf01.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=1672866924; a=rsa-sha256; cv=none; b=5S7J8MQE6JPjvS4Q7TDXME1zY7ICyLMHxE/FH7064pd1ExVG3uSsotrhaH+FRlhJHdLSZE hrmRPyJxmSS88CFRttP4R80EbeRgKwtqIORcvh4xL4vCDa+lO4AY+eLifPOrrjXqadf2lv ykQef5j8dKITFmar760LtDkr6OzxQb0= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=JiIf52J1; spf=pass (imf01.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=1672866924; 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=wLGgwLr/csaNeBIMYfbH9zx9j3AdiWGm09ROWOa5iAY=; b=VtZhaPaM+JM0e8JY6T/E1VLturkEEKqE5nYXGZrMxf1J20987YPUxow3dlhUncKeJWdSFz dOS1xkau8m41nqwA7xbdEK7UaTVJizL5CSGrRkrom4BvJoZ8Qnu4hsse7CSszRdgF83PlB tsNsvd3/klKxE5t9Tw7EtO0MsFuvQQU= Received: by mail-pj1-f45.google.com with SMTP id o2so32019505pjh.4 for ; Wed, 04 Jan 2023 13:15:24 -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=wLGgwLr/csaNeBIMYfbH9zx9j3AdiWGm09ROWOa5iAY=; b=JiIf52J13fF3RZdd/gu8czce51QuNDKyRmp/RhQBZpiZeU3XEs1WalfwDAIkQP3i1h 7oaEZjWzR8v45uiToP37QSjLBQ6hFoKkzsu//TvxJBpZZTHSu/Ti+0DB14c/uViJpKft LemnBJAU1yNQKcrmO0+Bqi75NqwYHFoh6HrWlcKcA9N4lX0TdQaGXSiQJygzjTysgH/H Ppdlz/iLT+f5FltAthrg93ciA4z+S+CmoY6IExMFrN5abl65NskD8ykG3req494jeVOI SIJLZug6nx7VJLjV0ukQMkHOfmOMT4MrYPY4bGDi0laktjz8hyQhgyGhNDvAUwE+FMju 93bg== 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=wLGgwLr/csaNeBIMYfbH9zx9j3AdiWGm09ROWOa5iAY=; b=WiCXyhp0FyEfWcTDA26+zNu1A85ACLrya8HWCGiH1+9QCiOprPiOMC8LH94B+5ROUC EtTo+oF/n3SvmPQPmdYnc4uAPJJu5o3DCdwdj2gSnpoTR8dk/+Zze4XXbPr97vhSeG9l OwPX4BaP1Qr0DqL+t1aMlTXPY3NujYv7QC7AR1rIT7eE5hukU+gyIoi5bhrTuKfXNDq+ Vwsodr1rWCqHu4ViGrjNMPaFXppTbYa/TWGS5NnK6Z6/EPv/CPgkwQamoqfaRA0kePVL x+/5Sd0OSMXn8M8cRpnc3299paFp/G1BPIJ8ivN67hjm2Xs6AbHUZk4EM3GlxF1WFzS8 tJog== X-Gm-Message-State: AFqh2koNcPyn4K5Co+j4IsUn6HwCszfEp/NuoCgKSqIj8flIfXC3cDxz oIVXUyKQXSY+6xCD81WBbr0= X-Google-Smtp-Source: AMrXdXs7s+m/7nsrgJ9l/mJQIpEV7Y/DeAKat3L22TbeUL9zUgX6QTynjS3828Iu+F7/uHuvxs7fOw== X-Received: by 2002:a17:90b:794:b0:219:64ca:49a0 with SMTP id l20-20020a17090b079400b0021964ca49a0mr53526904pjz.22.1672866923492; Wed, 04 Jan 2023 13:15:23 -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.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 13:15:23 -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 19/23] nilfs2: Convert nilfs_lookup_dirty_node_buffers() to use filemap_get_folios_tag() Date: Wed, 4 Jan 2023 13:14:44 -0800 Message-Id: <20230104211448.4804-20-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-Rspam-User: X-Rspamd-Queue-Id: 9BCA040002 X-Rspamd-Server: rspam01 X-Stat-Signature: zfno8pgw8ecdqsfkbdtfywxq8fnoyyc6 X-HE-Tag: 1672866924-999594 X-HE-Meta: U2FsdGVkX18Xx7U2XxZcjFhc1JIDXMcL0NStnu6mM6KXHGt7s1y37htjkyPelI3QyVvdROuQ9Z+mAvo6OxcuRtxv1vVwcrL9e4A6o3Y7h41+dG+0BlD+z4qVZzxznFBvTGNaG9QTbjSW3dFkLhFgRwS2sxRZxlyzMz+kL6DyR6s1zQn75tm+iU27dWTlJz5iYgFkHiDP8Kad9ZW+pk6YLk6BpsgCMS2Nhh65LYjG1r3RL0NQUYCJ02YjagY3yhFZsv3ockosjmKOQHq4jPFDIWZBdYVFphyIG7H5W8eo9Snz/ZjdPpe0eyg2eUy8zyKwDCHavb7RAafmbQzIKz25YntUY4L/Wal9WhoD5ON0SuxtnPrae9acCzSz/CeBluH8UiXbLqfwwjIS8/7SaCf9AGlBHz4uYyuvagzhaasIe+cifR68IceMGc3EZwqrldKb04XHuuKlnSBzFDqxM/FXIeloKA1WdxysE0hc5ZnT138eiSrTY0WG3ThjLRQUISbnBTNH95JOpzXLe3iM8YtOQjQz1r+LWc0broAmxYrfUWRFML/W4dHCfYGSGxm5ObtyFidI2BG00i9NrOym77/euQ4sdeiWcoaslRtPmByfjJ/mFrdtG4mp4g3H16ltPSW2WVpQb3ZCd9SVww7A3x7jBzEYFL9j5T7/3Z6xiwEmlZ5Jl7bEDFkkpUSYv4GZhi5edbNFpUvUw7elUiLRRyIowBl3Llct7Y2IcbDW179YGgKPBPxtV3Zx1tfUUhZzmBPR/tV/dIVJHpoSIpnD5RTOujvdSKib70dJymXYEtkXmvaf0lJb+HGDQuEvWkDLPkKu30hFkOnfwCX+NZxj1Yl30EkFqJWsNmyT3zbWexKH/5dtewnA4w48SAvlmiXoeQ5VWuiCj+Gz0IUeBUU3Wr8/DZAcGkhz363MItHVFgiB7EWgCygJ2753yaBxPLPVvsRVY0Zoyf3HlC7YFhgnwRx kSHVAJzL H+8JVHB9wu3yKSuqLZTtLOdnKP6/QBfBG6IMO4HKzhO87jpx7K2opw48Ia5wp+yDKc/e9AFuuAU7dfx4b8PKRh/tBvmdIiiyfpDXyxm6rJqMuXX4IEdJFW4N/FdZjZECZwncaD9p4rtcr7c7uSM2zegRMKU2ENkJjZwSCbu004DDmT86OEIifSWqN9i2e3KsNHm1BBlasA7RMVPq5e+rDz12HsK99MH9bUfU7vtVZIVNd1VRawMW4WnZj9c+fBeUX7q4i7+WqIlzjbkDb7vY1SjiEOg== 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 1 call to compound_head(). Signed-off-by: Vishal Moola (Oracle) Acked-by: Ryusuke Konishi --- fs/nilfs2/segment.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c index 8866af742a49..da56a9221277 100644 --- a/fs/nilfs2/segment.c +++ b/fs/nilfs2/segment.c @@ -737,20 +737,19 @@ static void nilfs_lookup_dirty_node_buffers(struct inode *inode, { struct nilfs_inode_info *ii = NILFS_I(inode); struct inode *btnc_inode = ii->i_assoc_inode; - struct pagevec pvec; + struct folio_batch fbatch; struct buffer_head *bh, *head; unsigned int i; pgoff_t index = 0; if (!btnc_inode) return; + folio_batch_init(&fbatch); - pagevec_init(&pvec); - - while (pagevec_lookup_tag(&pvec, btnc_inode->i_mapping, &index, - PAGECACHE_TAG_DIRTY)) { - for (i = 0; i < pagevec_count(&pvec); i++) { - bh = head = page_buffers(pvec.pages[i]); + while (filemap_get_folios_tag(btnc_inode->i_mapping, &index, + (pgoff_t)-1, PAGECACHE_TAG_DIRTY, &fbatch)) { + for (i = 0; i < folio_batch_count(&fbatch); i++) { + bh = head = folio_buffers(fbatch.folios[i]); do { if (buffer_dirty(bh) && !buffer_async_write(bh)) { @@ -761,7 +760,7 @@ static void nilfs_lookup_dirty_node_buffers(struct inode *inode, bh = bh->b_this_page; } while (bh != head); } - pagevec_release(&pvec); + folio_batch_release(&fbatch); cond_resched(); } } From patchwork Wed Jan 4 21:14:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13088967 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 18105C46467 for ; Wed, 4 Jan 2023 21:15:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5EB978E0015; Wed, 4 Jan 2023 16:15:27 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 59CB38E0001; Wed, 4 Jan 2023 16:15:27 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4648C8E0015; Wed, 4 Jan 2023 16:15:27 -0500 (EST) 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 37F448E0001 for ; Wed, 4 Jan 2023 16:15:27 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 1707540D3B for ; Wed, 4 Jan 2023 21:15:27 +0000 (UTC) X-FDA: 80318372694.11.60DA3D3 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) by imf03.hostedemail.com (Postfix) with ESMTP id 738AD20002 for ; Wed, 4 Jan 2023 21:15:25 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=l0t6NL5S; spf=pass (imf03.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.169 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=1672866925; 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=BlC7rcv7uN/Ok17R0azuMVwGkvRCqLRr8I16XJ1l0Zg=; b=V9ZDDNWltXqM5kW4vkwKpbndnjp9WbLUt56CxV6lbudEwjMm9hJByvTP13qIpu4vjXZ1nV EHMdHfcjGv9WJpTLz/1HXz4AupyqQq0BIC1y+J6rVHbsjVqXITYIUCXrJACbV4cgb3YQC6 sTCVVq1HRM/mXTn5oTKeGF+tJBEsf2Q= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=l0t6NL5S; spf=pass (imf03.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.169 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=1672866925; a=rsa-sha256; cv=none; b=RYnu5+iByRTXqNVNjqCXet2uIlpMx2bqHras/l9jZrbD2cURFRkd5fQmPSawq/rJSnvgLA AVfEHQsFKtd69uMGBzpZ5GZOmGKwXYwRaKJCyqpTDW8i/xb0MeCiqCG8RJ7fuV/mdE/lFG qObGAUORJqKaPoPX+/IZtEEV7DUoSf8= Received: by mail-pl1-f169.google.com with SMTP id d15so37216306pls.6 for ; Wed, 04 Jan 2023 13:15:25 -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=BlC7rcv7uN/Ok17R0azuMVwGkvRCqLRr8I16XJ1l0Zg=; b=l0t6NL5SCvyD8kdyfFc7nOlzhreLq5VCcEZoAPCjS9SYlOOIdyy01o8enEBrI/r1kI ge7wlbNG0U5OHLin8Sv0DJ9D+P9p9F9nvhdVsVzqSo2MjhW1QMKBlTmQftWK0E3Sq3mX s5i3P5LahXYCAZDxiD7TON2xAC7xlyma9HMVO7+C60fEOzvSJBRZE+ygGDT49ocIptx1 ZqodBy1UQufx3eUsdyctWHg9lneTCyK6t6QfTsYnGyQ1gnGKfPEGcEh9fBK7H9Fo86Cv 0aWOKjYHhKUcF745lohZ9dh0iABWPhdJYkbVa6/m4X3OwsSxOaXcOBpLjiswo+OAnLFc jYVA== 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=BlC7rcv7uN/Ok17R0azuMVwGkvRCqLRr8I16XJ1l0Zg=; b=V8UwNyCfVGW4k38THZynNoNz1Kc1eH3IcwnwCMsqQxjIHadstA+gxPUTZSd4H61jj+ GIRhngyfERFN6TeuYJYS4dofCQ4YBPIMdbr6SHpL8an/wLOwe5PRxZkEECgi15+bXai0 CgTLhzDeP92DR2rm6Psw/6vkctNT3BPbKAD/8QiYS0bEYLrG9P9JqfsDgyGYZgF2SoQU fCIpFlSKQiRF7tyEbvxF3XYFwv/pchz0PQ+X9Ihs1bzkz1Aao3egNQj3Cnw7aBJnaiUg Rad3TRW5rw6VKnLXUgwzcPoBvcLYLfUljyNYclxD8Ai/CYUMqttymUb/O0XHZCL4TdSh qurw== X-Gm-Message-State: AFqh2kqQ9sjeErUs7NgeQEnuEDGAa82MYLvIpIeXbqnRcCNpl81d7NKX kls4etmssi9SeClYqXLeOmU= X-Google-Smtp-Source: AMrXdXtmjSnTHrGQEHw6VbNzkxfY/pt2X9Tas5/n9E/HJyc3xHf0BuAuSYZ6Gu+13LxzPXvTYPQi8g== X-Received: by 2002:a17:90a:7341:b0:225:f7b3:aebf with SMTP id j1-20020a17090a734100b00225f7b3aebfmr34765688pjs.30.1672866924907; Wed, 04 Jan 2023 13:15:24 -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.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 13:15:24 -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 20/23] nilfs2: Convert nilfs_btree_lookup_dirty_buffers() to use filemap_get_folios_tag() Date: Wed, 4 Jan 2023 13:14:45 -0800 Message-Id: <20230104211448.4804-21-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-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 738AD20002 X-Stat-Signature: 75xcfd887ce518zwwyor14mfrmcei9xr X-HE-Tag: 1672866925-307502 X-HE-Meta: U2FsdGVkX18fGWxKK9Y49UhIpDx8EwjrzUhLaqtPMcjViHt4sY2hOWmErV3LuwNDHQwJB3MirUp0OwJGzOu+B2Wnk6ahBNLL+SNJU6dFApGshjCk+oTgN5m2ntC13EWQEJeDnMei+iiPoHhltmVRsQ/U80WLvRnKjatyIgb+YXalTf/UrpYtgP8h+9LvgMYl+dgeYRdclgZSGhvK6JHi4FjrpptCBXTCNu9oJNTd2CnAjuSzng5XLp6buKuNNCH/eLhRp2G05U4wxHTXKr+haUaBcPt3wv8ZCNhucU0LvecXLmEBCLZWdDHwVMGPIXQ7huacAGb75MVFoIqnjQac1l1GLFcNBzc5edtH5ZuQeWspFz8n0zQx1G3hS1inN1Ed8sLKrZRZ9PfkFidRsohJtHPd3KhH6N3bTeI7pek8wyzSWmGHLRt7l4ElUhGnFbwxsgiEFNT4vxSINlRzDPQ8qBj7eA/rjvf/9eXbkd2G/162S//EPEyLhDKYTolb7mF6x83OwcXGFwCZvVBrAPa1kXH/kVQVEhDx7k9q9oEwDNBWB+cGfgCVHcy5+wvDXcPdk1SroRmaDLvrfg2EhXh7NfEoTCum8bndm0CCSvCpnTAXpqktMwRVX+AJZfCr3LBKg6clC0jcfzlTM+1Fd3YvCv4ayjKSa0qHo9IDqLdjLAylua/dYuApp6veM65mERVnJjZ1NYviwYEYmtw0FIA6PJN2j4GG73AGOOJM2TRaoP2RZZ52+8Kb2mU3A//PB+vfhvaXWIeT7B60zn2tAUbkFM4W7o47qUy9Pi9AnQ2iPJSiSqbCdGA5paoBN/JRguFGyNeM0FfO1Z9YINIhPxFhNj3eMIppdmL1DVobJmMhtftax+TNljFWobDXoxbXOmDZ6BsFQ3f4W63in6WaP9sqJHg/omsLo+XOv8Pim55k0PhKbFwZCCH5TzSw8DCV55RKKWqISCSScrEhDKWbVy9 6/QnR6WY rndBaHn56eXcnROZMU7EvdJvfG6alYtqYzwKbl7ZNsk7Omy5eA5oSS+26nITqMh9EyOo+AREB0iIHYqWekgG0durszw7ZrikjCMf2liFZoEm5UGd1QJC8YugvxCRtE2YH8BdF967771XtPyFN17iHPzlyAZK3XGsPsMFDJFCbh3MOEM3+WJwtgI5z1KozmkX6vWoKpTZxCAO5kwrkQKx8sh1O2JKAehuR9g0ztotqVMFcDNWl9mvnWFM5nz319VDyd/+3SxQLrbdK893YMM/R87SUdN3c+/EYVnse 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 1 call to compound_head(). Signed-off-by: Vishal Moola (Oracle) Acked-by: Ryusuke Konishi --- fs/nilfs2/btree.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/fs/nilfs2/btree.c b/fs/nilfs2/btree.c index b9d15c3df3cc..da6a19eede9a 100644 --- a/fs/nilfs2/btree.c +++ b/fs/nilfs2/btree.c @@ -2141,7 +2141,7 @@ static void nilfs_btree_lookup_dirty_buffers(struct nilfs_bmap *btree, struct inode *btnc_inode = NILFS_BMAP_I(btree)->i_assoc_inode; struct address_space *btcache = btnc_inode->i_mapping; struct list_head lists[NILFS_BTREE_LEVEL_MAX]; - struct pagevec pvec; + struct folio_batch fbatch; struct buffer_head *bh, *head; pgoff_t index = 0; int level, i; @@ -2151,19 +2151,19 @@ static void nilfs_btree_lookup_dirty_buffers(struct nilfs_bmap *btree, level++) INIT_LIST_HEAD(&lists[level]); - pagevec_init(&pvec); + folio_batch_init(&fbatch); - while (pagevec_lookup_tag(&pvec, btcache, &index, - PAGECACHE_TAG_DIRTY)) { - for (i = 0; i < pagevec_count(&pvec); i++) { - bh = head = page_buffers(pvec.pages[i]); + while (filemap_get_folios_tag(btcache, &index, (pgoff_t)-1, + PAGECACHE_TAG_DIRTY, &fbatch)) { + for (i = 0; i < folio_batch_count(&fbatch); i++) { + bh = head = folio_buffers(fbatch.folios[i]); do { if (buffer_dirty(bh)) nilfs_btree_add_dirty_buffer(btree, lists, bh); } while ((bh = bh->b_this_page) != head); } - pagevec_release(&pvec); + folio_batch_release(&fbatch); cond_resched(); } 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)) From patchwork Wed Jan 4 21:14:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13088970 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 339DFC46467 for ; Wed, 4 Jan 2023 21:15:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 26A648E000E; Wed, 4 Jan 2023 16:15:31 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1F3838E0001; Wed, 4 Jan 2023 16:15:31 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0B9978E000E; Wed, 4 Jan 2023 16:15:31 -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 F0EFE8E0001 for ; Wed, 4 Jan 2023 16:15:30 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id B6FD6C0AF7 for ; Wed, 4 Jan 2023 21:15:30 +0000 (UTC) X-FDA: 80318372820.11.A886F9C Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) by imf08.hostedemail.com (Postfix) with ESMTP id 0AABD16000A for ; Wed, 4 Jan 2023 21:15:28 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=UBQCqBmy; spf=pass (imf08.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.169 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=1672866929; 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=T3e61Fb9Dqh0rLEzgpxaQ/B901JahzW9QwTImcYRDNk=; b=n30lP1XY85IEbWXoWSsGnAtn2oiUcDZVyPOyfU24ZwoROB4tuanrqlLECJ3QXKdrDAGtKO /hxJjb/CbdODkgFhm8nRiGN6W1mR7L8vXDsGUdtKCnMWO7yvnE2UG6UbNjxkjasYnS1wLd /XE48pmx0aUlAUqsz58QXFcK/1j8CqA= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=UBQCqBmy; spf=pass (imf08.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.169 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=1672866929; a=rsa-sha256; cv=none; b=Rsx2oIkRcY+z34sDQprjl4+dqLgvFAlmZSu3pfpNbKATNYX0ox2Y8igwkMem5F+kCtLF51 myK7rsD9ug34gLQ0V+eYny2lGNYsEpCmR5pnL0k9rPinwNuFhPfIq7frQObl3WP5KClnIE K+4x9xeY8EJzU1M/XaDzV6lHPlWjtw8= Received: by mail-pl1-f169.google.com with SMTP id d3so37196247plr.10 for ; Wed, 04 Jan 2023 13:15:28 -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=T3e61Fb9Dqh0rLEzgpxaQ/B901JahzW9QwTImcYRDNk=; b=UBQCqBmywL4fUPJmhQf3YO25m2vTpABZ7JRHVBIp9YSGM9aBhK1+4doRUWlbWnsNJ9 Ri79O/oHwGRqdLDoOxs8sNow2cNgbFMi6rZM99Z8qkiDtf5RaRCZ4Kiu+XAw3ND4YT+u uDMmwZa8+WDxJFatrXomU6Jxo2q5TCu5LR8/+XU4bnk9/TKJjWw5uFp/Zql3YXSztlcv tPDl0TN6IFTK0eTV0pDEOzPAZKdfzyEuk26yFkDyIUgZjfBa24lNPQ9yT8SpkbUHty0V Dwqcs2O9toxSYT9cJLwgyCSs/UOYEjGnysOmE6RW+/9UzSlDVIaa12qs1vX0TjSJY9qH c1xg== 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=T3e61Fb9Dqh0rLEzgpxaQ/B901JahzW9QwTImcYRDNk=; b=sL/Zk7wvRZnoXuykUnmu+e5DiaYZFnojNPR2ykIF5FI0+R09S1vcaGsqXKvKl/5mT5 Oi6KIu78xcpfkCofBuqCNMeW+inNvRWlxSF5PlQ27YiioMPw4GPAFRWyvV9mEwb9/LIZ OQWV8qPrH8sES6/rsPkpNQeXBpmKiWNiPIGqd9jcqlXlwOCtqRwvjp+1lijQIACuii+v I6SH/NOXZaWCJREudRh8DDtm7V7OWxTqtHXeOWEORW9RFKKqZji6wQvjpbtFvb1ocDaS Ux0EgG76I3NF2/mRRTfQkKHy1PHMYS/hsGHlq7o8FVR3aGDRf1soM2yvzhXsojgBdAOf qlpg== X-Gm-Message-State: AFqh2krOXO8U1ULq8LAFOpXno5Pv1FlapLVNuX3KdQ96SeNheD7KbEkK Mkt6P4Z9udld6CltJJjZPCw= X-Google-Smtp-Source: AMrXdXt6Y0kwAGb+h+EXze57cC4InRsKukIyGk3OA1Pq+5Y3FkKS+kdTcpuCqYx01FIOGAuf7ZNWuA== X-Received: by 2002:a17:90b:92:b0:225:eda7:13e with SMTP id bb18-20020a17090b009200b00225eda7013emr35758753pjb.40.1672866927791; Wed, 04 Jan 2023 13:15:27 -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.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 13:15:27 -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 22/23] nilfs2: Convert nilfs_clear_dirty_pages() to use filemap_get_folios_tag() Date: Wed, 4 Jan 2023 13:14:47 -0800 Message-Id: <20230104211448.4804-23-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: 0AABD16000A X-Stat-Signature: nji465e8jxjatfzr7szi9ig59t8z4qg7 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1672866928-494033 X-HE-Meta: U2FsdGVkX19M55hXPXzmNQ66WOJGIjLkBjOHHEjKul/P1fjkHhifOLV2mqIes4JTE+/mmTK/EGnjkwD6iKm2IOYj3XNaoeIvsNvQa6mWGqWp93Vwoq87V9JSBqv/LtkSLxyt9dTuDbAT5F0tVxuwAV36CpsDJYplIYIV8mPr+K0GJUGgDKnBijSc0ilAQDBjUCCrP/T+5/yI5BlxgoaiWH6vIn2RMQ7Dp0rYJ/D5peY9OkZkRZ4gDq6Hb+VEvaybQgzwfo8MwlQATlWJhXGRSTXi1DQWWC0+4b1LKny3BQhDe/OCcEOkAEeSqwFR3u1+jPXKItDIRB4OzIICafV6Va8MJVTSkTlfEAiYRBjrxhKm4hrVTaSmtiysGBZV3brTtEZ4EWl+fTUBU4q56W0zZFP17bxyRCAukdRs5v1EaQ3um63lNsuBiXhfh81VgfMMrvTjBRUn4o+R9vFfvLeHe8x8xsB8CwZ/7aHLGlpjv6/4syt8VjT25sIHaVTGbI+bOQdXTdwQRbqRP1APBgdOQ/d+TFHHGlmePqFZqbbDH2+WmLYYKyHeMEGENE4bFc3fWOAWr29wOhKU0QgfC8YotUnckt2agWY1HHmbyfEBeOhdnIqvoiTf7n3s9CrgNpEDf6jSgLhz+YQi6+LPf4Oa5C35qRM8A59SbjxRPsv27LYE2XTjtnj8tw2/6lr6r9pe6CO17/Fq9P30CM0CfAIBRPfNrHYpgJPBuhOkjCivhdSoelp3jNIAHRW9yEad9aeX+p5PH5Dx4x+I1bVyyQikAuhe/pg/uSEL5TQ/t282YjQ144hMEQ9KOowb+lVlf1lZwg96Q0jx+sn2fQw/41JgwvUYsExxIBJJL2AiMVLhrt+14fFRD7fzebfBShgIN1hd2IlzmRAfXkH7MnOLEJY5diBZStkj6xeSNCMjsiQB7bAlMFTFD7XdpKI9+lCmZHylZw6Ngw+yAS2gVGHE7V6 BK+16rM1 YaTuXO0F0Ue2RS3Adn+g4Tm0vPo0ytJJ7zjMJls7bDRNJ1etJzk1GSZu/QExDUURExfQxFMUjhzRfjaVfPq2cnwwrDZDZDYrTW2Axqn9HWjhO1e6KPQ+kBMSBu0XF1Sz2mqsc13oy9HbJnuR1kPp9ZIF7rOoRGTtHvxvueDAXLWTWPi2GUp6FN3J4Gcaj+Pk4i9OIyhxL0OdCOL5VamtS6okCJ0QJaEdKUVRm8ESfWqYdXFPj0co+3/16SOsoOMGyTJW827IluhWtP+gsE+SDPknTS3HftDpxFNb6 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 2 calls to compound_head(). Signed-off-by: Vishal Moola (Oracle) Acked-by: Ryusuke Konishi --- fs/nilfs2/page.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/fs/nilfs2/page.c b/fs/nilfs2/page.c index d921542a9593..41ccd43cd979 100644 --- a/fs/nilfs2/page.c +++ b/fs/nilfs2/page.c @@ -358,22 +358,22 @@ void nilfs_copy_back_pages(struct address_space *dmap, */ void nilfs_clear_dirty_pages(struct address_space *mapping, bool silent) { - struct pagevec pvec; + struct folio_batch fbatch; unsigned int i; pgoff_t index = 0; - pagevec_init(&pvec); + folio_batch_init(&fbatch); - while (pagevec_lookup_tag(&pvec, mapping, &index, - PAGECACHE_TAG_DIRTY)) { - for (i = 0; i < pagevec_count(&pvec); i++) { - struct page *page = pvec.pages[i]; + while (filemap_get_folios_tag(mapping, &index, (pgoff_t)-1, + PAGECACHE_TAG_DIRTY, &fbatch)) { + for (i = 0; i < folio_batch_count(&fbatch); i++) { + struct folio *folio = fbatch.folios[i]; - lock_page(page); - nilfs_clear_dirty_page(page, silent); - unlock_page(page); + folio_lock(folio); + nilfs_clear_dirty_page(&folio->page, silent); + folio_unlock(folio); } - pagevec_release(&pvec); + folio_batch_release(&fbatch); cond_resched(); } } From patchwork Wed Jan 4 21:14:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13088971 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 DF19AC54E76 for ; Wed, 4 Jan 2023 21:15:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3F33B8E0018; Wed, 4 Jan 2023 16:15:32 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 32CCE8E0001; Wed, 4 Jan 2023 16:15:32 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1F33A8E0018; Wed, 4 Jan 2023 16:15:32 -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 0BC008E0001 for ; Wed, 4 Jan 2023 16:15:32 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id E2A031A06AB for ; Wed, 4 Jan 2023 21:15:31 +0000 (UTC) X-FDA: 80318372862.02.5F50FFE Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) by imf02.hostedemail.com (Postfix) with ESMTP id 5896D80012 for ; Wed, 4 Jan 2023 21:15:30 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=dI7AOinQ; spf=pass (imf02.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.49 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=1672866930; a=rsa-sha256; cv=none; b=Y7PfnOQ2DAWEfBrMKoRFSx01wRyWC+nPuu7PwDJLHD7KQa5O8mDfDgbsQzm+aCfL1SdMuz r0q3MDz2Q73oV+dQu2sNIp4z1ehre/zJVePlk4D2Bsy9De9VK8Lb7zrqFYlbeErTkOLaMK 0qsloln1BMzioWVRtIsPOjKxv6RbUcY= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=dI7AOinQ; spf=pass (imf02.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.49 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=1672866930; 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=4RtaC30O7Atkln5EkUr8a2iVlJILm+qXX7isWy43phI=; b=Z38pIbHxQNSgu9d3xb3W2X5lIVllIXO2AmFWbc0X/ynfA5OmbzoHXk+XTb66EkGLY1MRmO 6sQp6Wo6kZbW+ZHmG0OYCkY1zyQnVkE/baMwHgL5qAEXujHAXcU1jCPe8mlT89Gh0u/tmI teHzMbiHIBh7WecFdls7ulSFBKcxs4E= Received: by mail-pj1-f49.google.com with SMTP id fz16-20020a17090b025000b002269d6c2d83so2113765pjb.0 for ; Wed, 04 Jan 2023 13:15:30 -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=4RtaC30O7Atkln5EkUr8a2iVlJILm+qXX7isWy43phI=; b=dI7AOinQpZsTE8QFnkWx5x7pHBIx2GIKp/y/hPSc1NHAIhQSCV/YW9CIK9cZelspMz /UcbMNCeprdqj2GgjwjFWFax2vwmTS97zF8XvJynP1ckPDpwGdDlfgcvFL/67PrZtHoe 8p3Tw9Jon6YIgT2dQef0u6QzS5v45L3ZduPZ7Vuz5T+efr2+eM/L19V2q4WYQQWenBXe r/FJhL2oCKug1uqMTJTCUDKbhH4a7abWBWe80Bzb0hil6lc0QxeilyS7fU95p9sAo3Hd 5RiIKFAfe4YEQeX4Nw8KbDxJ6n6FANkPiGgIF3O5WGmAPzm6MuSYa4JZ31MPUbzgC2kF JUOQ== 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=4RtaC30O7Atkln5EkUr8a2iVlJILm+qXX7isWy43phI=; b=3+zizsoeVFKvE67wznvf1MCq14u8s72NmgMJOSskvY5fwK3OYD5FhUv1QXM9++Vrz3 3cCn6satt+7A8z7n4dpee0P5eNF1W9k/arWu3Z8yYOllaUTqEifVvhRXnmemmHGu+/k0 5yAZ3CVFluzKphOoWqCigIf8wme479pscv1azM7Rn3eMgFiFnVaOJd0Lk3skCmoS/9af oTUXX+PlpeMWI6BNjtY0n797SiS+hK5cNWD/Rb3VQtqKS80TpXMXXeqTe5QTfZayB6DP cTDwj4IB1yXyT6kuoN+YrSX0IA4k7ojAjjKdDM2HrILvZU4UMDsCxeDmX3F0sPXwHs+S OqSw== X-Gm-Message-State: AFqh2kr3xfBpsOuEgtwhQY/k8sLWnzDI8EJw/p9F6HgjvdlE47tVQ5TQ 56qZCiTxdzWBcyP2qaMfpKI= X-Google-Smtp-Source: AMrXdXuPAz2h5R8V/Em6rEDV3mKeDGvzwSSguYGVRMwHcsp8CRceXnVJ+9DQaRs2mIwZh0/fEI9s7Q== X-Received: by 2002:a17:90a:ab8d:b0:226:7efc:989b with SMTP id n13-20020a17090aab8d00b002267efc989bmr10104588pjq.49.1672866929215; Wed, 04 Jan 2023 13:15:29 -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.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 13:15:28 -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)" Subject: [PATCH v5 23/23] filemap: Remove find_get_pages_range_tag() Date: Wed, 4 Jan 2023 13:14:48 -0800 Message-Id: <20230104211448.4804-24-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-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 5896D80012 X-Stat-Signature: rhc95t7se4py6tod45j453kuwqndsjy5 X-HE-Tag: 1672866930-496111 X-HE-Meta: U2FsdGVkX1+hQ0P8U3qiKOW08IK82nM58mCR4qegYeOpGpD3ypSBYC3IH92MM2sxzVhB5qnRxMdmjsu5AvDsxFcYdWFuaOAB2D/fubv4U1An8VUji7KQKKxvYH5Czgju3ZgVKxB8nBVIxeg5jvKY1TLVz6qKlyxSbm8/hJpv0ybA9nQEbD6MFp3Bjr8WFu3wt1V9AZdITyxgxEo6x0wZxKfpEUj6kdvVwBSbWYsbZMyEZVxwrNcrNRF/zusTItZ2rTe2JkgRepOVCgKXRvcwL3gl9jmr3ul00hE2TFTshkzfJtXsv2JFRS//vmtq+QqK+MK4y0/m/CDCULT0bYE1NP65DIRdNeqgPHxKV7FKrctkDlsnpDE8tv5ZLi2ni6eofl1oOPqo5uKr3TEJLzOfrXz+Fm8AnZa72w6vFdwHuEgi3a6Nn7/2TOJF+i2Y1v9lYm+aaiujOFVwK7qWp47c/b34QALqq9a6/KmwDdWj+eNdvAcw8jxTJv/El15E/2USQ9RdPwFJA6wLN1Owx/Bvop/69RXelvjwIohaZX0lNdf4ThWBrGBvTTByqm5c8bBZF40xTOPt93cCp+q7y1layetP0Cu3wv+tnLKXZWQ6C81UnKgIhudZCsIkWrObdpCxvGd0y9YUB7HhIkSUzSc+LMbN+iFWHevpIkspgbiKqBKnZW6ghdge2cK/sT+PCwM23+r/ZKOekICLV7RJG9lBdbn9NA2J4OvzULPTHZlwO+HK1Yj9xVxieOzZPBZPPzfeXaLnDfD8ZAv9lomWl8l3nqzYACYDMVlHeo6L19pb4l8wrptcC0BdULv7Xcm/ZKrJBHgsRNsbmtK11aJWJEYHDhgCQvIhbtvRhNun0gEGG/pd8VewZjMQq2y0xCGhqLw5gBH52yxXWsh5vKCpwd+Qwpy4Yr6wTWoxEtvWNY7wIGki7C8zaD3GocMuKaF1qLyGpWOy5C03j3l5PAu70Va TfUOeoME bichpTPRioRSMhMBIa19i9Zsw78OZvev2XPnUK3V0jRai3KrKw71Zv19odq/nhyIm58ahF2NzCgs76/xfeAYMWz7hlqxvQTIH87E9CDAvWvgfO+3QbBgsjw4Yg7RKNfwNZYteOyDWrQKPI12pLZ8Uiyx1XRlC3lglwLwzdf8xXo1MsX0v4n63G3/QIl09T6poSsI39g0eedUVL6oHFBrJMTrhwSBSDd5r4KYG/UOQwp4mZ5RLRHOVmMAaXXMHXt9GXIx6rLI0Nmik6f7+5rya6D95Ycvzotl7Fy5e 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: All callers to find_get_pages_range_tag(), find_get_pages_tag(), pagevec_lookup_range_tag(), and pagevec_lookup_tag() have been removed. Signed-off-by: Vishal Moola (Oracle) --- include/linux/pagemap.h | 10 ------- include/linux/pagevec.h | 8 ------ mm/filemap.c | 60 ----------------------------------------- mm/swap.c | 10 ------- 4 files changed, 88 deletions(-) diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index bb3c1d51b1cb..9f1081683771 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -741,16 +741,6 @@ unsigned filemap_get_folios_contig(struct address_space *mapping, pgoff_t *start, pgoff_t end, struct folio_batch *fbatch); unsigned filemap_get_folios_tag(struct address_space *mapping, pgoff_t *start, pgoff_t end, xa_mark_t tag, struct folio_batch *fbatch); -unsigned find_get_pages_range_tag(struct address_space *mapping, pgoff_t *index, - pgoff_t end, xa_mark_t tag, unsigned int nr_pages, - struct page **pages); -static inline unsigned find_get_pages_tag(struct address_space *mapping, - pgoff_t *index, xa_mark_t tag, unsigned int nr_pages, - struct page **pages) -{ - return find_get_pages_range_tag(mapping, index, (pgoff_t)-1, tag, - nr_pages, pages); -} struct page *grab_cache_page_write_begin(struct address_space *mapping, pgoff_t index); diff --git a/include/linux/pagevec.h b/include/linux/pagevec.h index 215eb6c3bdc9..a520632297ac 100644 --- a/include/linux/pagevec.h +++ b/include/linux/pagevec.h @@ -26,14 +26,6 @@ struct pagevec { }; void __pagevec_release(struct pagevec *pvec); -unsigned pagevec_lookup_range_tag(struct pagevec *pvec, - struct address_space *mapping, pgoff_t *index, pgoff_t end, - xa_mark_t tag); -static inline unsigned pagevec_lookup_tag(struct pagevec *pvec, - struct address_space *mapping, pgoff_t *index, xa_mark_t tag) -{ - return pagevec_lookup_range_tag(pvec, mapping, index, (pgoff_t)-1, tag); -} static inline void pagevec_init(struct pagevec *pvec) { diff --git a/mm/filemap.c b/mm/filemap.c index 85adbcf2d9a7..31bf18ec6d01 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2337,66 +2337,6 @@ unsigned filemap_get_folios_tag(struct address_space *mapping, pgoff_t *start, } EXPORT_SYMBOL(filemap_get_folios_tag); -/** - * find_get_pages_range_tag - Find and return head pages matching @tag. - * @mapping: the address_space to search - * @index: the starting page index - * @end: The final page index (inclusive) - * @tag: the tag index - * @nr_pages: the maximum number of pages - * @pages: where the resulting pages are placed - * - * Like find_get_pages_range(), except we only return head pages which are - * tagged with @tag. @index is updated to the index immediately after the - * last page we return, ready for the next iteration. - * - * Return: the number of pages which were found. - */ -unsigned find_get_pages_range_tag(struct address_space *mapping, pgoff_t *index, - pgoff_t end, xa_mark_t tag, unsigned int nr_pages, - struct page **pages) -{ - XA_STATE(xas, &mapping->i_pages, *index); - struct folio *folio; - unsigned ret = 0; - - if (unlikely(!nr_pages)) - return 0; - - rcu_read_lock(); - while ((folio = find_get_entry(&xas, end, tag))) { - /* - * Shadow entries should never be tagged, but this iteration - * is lockless so there is a window for page reclaim to evict - * a page we saw tagged. Skip over it. - */ - if (xa_is_value(folio)) - continue; - - pages[ret] = &folio->page; - if (++ret == nr_pages) { - *index = folio->index + folio_nr_pages(folio); - goto out; - } - } - - /* - * We come here when we got to @end. We take care to not overflow the - * index @index as it confuses some of the callers. This breaks the - * iteration when there is a page at index -1 but that is already - * broken anyway. - */ - if (end == (pgoff_t)-1) - *index = (pgoff_t)-1; - else - *index = end + 1; -out: - rcu_read_unlock(); - - return ret; -} -EXPORT_SYMBOL(find_get_pages_range_tag); - /* * CD/DVDs are error prone. When a medium error occurs, the driver may fail * a _large_ part of the i/o request. Imagine the worst scenario: diff --git a/mm/swap.c b/mm/swap.c index 70e2063ef43a..5f20ba07d46b 100644 --- a/mm/swap.c +++ b/mm/swap.c @@ -1119,16 +1119,6 @@ void folio_batch_remove_exceptionals(struct folio_batch *fbatch) fbatch->nr = j; } -unsigned pagevec_lookup_range_tag(struct pagevec *pvec, - struct address_space *mapping, pgoff_t *index, pgoff_t end, - xa_mark_t tag) -{ - pvec->nr = find_get_pages_range_tag(mapping, index, end, tag, - PAGEVEC_SIZE, pvec->pages); - return pagevec_count(pvec); -} -EXPORT_SYMBOL(pagevec_lookup_range_tag); - /* * Perform any setup for the swap system */