From patchwork Wed Jun 21 16:45:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13287735 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 6B88EEB64D8 for ; Wed, 21 Jun 2023 17:04:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B1C858D0003; Wed, 21 Jun 2023 13:04:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id ACC9B8D0002; Wed, 21 Jun 2023 13:04:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9BAEE8D0003; Wed, 21 Jun 2023 13:04:56 -0400 (EDT) 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 8FD148D0002 for ; Wed, 21 Jun 2023 13:04:56 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 391381A099C for ; Wed, 21 Jun 2023 17:04:56 +0000 (UTC) X-FDA: 80927379792.09.CC696EC Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf19.hostedemail.com (Postfix) with ESMTP id 7DAE51A0044 for ; Wed, 21 Jun 2023 17:04:42 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=PLRq9KKL; spf=none (imf19.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1687367083; 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=V8mDv0EPPLn9jbcc1q5//Yn83nwPOxgWUqrHoyXGI0c=; b=BAjWkJJ8Dc72J9rJVw1ZgKSvMXmj3WqKpfLnU16cMRjTS8/yrhVjkCyAiEWus6vuHjfJCk rGFt4kL/NrGpRxViOEBJOMPdTn9hjvSw+8R7kDX4jdz5oCRZjCs6AImRcCsFpKZ71mV7cU OXgGT/2iRuArfUqsndWEe+Lyu+8MPqA= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687367083; a=rsa-sha256; cv=none; b=YzjqLGXcUqh6VwSKHyFp/xbmldVWMbFkRyAX+g2OVyLT9kNJ+P7+X1jCz4Blii6dcfAoK/ cThl95EEVDL8dnfhptY8yqwF37nbHZ1vkvoOvXeiVZ85uxeSlp84nCJ+k6H6QBskJhR3jo WJZyEMiq/++kn38iR0YFFcbe1Y8TA0A= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=PLRq9KKL; spf=none (imf19.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=V8mDv0EPPLn9jbcc1q5//Yn83nwPOxgWUqrHoyXGI0c=; b=PLRq9KKLTjSuYOK7GHTRrCHMdg 05lLjp1ehbCv+052CPARXxvQnb1O43zxj7iURZQn/E1jaN0bwIQW5tu0K45Zbr+3zxWU+wPrVZlCK +QqsOSr6EUqo15LlAazBFikNdb1fRpMqJvFYQgSLPIYQxMIV53HL0n1UNVHnv6JnPh6JKkExbpJ6p J6MYSwHHyE8H5k3lgy2R+EbEeMzUGq7Yt8LNMEzUcWUZ+ExfwFRmFIPsNXNCW5Mk31QYFy5kzCoHz 0e5RPgd7Cd8SGsqqWpYTptkDT+lG0sounVV2V2o0EUvc/3O7Y3fLam5B//dQFJa/rpuagffUbR3Pv xw/swJBg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qC0y1-00EjDg-9p; Wed, 21 Jun 2023 16:46:01 +0000 From: "Matthew Wilcox (Oracle)" To: linux-mm@kvack.org, Andrew Morton Cc: "Matthew Wilcox (Oracle)" , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, linux-afs@lists.infradead.org, linux-nfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH 01/13] afs: Convert pagevec to folio_batch in afs_extend_writeback() Date: Wed, 21 Jun 2023 17:45:45 +0100 Message-Id: <20230621164557.3510324-2-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230621164557.3510324-1-willy@infradead.org> References: <20230621164557.3510324-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 7DAE51A0044 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: naxebjjzyexajt7piwgm9qwatagpkbq3 X-HE-Tag: 1687367082-787347 X-HE-Meta: U2FsdGVkX18bdlMrk6i35EKBT9IQOrWKxYagFYIHaWC46gjo8OM/hop4shRcuElRwDfSHQKkYhmJRTYntRtdEC/4O1q+E1cDIt6bM3mVOOKmuj8O28py8M/+QBCcTScM1azyqePMWLJ00joVtk1mH8/UD53h8DAaVnyYstjX8V8eOCt+cyd2eLNDc8Co712P4gLrNGVHVXIiKCp4jv6VAf1nvael3uyrVJqpCJDU05VFd/OasMtSrEXx5zYozSH/eohe/EftWRtF1i912pR4uImwlcfIUAHFdSGfVUIpyyZmMHLDWpBg9DD3I3tfS0lBUr2IQ9fHY9XWqaWhPgpKPGtCGm6X6XhoRX/F1S4GSTBRAeKIEsEf6HuNrfl03efTGPO7TGXOCWMIMzbBXl5unkjOlLpoMECdf6YkoxoYVbPV6gl/lKfaSbHdYLrhH+L7CCNTzCx78Ew4fi8erVkwfboiiId4EvgiEIYL1O5q8gsnT2vijLdR1sjtu9GZFaPyumnW5fdBr8I5sxbPgv+C8OVcW45Kll3pwqZOd4xg5ClQczldFthBlUBMawv29SAujwyF0Yc5kIbA4HiO977zgcjuGegTSekzLN/W7XsHxD13quenwHpQLPcg/sX8oFEgpXt/NHCZRXOLU9lWj/fCX9B3Swc7NM6Dn/S4XpRTsnX1bt1U+LRVAGSlfPeOBZXW5AV4e9Y13/14iTTu1Qlak9eAqUVr76THTS5Les7kzOwUGBI/WOgWh8WnO9vGHicBpO8WihkbRcGuizL294SiuMyP8YYuEMijNTfNp46SPZj4kn+jbCOJG3H+ro8Ubc9jQ+ySLJ0pSLwHeWiL5lJSh/3dmdAHE4n34QiB50u2nxiCAMldNDlT4n6GT+2QJeJCcF+P0KcAENogxjkVUTwynTcf2kJuvA8mQAxN2JqY87JWWBhWAy11CVg82RTCyF0coaNHarynPT426bDHBub e/mhXzXN 0A2XtbM0zcHyF+oySnzqt+GDRS+NmFQgpEIDIp0rnhpB3ksoNQzdtGEpwuYIfq27fNZ/krYJoA61IfBbMHL7l3B6ljd2AGWh+VDk5+wahi/EJSRmFPJqXa/rt2RBNNNqwcGkNDbCV7F/VXejGgixndTvP4Uve88xa8zdvyXRNsyMAMeugDCwvtylEIIe5U6gELlj3d4JFbIyulExI3gEw0yPT3Lb/yJavgJOz 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: Removes a folio->page->folio conversion for each folio that's involved. More importantly, removes one of the last few uses of a pagevec. Signed-off-by: Matthew Wilcox (Oracle) --- fs/afs/write.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/fs/afs/write.c b/fs/afs/write.c index 18ccb613dff8..6e68c70d0b22 100644 --- a/fs/afs/write.c +++ b/fs/afs/write.c @@ -465,7 +465,7 @@ static void afs_extend_writeback(struct address_space *mapping, bool caching, unsigned int *_len) { - struct pagevec pvec; + struct folio_batch fbatch; struct folio *folio; unsigned long priv; unsigned int psize, filler = 0; @@ -476,7 +476,7 @@ static void afs_extend_writeback(struct address_space *mapping, unsigned int i; XA_STATE(xas, &mapping->i_pages, index); - pagevec_init(&pvec); + folio_batch_init(&fbatch); do { /* Firstly, we gather up a batch of contiguous dirty pages @@ -535,7 +535,7 @@ static void afs_extend_writeback(struct address_space *mapping, stop = false; index += folio_nr_pages(folio); - if (!pagevec_add(&pvec, &folio->page)) + if (!folio_batch_add(&fbatch, folio)) break; if (stop) break; @@ -545,14 +545,14 @@ static void afs_extend_writeback(struct address_space *mapping, xas_pause(&xas); rcu_read_unlock(); - /* Now, if we obtained any pages, we can shift them to being + /* Now, if we obtained any folios, we can shift them to being * writable and mark them for caching. */ - if (!pagevec_count(&pvec)) + if (!folio_batch_count(&fbatch)) break; - for (i = 0; i < pagevec_count(&pvec); i++) { - folio = page_folio(pvec.pages[i]); + for (i = 0; i < folio_batch_count(&fbatch); i++) { + folio = fbatch.folios[i]; trace_afs_folio_dirty(vnode, tracepoint_string("store+"), folio); if (!folio_clear_dirty_for_io(folio)) @@ -565,7 +565,7 @@ static void afs_extend_writeback(struct address_space *mapping, folio_unlock(folio); } - pagevec_release(&pvec); + folio_batch_release(&fbatch); cond_resched(); } while (!stop);