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: 76020 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2160510vqo; Tue, 28 Mar 2023 05:04:36 -0700 (PDT) X-Google-Smtp-Source: AKy350btEDi9RwtDT5hEq3wY/fV6F90VgjI9EOatRMRoSVVPzncOXuNJML4sfAJ1IZVeTx0RwfNd X-Received: by 2002:a17:90a:34c:b0:23d:360:877d with SMTP id 12-20020a17090a034c00b0023d0360877dmr15579333pjf.32.1680005075724; Tue, 28 Mar 2023 05:04:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680005075; cv=none; d=google.com; s=arc-20160816; b=NNB3iDp57O4084cD+IC0+lvf9ucF0oHGuvO6d4mSxWDBRz6m1YVxVfjnySgz63M1Dv KVBo6HSFp6Hc+wR6AR5UTcQPpKevnWFwVqdKbtvjIU9UGXX/nn18UCiXiwk93tp6ddkC iAvxGcgTDwj2qRkZMwUHUtozLVyYc3ynpDz/YUmmMkULDwrwxEsQEi4pzgFY4B3Tkuy2 W4scWxB7rdMnH8J7myEm8g5oEat1/HIvhiUxuF1MtrHEvaBV3ZjTTWsDREuURLChwCjT vzJarNBXWGSEL8hnc7l7eOA+gf1kwquouhEJt3oD++kAQ2X1mlce2e2R3I21y49Oygfp kcwQ== 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=C4y5H34/b66lYzmCayiry+Dr/iI1gotrFjxRhbqI+PI=; b=LHBVeCRgjIAy95K/yS7LOpWSAGDMvXA9dMV4/o2JKm3W27IaCGgXs9akVvzuXX/Cfq URlyON17IskaN+HEfz3VgZTdIEaWHfWI/UVN320ZqQSCBAYWSBES22HtPjkdKOAywfTi mFVyXLOZ2RwIN08Nm3RUBmjolLS2AOdPpr6fyEJx2qhAh244gcj4jFPM6L1elyZpOyt0 vT86QmOCRuSEcWeasGujz+OsSfvqqL+C953uwfCBg/j0bDg1CFYh9+BkYb6rxDvoHMrG 1wcfCr6Ea8gSkR9uQSaQrbHmSCfOZ2sYYQZ0uhJi9g90yO5Qb/YL1Tt1t0/LY1WRcR1j 2lZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=SOQeOheN; 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 m4-20020a6545c4000000b005134ad5e99bsi6258131pgr.625.2023.03.28.05.04.21; Tue, 28 Mar 2023 05:04:35 -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=SOQeOheN; 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 S232761AbjC1L1c (ORCPT + 99 others); Tue, 28 Mar 2023 07:27:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232377AbjC1L12 (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 718B3AB 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 20230328112722euoutp014414ac279b410e04c6d91dca8463fc9a~Qka83Uhao0435604356euoutp01n for ; Tue, 28 Mar 2023 11:27:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20230328112722euoutp014414ac279b410e04c6d91dca8463fc9a~Qka83Uhao0435604356euoutp01n 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/eMgVwR3HZp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c7189454a36b796 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> X-Spam-Status: No, score=-5.2 required=5.0 tests=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 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?1761613002145180726?= X-GMAIL-MSGID: =?utf-8?q?1761613002145180726?= 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);