From patchwork Mon Apr 17 12:36:18 2023
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Pankaj Raghav
X-Patchwork-Id: 84218
Return-Path:
Delivered-To: ouuuleilei@gmail.com
Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2103713vqo;
Mon, 17 Apr 2023 05:58:55 -0700 (PDT)
X-Google-Smtp-Source:
AKy350ZFUlIW+hZn1wyheij1KDyIVL/u1ZqSbbMcFh6Clh14KblLHpKJA3iZT6an3JNbHw1oYwYO
X-Received: by 2002:a17:90a:654a:b0:234:d78:9b4c with SMTP id
f10-20020a17090a654a00b002340d789b4cmr15063921pjs.18.1681736335026;
Mon, 17 Apr 2023 05:58:55 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1681736335; cv=none;
d=google.com; s=arc-20160816;
b=gYsi/dqScSsCuSSya1nW4fnAduw8eGcViifGaejt51obfkyqjbwG5UryfobDMW5pMr
TEw6/jLotfVBLD59u0JQLiwoz7xlGExIIhdPyFWH1Hk5H8BGWZ1gXVk0VHeAKwLE4yf6
Hlev4g6mCtaDR+3oR8uO67ikbyiBQcpZQk5VT+Kw1/ZI8SA8srNdAXXY0EMtS6+pl5B2
+f1/2DmAU+Xi8eHhAf1JiOm/JX/6wldiT09XE5XBOSafdDJEjwwsjPX5nFO+3Q+WJeia
afsH0iHdMsFa3zULFCuc+ODjremYpc6hzbkP6WUO9iUVHl4EMdmRNQhqNu0P3cB7PVAP
Tvnw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;
s=arc-20160816;
h=list-id:precedence:references:cms-type:content-transfer-encoding
:mime-version:in-reply-to:message-id:date:subject:cc:to:from
:dkim-signature:dkim-filter;
bh=75KNfTxhmRWwu1RZJ9toOVORdWlwvdSd8OTiAl+Smo4=;
b=NRp24C1F2O88WKvcGlPaAO+5+taOz3xPHRAH10EGRyqgsv39Bjb5hHrcafrEj1SMoL
yymy5fuivyhJy3DoKef2FxfqpwsDp6La9d2Qoxcd+/nHZGkylXI9c5BaV9wcl1RrPHmA
EtNn8drSCc+HMVosRKul2x8oDKuyeX28evtiqCIXQb4MeMJyBxmDF/lnfyfFo6kNGWz4
YYq6gvozpLEEtCIzWBuPDHSdn7xMy+kURPkyfDT7tgf6qqZexQDXqQYHJHxKorOukgV2
xTqS3lIGaaPIebAf9pUCEk5+/RiCtZ6CTFAXRnlwfdUVIM462tXwOEK3oPDAqwNu4mct
ovBA==
ARC-Authentication-Results: i=1; mx.google.com;
dkim=pass header.i=@samsung.com header.s=mail20170921
header.b=lDU5O+BS;
spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org
designates 2620:137:e000::1:20 as permitted sender)
smtp.mailfrom=linux-kernel-owner@vger.kernel.org;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com
Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20])
by mx.google.com with ESMTP id
kk1-20020a17090b4a0100b0024730b93a6asi10693049pjb.147.2023.04.17.05.58.42;
Mon, 17 Apr 2023 05:58:55 -0700 (PDT)
Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org
designates 2620:137:e000::1:20 as permitted sender)
client-ip=2620:137:e000::1:20;
Authentication-Results: mx.google.com;
dkim=pass header.i=@samsung.com header.s=mail20170921
header.b=lDU5O+BS;
spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org
designates 2620:137:e000::1:20 as permitted sender)
smtp.mailfrom=linux-kernel-owner@vger.kernel.org;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
id S230498AbjDQMgw (ORCPT
+ 99 others); Mon, 17 Apr 2023 08:36:52 -0400
Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57042 "EHLO
lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
with ESMTP id S229574AbjDQMgn (ORCPT
);
Mon, 17 Apr 2023 08:36:43 -0400
Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com
[210.118.77.11])
by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAFD0199C
for ;
Mon, 17 Apr 2023 05:36:29 -0700 (PDT)
Received: from eucas1p2.samsung.com (unknown [182.198.249.207])
by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id
20230417123628euoutp01780e5e6266e9d5769c1025e164cdd21f~WuQ-kKgVG3176731767euoutp01u
for ;
Mon, 17 Apr 2023 12:36:28 +0000 (GMT)
DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com
20230417123628euoutp01780e5e6266e9d5769c1025e164cdd21f~WuQ-kKgVG3176731767euoutp01u
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com;
s=mail20170921; t=1681734988;
bh=75KNfTxhmRWwu1RZJ9toOVORdWlwvdSd8OTiAl+Smo4=;
h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
b=lDU5O+BSMq3uWBx9pwmYtQeUNDTrnYAvVdxhb40HpyuQ7EHA3poUM5uEILk7vjpNa
mRfuLEFC5OrZiBPL3ZOeWs/3e0+daD8ADsa/hf7VAWGeE3pHrwEpqJUtqPnipa8XHW
rM2oHd87nwPh58UVJMZDRzb4zcw91I8MHbBZBWEA=
Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by
eucas1p1.samsung.com (KnoxPortal) with ESMTP id
20230417123627eucas1p1c6760ed26e4ff1e4c75da5b623b23ba8~WuQ_xK_UR1066610666eucas1p1r;
Mon, 17 Apr 2023 12:36:27 +0000 (GMT)
Received: from eucas1p1.samsung.com ( [182.198.249.206]) by
eusmges2new.samsung.com (EUCPMTA) with SMTP id 34.F7.09966.B4D3D346;
Mon, 17
Apr 2023 13:36:27 +0100 (BST)
Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by
eucas1p2.samsung.com (KnoxPortal) with ESMTPA id
20230417123627eucas1p2d3e6824e87d4fdadf459be74845ea0a8~WuQ_aK0gu2096320963eucas1p2S;
Mon, 17 Apr 2023 12:36:27 +0000 (GMT)
Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by
eusmtrp1.samsung.com (KnoxPortal) with ESMTP id
20230417123627eusmtrp11dd2fe97ce12e5ef91d4871ded5a761e~WuQ_Zi88U2401524015eusmtrp1E;
Mon, 17 Apr 2023 12:36:27 +0000 (GMT)
X-AuditID: cbfec7f4-d39ff700000026ee-0a-643d3d4b0190
Received: from eusmtip2.samsung.com ( [203.254.199.222]) by
eusmgms1.samsung.com (EUCPMTA) with SMTP id 87.57.22108.B4D3D346;
Mon, 17
Apr 2023 13:36:27 +0100 (BST)
Received: from localhost (unknown [106.210.248.243]) by eusmtip2.samsung.com
(KnoxPortal) with ESMTPA id
20230417123627eusmtip2753e05ead6617a6d286d2128e6ae72a9~WuQ_OFEe20504505045eusmtip2e;
Mon, 17 Apr 2023 12:36:27 +0000 (GMT)
From: Pankaj Raghav
To: viro@zeniv.linux.org.uk, brauner@kernel.org, willy@infradead.org,
akpm@linux-foundation.org
Cc: linux-fsdevel@vger.kernel.org, mcgrof@kernel.org,
linux-kernel@vger.kernel.org, hare@suse.de, gost.dev@samsung.com,
Pankaj Raghav
Subject: [PATCH 4/4] fs/buffer: convert create_page_buffers to
folio_create_buffers
Date: Mon, 17 Apr 2023 14:36:18 +0200
Message-Id: <20230417123618.22094-5-p.raghav@samsung.com>
X-Mailer: git-send-email 2.34.1
In-Reply-To: <20230417123618.22094-1-p.raghav@samsung.com>
MIME-Version: 1.0
X-Brightmail-Tracker:
H4sIAAAAAAAAA+NgFlrGKsWRmVeSWpSXmKPExsWy7djPc7retrYpBitfG1rMWb+GzeL14U+M
FjcP7GSy2LNoEpDYe5LF4vKuOWwWNyY8ZbT4vLSF3eL83+OsFr9/zGFz4PLYvELLY9OqTjaP
EzN+s3j0bVnF6LH5dLXH501yHpuevGUKYI/isklJzcksSy3St0vgyrj+6yFTQbtwxfJby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4vLSF3eL83+OsFr9/zGFz4PLYvELLY9OqTjaP
EzN+s3j0bVnF6LH5dLXH501yHpuevGUKYI/SsynKLy1JVcjILy6xVYo2tDDSM7S00DMysdQz
NDaPtTIyVdK3s0lJzcksSy3St0vQy7j+6yFTQbtwxfJby9gbGC/zdzFycEgImEj82uDVxcjJ
ISSwlFGi87w7iC0hICFxe2ETI4QtLPHnWhdbFyMXUM1zRol/jR3MIL1sAloSjZ3sIDUiAqkS
K/7cAathFljGKHH4+11mkISwQLDEpdbJYINYBFQlDi34xQJi8wpYSjScnsIOsUBeYv/Bs2D1
nAJWEis29zBDHGQpcf/SNmaIekGJkzOfgPUyA9U3b53NPIFRYBaS1CwkqQWMTKsYRVJLi3PT
c4sN9YoTc4tL89L1kvNzNzEC42fbsZ+bdzDOe/VR7xAjEwfjIUYJDmYlEd4zrlYpQrwpiZVV
qUX58UWlOanFhxhNge6eyCwlmpwPjOC8knhDMwNTQxMzSwNTSzNjJXFez4KORCGB9MSS1OzU
1ILUIpg+Jg5OqQammFPXpDTk/a4+m9p3987siP1yNQuCt3bfK+RfWNus7us+48HHDr+Q0526
QccWmoTfs3r45GXTnYPnjq9OF+jNnmb0KvKb3c4J86Zd429WWnt0iqtyi5f0O6Y7hoKJjqc/
MhjUupe8ynVesM7oQPDkY7ut8gOXb74de2qRcR7jOZl834e73dtqQl7cCXjyilVi0TaLuRHH
wmtkNDimH5O4mvZqaVDZtaU3n+TnOVoHpU/oaHfZbHXwy8Wn/dPzTrVMWv9U7M3UW4Kzez4q
/eH/eyLbRPCJGts3g79xUytOBm3nrnxtFdoQIp56n/H3pULTjv21u9c5B10vXbvKS1aO2ebl
+k1T2r7E9m+q+6YipsRSnJFoqMVcVJwIAHDzDbgoAwAA
X-CMS-MailID: 20230417123627eucas1p2d3e6824e87d4fdadf459be74845ea0a8
X-Msg-Generator: CA
X-RootMTR: 20230417123627eucas1p2d3e6824e87d4fdadf459be74845ea0a8
X-EPHeader: CA
CMS-TYPE: 201P
X-CMS-RootMailID: 20230417123627eucas1p2d3e6824e87d4fdadf459be74845ea0a8
References: <20230417123618.22094-1-p.raghav@samsung.com>
X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,
DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,
RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS,
T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
lindbergh.monkeyblade.net
Precedence: bulk
List-ID:
X-Mailing-List: linux-kernel@vger.kernel.org
X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?=
X-GMAIL-THRID: =?utf-8?q?1763428359365408839?=
X-GMAIL-MSGID: =?utf-8?q?1763428359365408839?=
fs/buffer do not support large folios as there are many assumptions on
the folio size to be the host page size. This conversion is one step
towards removing that assumption. Also this conversion will reduce calls
to compound_head() if folio_create_buffers() calls
folio_create_empty_buffers().
Signed-off-by: Pankaj Raghav
Reviewed-by: Matthew Wilcox (Oracle)
Reviewed-by: Hannes Reinecke
---
fs/buffer.c | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/fs/buffer.c b/fs/buffer.c
index 13724ef7eec7..a7fc561758b1 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -1722,14 +1722,17 @@ static inline int block_size_bits(unsigned int blocksize)
return ilog2(blocksize);
}
-static struct buffer_head *create_page_buffers(struct page *page, struct inode *inode, unsigned int b_state)
+static struct buffer_head *folio_create_buffers(struct folio *folio,
+ struct inode *inode,
+ unsigned int b_state)
{
- BUG_ON(!PageLocked(page));
+ BUG_ON(!folio_test_locked(folio));
- if (!page_has_buffers(page))
- create_empty_buffers(page, 1 << READ_ONCE(inode->i_blkbits),
- b_state);
- return page_buffers(page);
+ if (!folio_buffers(folio))
+ folio_create_empty_buffers(folio,
+ 1 << READ_ONCE(inode->i_blkbits),
+ b_state);
+ return folio_buffers(folio);
}
/*
@@ -1773,8 +1776,8 @@ int __block_write_full_page(struct inode *inode, struct page *page,
int nr_underway = 0;
blk_opf_t write_flags = wbc_to_write_flags(wbc);
- head = create_page_buffers(page, inode,
- (1 << BH_Dirty)|(1 << BH_Uptodate));
+ head = folio_create_buffers(page_folio(page), inode,
+ (1 << BH_Dirty) | (1 << BH_Uptodate));
/*
* Be very careful. We have no exclusion from block_dirty_folio
@@ -2037,7 +2040,7 @@ int __block_write_begin_int(struct folio *folio, loff_t pos, unsigned len,
BUG_ON(to > PAGE_SIZE);
BUG_ON(from > to);
- head = create_page_buffers(&folio->page, inode, 0);
+ head = folio_create_buffers(folio, inode, 0);
blocksize = head->b_size;
bbits = block_size_bits(blocksize);
@@ -2323,7 +2326,7 @@ int block_read_full_folio(struct folio *folio, get_block_t *get_block)
VM_BUG_ON_FOLIO(folio_test_large(folio), folio);
- head = create_page_buffers(&folio->page, inode, 0);
+ head = folio_create_buffers(folio, inode, 0);
blocksize = head->b_size;
bbits = block_size_bits(blocksize);