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: 13184078 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E31FEC761A6 for ; Wed, 22 Mar 2023 13:50:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 826436B0075; Wed, 22 Mar 2023 09:50:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7D6096B0078; Wed, 22 Mar 2023 09:50:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5DAAB6B007B; Wed, 22 Mar 2023 09:50:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 507546B0075 for ; Wed, 22 Mar 2023 09:50:24 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 2B91CA04C9 for ; Wed, 22 Mar 2023 13:50:24 +0000 (UTC) X-FDA: 80596668768.29.20D6417 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by imf13.hostedemail.com (Postfix) with ESMTP id 5C0782001B for ; Wed, 22 Mar 2023 13:50:21 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=samsung.com header.s=mail20170921 header.b=OE3TuYV5; spf=pass (imf13.hostedemail.com: domain of p.raghav@samsung.com designates 210.118.77.11 as permitted sender) smtp.mailfrom=p.raghav@samsung.com; dmarc=permerror reason="Multiple policies defined in DNS" header.from=samsung.com (policy=permerror) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1679493021; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=bEycODUs3a19v9Q2MRV2ibzIXf/1C8rKj/6UCd36MJY=; b=huLNcCQUnrS6eeX+ytOyn2yU3fSReiamk5e9cXzXa2hVZL0oBYDlDB5N5UY+4sozI5inhS Ba/aTpYuDESgHYIZG6ffvTV1pOx1sV1iMlyXJx4H+Al0akEopFIiGYrOVjfD64iP5PUYHu 9URiLKyCIxqhcWHuaHvba0U8P6OvGt4= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=samsung.com header.s=mail20170921 header.b=OE3TuYV5; spf=pass (imf13.hostedemail.com: domain of p.raghav@samsung.com designates 210.118.77.11 as permitted sender) smtp.mailfrom=p.raghav@samsung.com; dmarc=permerror reason="Multiple policies defined in DNS" header.from=samsung.com (policy=permerror) ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1679493021; a=rsa-sha256; cv=none; b=lDYYWZaertbBqDQZacKtfmJo+FQEHkrV9POFgvrSXIv/1ArQ0TWrGZAd/Tqlz1HH3NOyUn V/lAuO/CzRKNvolw+YyDmYe8ubHoI9WnqLgA3r94eNsfluIcxJSmNmsep4DEh7J8EAAMqo LOZ73BvymgmOFu2Kc0ZVFgeH4T0bKm4= Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20230322135019euoutp01cd3b6f5db0c96a9bd8c25f82d65892c3~OwgDSen7N1889118891euoutp01T for ; Wed, 22 Mar 2023 13:50:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20230322135019euoutp01cd3b6f5db0c96a9bd8c25f82d65892c3~OwgDSen7N1889118891euoutp01T 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 3MIo0b9zPRsk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S2Jxk52kBoR gRuMEu2r9EBqmEFqLj+dzQySEBawlVh4cSdYPYuAqsTKa+kgYV4BK4nJExZDzZeX2H/wLFg5 p4C1xKNF09hAbCGgmsv7J7FC1AtKnJz5hAXEZgaqb946m3kCo8AsJKlZSFILGJlWMYqklhbn 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> X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 5C0782001B X-Rspam-User: X-Stat-Signature: x3etqikqyj5jxi4c8i4med59eq737i8e X-HE-Tag: 1679493021-931647 X-HE-Meta: U2FsdGVkX18mbEylKv7qVV8s1ZUhEKWTj4xjwl4caJ5G9WXRJaiEvLz860eO/Ju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vmyWiIiCppeZ/xO5mxIRx/QG+BFjvZAYhTpPBq X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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);