From patchwork Mon Apr 17 12:36:15 2023
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Pankaj Raghav
X-Patchwork-Id: 84215
Return-Path:
Delivered-To: ouuuleilei@gmail.com
Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2103423vqo;
Mon, 17 Apr 2023 05:58:25 -0700 (PDT)
X-Google-Smtp-Source:
AKy350aWv4kkTyPw3SUelcDFbdzhCSWc2a58Hmmh8BbIDxbN2cSbaxMjrUFTFVn+wGJQ8mE/kYwY
X-Received: by 2002:a05:6a20:3423:b0:e7:56ad:5a40 with SMTP id
i35-20020a056a20342300b000e756ad5a40mr13448536pzd.36.1681736305462;
Mon, 17 Apr 2023 05:58:25 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1681736305; cv=none;
d=google.com; s=arc-20160816;
b=FgJwa0++Hva990ALE+raVPv5v3hG47HVS+rQcr1zkrVPBFXd1BsKOr3SCeHNC3Udxl
bxij4YhEHe9wIBieq5/swYRiblle0yMJUkg7vQDdVu6Yer50zOnGBXCTsuTd/rk2yt1T
RUINCjXOnU+ZZbK+xlTOgKMvBTeLM8ouVSAwJwDBDhDVdDkr7msQvKvbJSEQ+ZyPqnNu
BrnwfFybo/KhspDCwEZx2Evv0ws2DHR+dyFWIgkjk1bSgAjVfT/YvIu8Hi5mEknC/Mfm
LBGMLnBE7RLF5c2oiiIWPaNj6Y+jB1ofZ9/e0+R9qClYFf9UnXKrH2OESL/XHaL9i2E6
H5tw==
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=ToDE43tRnz0p+L+A0Gpl2BjRfNRIfbZq1R5380heax8=;
b=pJxoZsORsy4JC6R0uOJMWMAO4nOo60UaKKIuGtlGaJQ7EEeJsCCLt3HSRv5NffbQFB
X2yEHv5+6Y9Fo4L1suiZVXOZ4SvR6U2iLM9szPv68SqC36xA3VsoTnn8zVncT3H1futt
/RFA/u9oKFT+4XumpODsn/bmFW1m8H5JWmV6hL5oL6QVrJ1m+TLhUBE/1r0qBpbW95ox
EhE+vUl3W+2oo1Juwui8mzKLOvCD+SSuyknoHhKsVzCouyHliXYcrp1vKPOVvnJOu/ej
8p6QpGwS4INEaeZPDpgRDytl0LL/QEhYd8lhuiXESxHgfg4nCpHS8MhGzWphLQ29pmCM
49ug==
ARC-Authentication-Results: i=1; mx.google.com;
dkim=pass header.i=@samsung.com header.s=mail20170921
header.b=kiT0q720;
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
k189-20020a6384c6000000b0051b2dfa3e3dsi12663422pgd.738.2023.04.17.05.58.06;
Mon, 17 Apr 2023 05:58:25 -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=kiT0q720;
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 S229682AbjDQMgd (ORCPT
+ 99 others); Mon, 17 Apr 2023 08:36:33 -0400
Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56570 "EHLO
lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
with ESMTP id S229483AbjDQMg1 (ORCPT
);
Mon, 17 Apr 2023 08:36:27 -0400
Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com
[210.118.77.11])
by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F97D121
for ;
Mon, 17 Apr 2023 05:36:24 -0700 (PDT)
Received: from eucas1p2.samsung.com (unknown [182.198.249.207])
by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id
20230417123621euoutp011ab9098571986831c86447ecd212769b~WuQ5NZkfP3118831188euoutp01S
for ;
Mon, 17 Apr 2023 12:36:21 +0000 (GMT)
DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com
20230417123621euoutp011ab9098571986831c86447ecd212769b~WuQ5NZkfP3118831188euoutp01S
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com;
s=mail20170921; t=1681734981;
bh=ToDE43tRnz0p+L+A0Gpl2BjRfNRIfbZq1R5380heax8=;
h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
b=kiT0q720f7N78z3fYHrOCC6zwrEGXRce+WcTWuSF5XrnEW5exXzM0HxujixhWqwS1
Dvrc1EBWVj9dFinkyUld+fNc7kZOhVSmgvkgW3LM98qS5gUbeVgw08dWFN5Hkq0EPc
gRmTZg+yvemfZaHiWMeT/DtEGfjVuzAckaGNpfAw=
Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by
eucas1p2.samsung.com (KnoxPortal) with ESMTP id
20230417123621eucas1p2a869a48f275fbd8a8a171ab8a1f4290c~WuQ4fpo5Z0719007190eucas1p24;
Mon, 17 Apr 2023 12:36:21 +0000 (GMT)
Received: from eucas1p2.samsung.com ( [182.198.249.207]) by
eusmges1new.samsung.com (EUCPMTA) with SMTP id 56.2D.09503.54D3D346;
Mon, 17
Apr 2023 13:36:21 +0100 (BST)
Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by
eucas1p2.samsung.com (KnoxPortal) with ESMTPA id
20230417123620eucas1p266aa61d2213f94bbe028a98be73b70fc~WuQ4MOQPw0505405054eucas1p2n;
Mon, 17 Apr 2023 12:36:20 +0000 (GMT)
Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by
eusmtrp1.samsung.com (KnoxPortal) with ESMTP id
20230417123620eusmtrp1b947be1384c5f0806db168e9ae7fa1c8~WuQ4LqdSR2401824018eusmtrp1z;
Mon, 17 Apr 2023 12:36:20 +0000 (GMT)
X-AuditID: cbfec7f2-e8fff7000000251f-40-643d3d458b9b
Received: from eusmtip1.samsung.com ( [203.254.199.221]) by
eusmgms2.samsung.com (EUCPMTA) with SMTP id 6D.38.34412.44D3D346;
Mon, 17
Apr 2023 13:36:20 +0100 (BST)
Received: from localhost (unknown [106.210.248.243]) by eusmtip1.samsung.com
(KnoxPortal) with ESMTPA id
20230417123620eusmtip1b098fac03c10a0314c030e184a2a48be~WuQ39Emx92069820698eusmtip1T;
Mon, 17 Apr 2023 12:36:20 +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 1/4] fs/buffer: add folio_set_bh helper
Date: Mon, 17 Apr 2023 14:36:15 +0200
Message-Id: <20230417123618.22094-2-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+NgFlrKKsWRmVeSWpSXmKPExsWy7djP87qutrYpBitWcFjMWb+GzeL14U+M
FjcP7GSy2LNoEpDYe5LF4vKuOWwWNyY8ZbT4vLSF3eL83+OsFr9/zGFz4PLYvELLY9OqTjaP
EzN+s3j0bVnF6LH5dLXH501yHpuevGUKYI/isklJzcksSy3St0vgyph/fy5rwR+eivPf+RoY
b3F1MXJySAiYSDR8fcPYx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Fz4PLYvELLY9OqTjaP
EzN+s3j0bVnF6LH5dLXH501yHpuevGUKYI/SsynKLy1JVcjILy6xVYo2tDDSM7S00DMysdQz
NDaPtTIyVdK3s0lJzcksSy3St0vQy5h/fy5rwR+eivPf+RoYb3F1MXJySAiYSDScOMYKYgsJ
LGWUeLJMDyIuIXF7YRMjhC0s8edaF1sXIxdQzXNGicmz5zJ1MXJwsAloSTR2soPUiAikSqz4
cweshllgGaPE4e93mUESwgLmEt+6X4EVsQioSsz8tZAJxOYVsJSY9GUCE8QCeYn9B8+C1XMK
WEms2NzDDHGQpcT9S9uYIeoFJU7OfMICYjMD1Tdvnc08gVFgFpLULCSpBYxMqxhFUkuLc9Nz
i430ihNzi0vz0vWS83M3MQLjZ9uxn1t2MK589VHvECMTB+MhRgkOZiUR3jOuVilCvCmJlVWp
RfnxRaU5qcWHGE2B7p7ILCWanA+M4LySeEMzA1NDEzNLA1NLM2MlcV7Pgo5EIYH0xJLU7NTU
gtQimD4mDk6pBqb2oPRfH1xeHc1qb/t55b7PrIT1MlGtyaX+972y2Z8uT/s0Sf8vz88ZQl76
x6pk/XSuLeE6r9IntuvPzTs2OcfPp82ySU9vV5MKMJI/21tcdn2t5BfzrK0dFn7XT2te8H8X
p3LtmvgzbvkT28XDDb2/8qlIPVb8XflQ+5iG2Yzul7518XEecZ+Pbv11Qyhiy/TCc38fibY1
KHiz3InvdbMInrb5/ZqZOclhPUYePM/3bOgNObuGi1tow0J92xlvLVhO2T886fXTfMee5Gl3
76mv5Ii8uf6HP+dbN9s40xBDn3zvSUJphyNzZy8NitysPUt5afuXWdsWTr7wm8c6V2r3hNWp
IffbJv/1t9r+ersSS3FGoqEWc1FxIgD2gHHgKAMAAA==
X-CMS-MailID: 20230417123620eucas1p266aa61d2213f94bbe028a98be73b70fc
X-Msg-Generator: CA
X-RootMTR: 20230417123620eucas1p266aa61d2213f94bbe028a98be73b70fc
X-EPHeader: CA
CMS-TYPE: 201P
X-CMS-RootMailID: 20230417123620eucas1p266aa61d2213f94bbe028a98be73b70fc
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?1763428328245281399?=
X-GMAIL-MSGID: =?utf-8?q?1763428328245281399?=
The folio version of set_bh_page(). This is required to convert
create_page_buffers() to folio_create_buffers() later in the series.
Signed-off-by: Pankaj Raghav
Reviewed-by: Matthew Wilcox (Oracle)
Reviewed-by: Hannes Reinecke
---
fs/buffer.c | 15 +++++++++++++++
include/linux/buffer_head.h | 2 ++
2 files changed, 17 insertions(+)
diff --git a/fs/buffer.c b/fs/buffer.c
index b3eb905f87d6..7e74bd77a81b 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -1484,6 +1484,21 @@ void set_bh_page(struct buffer_head *bh,
}
EXPORT_SYMBOL(set_bh_page);
+void folio_set_bh(struct buffer_head *bh, struct folio *folio,
+ unsigned long offset)
+{
+ bh->b_folio = folio;
+ BUG_ON(offset >= folio_size(folio));
+ if (folio_test_highmem(folio))
+ /*
+ * This catches illegal uses and preserves the offset:
+ */
+ bh->b_data = (char *)(0 + offset);
+ else
+ bh->b_data = folio_address(folio) + offset;
+}
+EXPORT_SYMBOL(folio_set_bh);
+
/*
* Called when truncating a buffer on a page completely.
*/
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 8f14dca5fed7..7e92d23f4782 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -196,6 +196,8 @@ void mark_buffer_write_io_error(struct buffer_head *bh);
void touch_buffer(struct buffer_head *bh);
void set_bh_page(struct buffer_head *bh,
struct page *page, unsigned long offset);
+void folio_set_bh(struct buffer_head *bh, struct folio *folio,
+ unsigned long offset);
bool try_to_free_buffers(struct folio *);
struct buffer_head *alloc_page_buffers(struct page *page, unsigned long size,
bool retry);