From patchwork Wed Mar 22 13:50:12 2023
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Pankaj Raghav
X-Patchwork-Id: 13184085
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 vger.kernel.org (vger.kernel.org [23.128.96.18])
by smtp.lore.kernel.org (Postfix) with ESMTP id D526BC761AF
for ; Wed, 22 Mar 2023 13:51:26 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
id S231230AbjCVNvZ (ORCPT );
Wed, 22 Mar 2023 09:51:25 -0400
Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49530 "EHLO
lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
with ESMTP id S231164AbjCVNvC (ORCPT
);
Wed, 22 Mar 2023 09:51:02 -0400
Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com
[210.118.77.11])
by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C28B45AB52
for ;
Wed, 22 Mar 2023 06:50:46 -0700 (PDT)
Received: from eucas1p2.samsung.com (unknown [182.198.249.207])
by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id
20230322135019euoutp01c9f94ee2733d9658b5d0aecbb0efe860~OwgDWdJsM1888918889euoutp01K
for ;
Wed, 22 Mar 2023 13:50:19 +0000 (GMT)
DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com
20230322135019euoutp01c9f94ee2733d9658b5d0aecbb0efe860~OwgDWdJsM1888918889euoutp01K
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com;
s=mail20170921; t=1679493019;
bh=bEycODUs3a19v9Q2MRV2ibzIXf/1C8rKj/6UCd36MJY=;
h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
b=OE3TuYV5eG6ueLT9Sql/pOs/SAiAfvuG9xGrrLCYnBTCQN1Jetoz8yGgrvjYrBXx2
rIOzqRA7jVp/mT/D6jN4n61A1V2fCkQ6ezxS41zL3/s8KjHZacM9S9muGz0fZyaEke
4+J7lecYRdBLfp6Nwl6izQyYpgRHc8PJUy8MH08M=
Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by
eucas1p1.samsung.com (KnoxPortal) with ESMTP id
20230322135018eucas1p12b4ac5ea50ea365ccac025b8b1a287ac~OwgBtgsgg3054630546eucas1p1f;
Wed, 22 Mar 2023 13:50:18 +0000 (GMT)
Received: from eucas1p1.samsung.com ( [182.198.249.206]) by
eusmges3new.samsung.com (EUCPMTA) with SMTP id C2.38.10014.A970B146;
Wed, 22
Mar 2023 13:50:18 +0000 (GMT)
Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by
eucas1p2.samsung.com (KnoxPortal) with ESMTPA id
20230322135017eucas1p2d29ffaf8dbbd79761ba56e8198d9c933~OwgBSi9ph0617106171eucas1p26;
Wed, 22 Mar 2023 13:50:17 +0000 (GMT)
Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by
eusmtrp2.samsung.com (KnoxPortal) with ESMTP id
20230322135017eusmtrp2fde4c0580c077ed043cd9b7695a7b4e2~OwgBR1bDu0670606706eusmtrp2b;
Wed, 22 Mar 2023 13:50:17 +0000 (GMT)
X-AuditID: cbfec7f5-ba1ff7000000271e-16-641b079a66c5
Received: from eusmtip2.samsung.com ( [203.254.199.222]) by
eusmgms2.samsung.com (EUCPMTA) with SMTP id 0D.6E.09583.9970B146;
Wed, 22
Mar 2023 13:50:17 +0000 (GMT)
Received: from localhost (unknown [106.210.248.108]) by eusmtip2.samsung.com
(KnoxPortal) with ESMTPA id
20230322135017eusmtip28d89f9c0a2f04dd9e9c07a1b728a61a7~OwgBFYop52536025360eusmtip2v;
Wed, 22 Mar 2023 13:50:17 +0000 (GMT)
From: Pankaj Raghav
To: senozhatsky@chromium.org, viro@zeniv.linux.org.uk, axboe@kernel.dk,
willy@infradead.org, brauner@kernel.org, akpm@linux-foundation.org,
minchan@kernel.org, hubcap@omnibond.com, martin@omnibond.com
Cc: mcgrof@kernel.org, devel@lists.orangefs.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-block@vger.kernel.org, gost.dev@samsung.com,
Pankaj Raghav
Subject: [RFC v2 4/5] mpage: use folios in bio end_io handler
Date: Wed, 22 Mar 2023 14:50:12 +0100
Message-Id: <20230322135013.197076-5-p.raghav@samsung.com>
X-Mailer: git-send-email 2.34.1
In-Reply-To: <20230322135013.197076-1-p.raghav@samsung.com>
MIME-Version: 1.0
X-Brightmail-Tracker:
H4sIAAAAAAAAA+NgFrrDKsWRmVeSWpSXmKPExsWy7djPc7qz2KVTDK48YbWYs34Nm8Xqu/1s
Fq8Pf2K02L95CpPFzQM7mSza7/YxWey9pW2xZ+9JFovLu+awWdxb85/V4uT6/8wWNyY8ZbRY
9vU9u8XnpS3sFrs3LmKzOP/3OKvF7x9z2BwEPWY3XGTx2LxCy+Py2VKPTas62Tw2fZrE7nFi
xm8Wj4apt9g8ft2+w+rRt2UVo8fnTXIem568ZQrgjuKySUnNySxLLdK3S+DK+Pn0NHtBC1/F
pcaTjA2M67i7GDk4JARMJG78Tu1i5OIQEljBKHFq10dWCOcLo0TntmlQzmdGiTltW1m6GDnB
Olq39LBDJJYzSkz+uJcJwnnJKLH20ScmkLlsAloSjZ1gRSICZxglpjTNYATpZha4zyhxei/Y
JGEBW4mFF3cygtSzCKhKrLyWDhLmFbCSmDxhMSPEMnmJ/QfPMoPYnALWEo8WTWODqBGUODnz
CQvESHmJ5q2zmUF2SQis5pTY3XufDaLZRWIGMDYgbGGJV8e3sEPYMhL/d85ngrCrJZ7e+A3V
3MIo0b9zPRskYKwl+s7kgJjMApoS63fpQ5Q7Shx5sgGqgk/ixltBiBP4JCZtm84MEeaV6GgT
gqhWktj58wnUUgmJy01zoEHoIXFk8RT2CYyKs5A8MwvJM7MQ9i5gZF7FKJ5a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tKnJz5hAXEZgaqb946m3kCo8AsJKlZSFILGJlWMYqklhbn
pucWG+kVJ+YWl+al6yXn525iBEbrtmM/t+xgXPnqo94hRiYOxkOMEhzMSiK8bswSKUK8KYmV
ValF+fFFpTmpxYcYTYHOnsgsJZqcD0wXeSXxhmYGpoYmZpYGppZmxkrivJ4FHYlCAumJJanZ
qakFqUUwfUwcnFINTE4BrvUTLrs37+vZoLbew6/4sbxV/vy5lneOs7V5sgn2dWXO5rPVrJX9
cjLzfNOKzNceh8onWGaffW++69hu8Q2dJdNPLPCYtFj3v4pixLbJL9OenVzLe+ai5L+O4+dd
z/tMbv5owLgs3V5I2y2h/nvWrrOiSWYFHV+/X5Y+8saWd2WSZbH9TAtX66d8ai8D54R9vr43
59z+sv1rl3uWX3MPO//Ha+viY0veJd4y3queKvJnzcanLI+WSb5N/eWrWjZLomDDJL6LStxM
lj6vWH989PeI+pPjcFtMr/pYxfYPT6e+aD64W25HyoHfU74c6VZXFPqcGrjDcP2S6S8TXWea
i4dt93rYulo13EBq2RolluKMREMt5qLiRADBlbKOXwMAAA==
X-CMS-MailID: 20230322135017eucas1p2d29ffaf8dbbd79761ba56e8198d9c933
X-Msg-Generator: CA
X-RootMTR: 20230322135017eucas1p2d29ffaf8dbbd79761ba56e8198d9c933
X-EPHeader: CA
CMS-TYPE: 201P
X-CMS-RootMailID: 20230322135017eucas1p2d29ffaf8dbbd79761ba56e8198d9c933
References: <20230322135013.197076-1-p.raghav@samsung.com>
Precedence: bulk
List-ID:
X-Mailing-List: linux-block@vger.kernel.org
Use folios in the bio end_io handler. This conversion does the appropriate
handling on the folios in the respective end_io callback and removes the
call to page_endio(), which is soon to be removed.
Signed-off-by: Pankaj Raghav
---
fs/mpage.c | 34 ++++++++++++++++++++++------------
1 file changed, 22 insertions(+), 12 deletions(-)
diff --git a/fs/mpage.c b/fs/mpage.c
index 3a545bf0f184..103505551896 100644
--- a/fs/mpage.c
+++ b/fs/mpage.c
@@ -45,13 +45,15 @@
*/
static void mpage_read_end_io(struct bio *bio)
{
- struct bio_vec *bv;
- struct bvec_iter_all iter_all;
+ struct folio_iter fi;
+ int err = blk_status_to_errno(bio->bi_status);
- bio_for_each_segment_all(bv, bio, iter_all) {
- struct page *page = bv->bv_page;
- page_endio(page, REQ_OP_READ,
- blk_status_to_errno(bio->bi_status));
+ bio_for_each_folio_all(fi, bio) {
+ struct folio *folio = fi.folio;
+
+ if (!err)
+ folio_mark_uptodate(folio);
+ folio_unlock(folio);
}
bio_put(bio);
@@ -59,13 +61,21 @@ static void mpage_read_end_io(struct bio *bio)
static void mpage_write_end_io(struct bio *bio)
{
- struct bio_vec *bv;
- struct bvec_iter_all iter_all;
+ struct folio_iter fi;
+ int err = blk_status_to_errno(bio->bi_status);
- bio_for_each_segment_all(bv, bio, iter_all) {
- struct page *page = bv->bv_page;
- page_endio(page, REQ_OP_WRITE,
- blk_status_to_errno(bio->bi_status));
+ bio_for_each_folio_all(fi, bio) {
+ struct folio *folio = fi.folio;
+
+ if (err) {
+ struct address_space *mapping;
+
+ folio_set_error(folio);
+ mapping = folio_mapping(folio);
+ if (mapping)
+ mapping_set_error(mapping, err);
+ }
+ folio_end_writeback(folio);
}
bio_put(bio);