From patchwork Tue Mar 28 11:27: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: 13190930 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 015DEC76196 for ; Tue, 28 Mar 2023 11:27:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232723AbjC1L1b (ORCPT ); Tue, 28 Mar 2023 07:27:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229935AbjC1L12 (ORCPT ); Tue, 28 Mar 2023 07:27:28 -0400 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 730EE185 for ; Tue, 28 Mar 2023 04:27:26 -0700 (PDT) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20230328112722euoutp01cc064857e323d21b8ad3b1b2a0565778~Qka8yF25y0361403614euoutp01r for ; Tue, 28 Mar 2023 11:27:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20230328112722euoutp01cc064857e323d21b8ad3b1b2a0565778~Qka8yF25y0361403614euoutp01r DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1680002842; bh=C4y5H34/b66lYzmCayiry+Dr/iI1gotrFjxRhbqI+PI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SOQeOheNVR3TOZRUeQLXiB9Fxu+PcuYHKieaWtx2g3+sxEx86tj7vwcSVUFDblKMz Vj9tVHIZqhGlVhs5bIfLHmUm6Q8p7o9xtBiSeHx+scxD1HY0YSnL9ots26OszOY10S VMBk19gD3UFgy+dC35ln638RaAPyCp6CALsLljU8= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20230328112720eucas1p208a91e75a4df810cf7dd3781ee8559e2~Qka7MHLqp0948509485eucas1p2J; Tue, 28 Mar 2023 11:27:20 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 07.51.09503.81FC2246; Tue, 28 Mar 2023 12:27:20 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20230328112720eucas1p1148c03b8664f6c212c7189454a36b796~Qka6blNGF1794717947eucas1p1w; Tue, 28 Mar 2023 11:27:20 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20230328112720eusmtrp269ad4302d80bafe5b32231e8e7b2f8b3~Qka6a46bI0134701347eusmtrp2R; Tue, 28 Mar 2023 11:27:20 +0000 (GMT) X-AuditID: cbfec7f2-e8fff7000000251f-7e-6422cf189df9 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 1F.71.09583.71FC2246; Tue, 28 Mar 2023 12:27:20 +0100 (BST) Received: from localhost (unknown [106.210.248.108]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230328112719eusmtip21f0b4a5953ca974547d94cb63d3c29a0~Qka6Ka8Ob2590125901eusmtip2_; Tue, 28 Mar 2023 11:27:19 +0000 (GMT) From: Pankaj Raghav To: martin@omnibond.com, axboe@kernel.dk, minchan@kernel.org, akpm@linux-foundation.org, hubcap@omnibond.com, willy@infradead.org, viro@zeniv.linux.org.uk, senozhatsky@chromium.org, brauner@kernel.org Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, mcgrof@kernel.org, linux-block@vger.kernel.org, gost.dev@samsung.com, linux-mm@kvack.org, devel@lists.orangefs.org, Pankaj Raghav Subject: [PATCH 4/5] mpage: use folios in bio end_io handler Date: Tue, 28 Mar 2023 13:27:15 +0200 Message-Id: <20230328112716.50120-5-p.raghav@samsung.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230328112716.50120-1-p.raghav@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrLKsWRmVeSWpSXmKPExsWy7djPc7oS55VSDK73mlrMWb+GzWL13X42 i9eHPzFa7N88hcni5oGdTBbtd/uYLPbe0rbYs/cki8XlXXPYLO6t+c9qcXL9f2aLGxOeMlos +/qe3eLz0hZ2i90bF7FZnP97nNXi9485bA6CHrMbLrJ4bF6h5XH5bKnHplWdbB6bPk1i9zgx 4zeLR8PUW2wev27fYfXo27KK0ePzJjmPTU/eMgVwR3HZpKTmZJalFunbJXBlLHh5iaVgAm/F n0v72BoY73B1MXJySAiYSNxdco+9i5GLQ0hgBaPE3R9TGCGcL4wSDw88hHI+M0rc2H+WCabl 7YwNLCC2kMByRokj32Igil4ySqzufA+U4OBgE9CSaOwEGysicIZRYvHyRjYQh1ngPqPEt5fn wSYJC9hI/Ft/ghHEZhFQlWj83sEKYvMKWEqcmjmPDWKbvMT+g2eZQYZyClhJTPttBVEiKHFy 5hOwI5iBSpq3zmYGmS8hsJpTYt2ebhaIXheJg3t3Q10tLPHq+BZ2CFtG4v/O+VDxaomnN35D NbcwSvTvXM8GskxCwFqi70wOiMksoCmxfpc+RLmjRPeBc0wQFXwSN94KQpzAJzFp23RmiDCv REebEES1ksTOn0+glkpIXG6aA3WYh8S7xm3sExgVZyF5ZhaSZ2Yh7F3AyLyKUTy1tDg3PbXY MC+1XK84Mbe4NC9dLzk/dxMjMAWe/nf80w7Gua8+6h1iZOJgPMQowcGsJMK72VsxRYg3JbGy KrUoP76oNCe1+BCj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JVEeDd7K6YI8aYk VlalFuXHF5XmpBYfYjQFOnsis5Rocj4wYeSVxBuaGZgamphZGphamhkrifN6FnQkCgmkJ5ak ZqemFqQWwfQxcXBKNTAlPHR9UXHFs9y11PaUL7v3dQnTfoFVp6P17f9F+Hx/LfOS+0W3jGj7 LDbGQ9sXXtX8XewT+m3J9YN1M2ZbKM3KWuj0yvb4Iiv+CUITebjP+X+Oj1DLMYh8vXH3SwOG H12pkpuOXl124ov8MTuWtKNZBz71HPin5Nm53LnskUXbrDn9olknAjLim49779Ap3p+xfoK2 w+XqWR8EJdY4ZrfwGER9qnGX331c4I+f5XrmlbvfNTZcqUzPWph3S5wnvLLmpXqC+KkHzuZX Xj23LzoTJWfLdL7twZOUTsOSrwu6V2r3VcbNEC+Xcur3zO/bwJjZcG1d/sZf19l36vJZ3d34 9u7iY0o/5jqG7/edP0WJpTgj0VCLuag4EQAOWOnYYAMAAA== X-CMS-MailID: 20230328112720eucas1p1148c03b8664f6c212c7189454a36b796 X-Msg-Generator: CA X-RootMTR: 20230328112720eucas1p1148c03b8664f6c212c7189454a36b796 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230328112720eucas1p1148c03b8664f6c212c7189454a36b796 References: <20230328112716.50120-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 | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/fs/mpage.c b/fs/mpage.c index 3a545bf0f184..6f43b7c9d4de 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) { + if (!err) + folio_mark_uptodate(fi.folio); + else + folio_set_error(fi.folio); + folio_unlock(fi.folio); } bio_put(bio); @@ -59,13 +61,15 @@ 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) { + if (err) { + folio_set_error(fi.folio); + mapping_set_error(fi.folio->mapping, err); + } + folio_end_writeback(fi.folio); } bio_put(bio);