Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp6932290rdb; Fri, 15 Dec 2023 12:14:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IFFJLGS7HNksPAyYLX4jm1tLIXrm9FlOuovcuYTa8lz0oum8+RnlRHEJ9TsdJglTXoygta+ X-Received: by 2002:a17:90a:ac16:b0:28b:ca8:70d2 with SMTP id o22-20020a17090aac1600b0028b0ca870d2mr1565155pjq.74.1702671259918; Fri, 15 Dec 2023 12:14:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702671259; cv=none; d=google.com; s=arc-20160816; b=cUBy2JMcabsJ5CM6JC/dfHwFJA9lsSnNHrhfT2mdrsIF+sqQ1Et+d9bBKpqLRyTguv e27/DEpUPkzf9lwhLIkM8JVYFUwy276ISK6ToBunuij2qrMLqFnd3IGiHb9mYb9hnqup 6+A9hknf+dltit6XOkGxIQfBbGmuS5Na3isOxcwvA3283zUCBmtXYRYKrk9YGNb2Lz4F JJzuETzQ3bPufjsIzn4BHfP6Zc+TWMwFzZCRR3nbvnLLmarJ4tJF+nekYEs3AfKUthVq 2mMAgj/1kR6ISMtqeyzidJPPKGoc5fpnhiuJLu2eOtsEOizGLLv7eUGgOB/6AyX537mB OOYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Haux6v60eBd/p5vruOwKLTBeh3vkJK7iQizVm3UqAfQ=; fh=timWtHA7UGScEpXk98kbQKGrJEBXaf2Y1JfEnqzAnNI=; b=00TJpEaGW72oAdnaScjZHTg8rPPxbO+a1yTlCGztRLgQKWhhm6t0yCSsF1gODmDf1W g9yqqlzMPnDfaBguPDiLYQEk4XXIUypEBuwDLzbYdcZ6S7gZBvawoxhVa5F2SmQZqggT ga8TBCRc4g/75rQIQihvp2yniVa+Wh/Jpimt3oVqb2O+3Pge05OkmraVZuR75dxYgIYY NIYC6QTh5bR4ykerjStV6RQRGZkiiCqm33LrF4PdIU5uxa0eq5+M2oViutwTHTYzUEb5 rB8EG1SfB7OrfdHiEItqZKzMYa9FhvFpv6A7uo89MRf6+XfqLn7ryimHmMlm3DdVrorq ZAWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=uTpIJ5A+; spf=pass (google.com: domain of linux-kernel+bounces-1609-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1609-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id v8-20020a170902b7c800b001d0187da0a0si13461019plz.292.2023.12.15.12.14.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 12:14:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-1609-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=uTpIJ5A+; spf=pass (google.com: domain of linux-kernel+bounces-1609-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1609-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 5D7BB287F35 for ; Fri, 15 Dec 2023 20:08:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2EB5D6BB44; Fri, 15 Dec 2023 20:02:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="uTpIJ5A+" X-Original-To: linux-kernel@vger.kernel.org Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7174C6A027; Fri, 15 Dec 2023 20:02:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org 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=Haux6v60eBd/p5vruOwKLTBeh3vkJK7iQizVm3UqAfQ=; b=uTpIJ5A+lfpANn/PViXJbG6gYu 59D6LVUz54boCJgmKlKoRi4dsaWXAl35SCUINIgOxcXZhgveFvB4aEGiqzx8rXkMiLk/n3thT50wP l+CE/THLkcrTtFBkCo10X5Fndxp2GpjQjrtpss65rU6XxOzmp5ajw6Kq6nCdJkilEDFnRk8mkpsd5 kXmKe+Q9cG4TFzbGM2SpYatoR3dBEF1kMKvWXbXZNsFOsLBfyxFW2wt6Gr/CQdwlSvfSaJv4Y7aSP iGNqt8ee2N20jrSDYLRDqPjK9anjzo5mj0hUnfWVY/gvuXSuo0DTeN0gAqOvItPgdSYSqolTAo22J FdtKPxww==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1rEEOV-0038iA-0t; Fri, 15 Dec 2023 20:02:47 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , Christoph Hellwig , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org Subject: [PATCH 02/14] fs: Convert clean_buffers() to take a folio Date: Fri, 15 Dec 2023 20:02:33 +0000 Message-Id: <20231215200245.748418-3-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20231215200245.748418-1-willy@infradead.org> References: <20231215200245.748418-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The only caller already has a folio, so pass it in and use it throughout. Saves two calls to compound_head(). Signed-off-by: Matthew Wilcox (Oracle) --- fs/mpage.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/fs/mpage.c b/fs/mpage.c index 63bf99856024..630f4a7c7d03 100644 --- a/fs/mpage.c +++ b/fs/mpage.c @@ -430,13 +430,13 @@ struct mpage_data { * We have our BIO, so we can now mark the buffers clean. Make * sure to only clean buffers which we know we'll be writing. */ -static void clean_buffers(struct page *page, unsigned first_unmapped) +static void clean_buffers(struct folio *folio, unsigned first_unmapped) { unsigned buffer_counter = 0; - struct buffer_head *bh, *head; - if (!page_has_buffers(page)) + struct buffer_head *bh, *head = folio_buffers(folio); + + if (!head) return; - head = page_buffers(page); bh = head; do { @@ -451,8 +451,8 @@ static void clean_buffers(struct page *page, unsigned first_unmapped) * read_folio would fail to serialize with the bh and it would read from * disk before we reach the platter. */ - if (buffer_heads_over_limit && PageUptodate(page)) - try_to_free_buffers(page_folio(page)); + if (buffer_heads_over_limit && folio_test_uptodate(folio)) + try_to_free_buffers(folio); } static int __mpage_writepage(struct folio *folio, struct writeback_control *wbc, @@ -615,7 +615,7 @@ static int __mpage_writepage(struct folio *folio, struct writeback_control *wbc, goto alloc_new; } - clean_buffers(&folio->page, first_unmapped); + clean_buffers(folio, first_unmapped); BUG_ON(folio_test_writeback(folio)); folio_start_writeback(folio); -- 2.42.0