From patchwork Fri Apr 14 11:08:21 2023
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Pankaj Raghav
X-Patchwork-Id: 83373
Return-Path:
Delivered-To: ouuuleilei@gmail.com
Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp313608vqo;
Fri, 14 Apr 2023 04:41:21 -0700 (PDT)
X-Google-Smtp-Source:
AKy350bIs92jSaajNZSKrmu7bNTT/slH3g6ocG1bpjrgnZHhSwz2ANP6RrZsjT7ga2Cb9DHy/BZy
X-Received: by 2002:a05:6a20:8922:b0:dc:76bb:b09b with SMTP id
i34-20020a056a20892200b000dc76bbb09bmr4675949pzg.5.1681472481621;
Fri, 14 Apr 2023 04:41:21 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1681472481; cv=none;
d=google.com; s=arc-20160816;
b=eIbttiJl0wNTS2AzCE86FxDaEUb+TXnUETeiBluQoTNakGxzCa7Ks2ouQNl6Ec9a+U
G8AUYHHe9y8wr5CcMo2CJG42hCpzDgRdYHZCdEWHYsZDv5xu2SfuX4HcdrTXhmPh7Rh6
mcjCLW8auYBXq0lQI0Fp5I66YGptwNENgUWWWVPMC0cBF2eTO9aP1S+2dC41AjJZs7Xu
HyGe3TK3ntT1FbB4lHbue40Y0aUWZhwcYpD8KDFYUzm9TOiFgxTr0IWuSthddiYJCl+K
01aLuzC0/8+PXPREsHnoW58j4pOpk/zxYz76GG+7sZRdpO7uzk+W4f0+6dxoAlkrksgO
ZDRA==
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=mYP1zNZlkNSFYYEZy1X4gVz5Ukcj0nQ95dBohrnlJJM=;
b=a5Jqm2I79qy+Q+jTwMmcQoIMUKGltMeuhrUmldWFvloCPm37n0ZD7I1eiwjLmMfymX
6Ai0emjBSo5oBNnelDP8Yug0QQb87bpHE/y/YgO42V7bPMvpv4gRQPUbqfIbYuCPHw3N
Lp6hOeqgr+fR36IKnCeO5F3R08iHKeFAU3Q0PW0rkpU/IVpSXdS5loJv65gSp3k8pOzl
FfRq3QiuPkRoKG7QBMj4r7dcl+TOr3Q2Te4+49DkF3ahnwNt3zono4b5wbDwfFkGLJby
Z8nOJCSVy8Z32zb31SQhPMotefIrbQdqiFP5B4moNrJtTzue+Od68sXrbeJ3psHvTxwn
7uyA==
ARC-Authentication-Results: i=1; mx.google.com;
dkim=pass header.i=@samsung.com header.s=mail20170921
header.b=Fbx4sqB5;
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
h28-20020a63f91c000000b00508d4eae759si4364240pgi.231.2023.04.14.04.41.06;
Fri, 14 Apr 2023 04:41:21 -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=Fbx4sqB5;
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 S231159AbjDNLIo (ORCPT
+ 99 others); Fri, 14 Apr 2023 07:08:44 -0400
Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44548 "EHLO
lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
with ESMTP id S230129AbjDNLId (ORCPT
);
Fri, 14 Apr 2023 07:08:33 -0400
Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com
[210.118.77.11])
by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 465F8138
for ;
Fri, 14 Apr 2023 04:08:32 -0700 (PDT)
Received: from eucas1p2.samsung.com (unknown [182.198.249.207])
by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id
20230414110829euoutp0117772c4527c9ce8875f0d6672b3212f1~VyITxTiGK1544715447euoutp01B
for ;
Fri, 14 Apr 2023 11:08:29 +0000 (GMT)
DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com
20230414110829euoutp0117772c4527c9ce8875f0d6672b3212f1~VyITxTiGK1544715447euoutp01B
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com;
s=mail20170921; t=1681470509;
bh=mYP1zNZlkNSFYYEZy1X4gVz5Ukcj0nQ95dBohrnlJJM=;
h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
b=Fbx4sqB55TW2FIa6EbR+LpMXJuU6PZqdqlPW/7FVdgNspqOTNdJZizrnu3VNCjKVj
MDk67wo/G75wy+a3bsVu0xUQ5UBYyzQbr4ayulLqmdMgKGD4REB/O6NVtKTZw5tJch
GpZavB1tnFRYrQEdoVsy0S4bYjXMx2/UdbJ2HMHE=
Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by
eucas1p2.samsung.com (KnoxPortal) with ESMTP id
20230414110828eucas1p27a02cf6a0489c892cebb71a142cd12d6~VyIS6P83_0295002950eucas1p2D;
Fri, 14 Apr 2023 11:08:28 +0000 (GMT)
Received: from eucas1p2.samsung.com ( [182.198.249.207]) by
eusmges1new.samsung.com (EUCPMTA) with SMTP id 73.9A.09503.C2439346;
Fri, 14
Apr 2023 12:08:28 +0100 (BST)
Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by
eucas1p2.samsung.com (KnoxPortal) with ESMTPA id
20230414110827eucas1p20e5f6bc74025acfb62b13465f267fa84~VyISX3-6I0896208962eucas1p2W;
Fri, 14 Apr 2023 11:08:27 +0000 (GMT)
Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by
eusmtrp2.samsung.com (KnoxPortal) with ESMTP id
20230414110827eusmtrp23a6f6eb3620adf6cec0cd8f777b64956~VyISXJW7G0913109131eusmtrp2X;
Fri, 14 Apr 2023 11:08:27 +0000 (GMT)
X-AuditID: cbfec7f2-ea5ff7000000251f-9f-6439342c4e39
Received: from eusmtip2.samsung.com ( [203.254.199.222]) by
eusmgms2.samsung.com (EUCPMTA) with SMTP id DF.39.34412.B2439346;
Fri, 14
Apr 2023 12:08:27 +0100 (BST)
Received: from localhost (unknown [106.210.248.243]) by eusmtip2.samsung.com
(KnoxPortal) with ESMTPA id
20230414110827eusmtip23f72b25a7070947a365203c3b088f67a~VyISIV5tx2822728227eusmtip2L;
Fri, 14 Apr 2023 11:08:27 +0000 (GMT)
From: Pankaj Raghav
To: brauner@kernel.org, willy@infradead.org, viro@zeniv.linux.org.uk,
akpm@linux-foundation.org
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
mcgrof@kernel.org, gost.dev@samsung.com, hare@suse.de,
Pankaj Raghav
Subject: [RFC 4/4] fs/buffer: convert create_page_buffers to
create_folio_buffers
Date: Fri, 14 Apr 2023 13:08:21 +0200
Message-Id: <20230414110821.21548-5-p.raghav@samsung.com>
X-Mailer: git-send-email 2.34.1
In-Reply-To: <20230414110821.21548-1-p.raghav@samsung.com>
MIME-Version: 1.0
X-Brightmail-Tracker:
H4sIAAAAAAAAA+NgFlrGKsWRmVeSWpSXmKPExsWy7djP87o6JpYpBk/XcVjMWb+GzeL14U+M
FjcP7GSy2LNoEpDYe5LF4vKuOWwWNyY8ZbT4vLSF3eL83+OsFr9/zGFz4PLYvELLY9OqTjaP
EzN+s3j0bVnF6LH5dLXH501yHpuevGUKYI/isklJzcksSy3St0vgytjbuJCxoF244tduqQbG
y/xdjJwcEg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L83+OsFr9/zGFz4PLYvELLY9OqTjaP
EzN+s3j0bVnF6LH5dLXH501yHpuevGUKYI/SsynKLy1JVcjILy6xVYo2tDDSM7S00DMysdQz
NDaPtTIyVdK3s0lJzcksSy3St0vQy9jbuJCxoF244tduqQbGy/xdjJwcEgImEte3HWDsYuTi
EBJYyihx7vEadoiEhMTthU2MELawxJ9rXWwQRc8ZJW6fX8jcxcjBwSagJdHYCVYvIpAqcfrE
R7AaZoFljBJr5r5gA0kICwRKrJ9+GMxmEVCVuHV8J5jNK2ApcXjtZqhl8hL7D55lBrE5Bawk
3iy7AFYjBFTTvmUJC0S9oMTJmU/AbGag+uats5knMArMQpKahSS1gJFpFaNIamlxbnpusZFe
cWJucWleul5yfu4mRmAEbTv2c8sOxpWvPuodYmTiYDzEKMHBrCTC+8PFNEWINyWxsiq1KD++
qDQntfgQoynQ3ROZpUST84ExnFcSb2hmYGpoYmZpYGppZqwkzutZ0JEoJJCeWJKanZpakFoE
08fEwSnVwMT7/2TDms6105SNpu9nZNOK+uijlX7i3v5gRmdzb0nvkGjdBRtuZbIKcJvt6pOc
t1htV7GXiL9+gHr1PC6rurkX7z0+73D2dZ92euW+s8es/5zV9Lt83VvnvNbW6sCXsyfs/Dc/
fK1qZE0c56Svhu7KNvPZ9V6onSsXV8pc9FPX+rLVw8vXdVOTzX97vGXPkC5SUWc7GxCy1k3n
zCm5cLXVHu/Ko5bEHPKpCZRLYlL52a63Yv0LpxNBalN3TWUr3nxs63qvBfcnTfFJ97fyuHF0
9pxVd2w2l7/e8CJ/y8t0tdql1Y4+taxL/PKF3YsF9DhsLm/w+N24MPzfzay5Z1/8kk59XM95
dNucwoqrm5VYijMSDbWYi4oTAdGKN2opAwAA
X-CMS-MailID: 20230414110827eucas1p20e5f6bc74025acfb62b13465f267fa84
X-Msg-Generator: CA
X-RootMTR: 20230414110827eucas1p20e5f6bc74025acfb62b13465f267fa84
X-EPHeader: CA
CMS-TYPE: 201P
X-CMS-RootMailID: 20230414110827eucas1p20e5f6bc74025acfb62b13465f267fa84
References: <20230414110821.21548-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=unavailable 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?1763151688611131481?=
X-GMAIL-MSGID: =?utf-8?q?1763151688611131481?=
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 create_folio_buffers() calls
folio_create_empty_buffers().
Signed-off-by: Pankaj Raghav
---
fs/buffer.c | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/fs/buffer.c b/fs/buffer.c
index 9e6a1a738fb5..a83d9bf78ca5 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -1802,14 +1802,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 *create_folio_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);
}
/*
@@ -1853,8 +1856,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 = create_folio_buffers(page_folio(page), inode,
+ (1 << BH_Dirty) | (1 << BH_Uptodate));
/*
* Be very careful. We have no exclusion from block_dirty_folio
@@ -2117,7 +2120,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 = create_folio_buffers(folio, inode, 0);
blocksize = head->b_size;
bbits = block_size_bits(blocksize);
@@ -2403,7 +2406,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 = create_folio_buffers(folio, inode, 0);
blocksize = head->b_size;
bbits = block_size_bits(blocksize);