From patchwork Tue Apr 11 12:29:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Raghav X-Patchwork-Id: 81936 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2535236vqo; Tue, 11 Apr 2023 05:34:23 -0700 (PDT) X-Google-Smtp-Source: AKy350ZvvT9uWxP0aSfElVjO1PyP5Y9kKp9PCJtQeuW93/PIG9PADdDWApZ0zGA8J400EzXgIwTG X-Received: by 2002:a17:906:768a:b0:932:4255:5902 with SMTP id o10-20020a170906768a00b0093242555902mr7594852ejm.76.1681216463607; Tue, 11 Apr 2023 05:34:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681216463; cv=none; d=google.com; s=arc-20160816; b=n2gAdEVXLx5xG4vC+v99WQli6sMCfGVbcH9lcNv/ASu0zJxcUQyy0cOPKqcifPD/W1 CXNWsGu0ev2iOa5/xRIsQRHnpKFmemBqe9xnu3/+lsIPNvSvB9XGeBQzPgnSlbbXmdYw fhYAEfowHnV0FpbNlAp/rYDfQaYbYLXqiE9yLsBw7mmJK94Jwrk2Et4HlUG5vv4K8mf6 mpM7I9iLnXJKR3/kRTjJzgC63LxQB1kHleDQAgMKscBxQHwA6UQmF0FZFZxz7E8WQ/Hr pP/oiWt/5u/dHYjsmEkfClTH443y3UJj/OAqrm159mZcgutlyrl7MBhuBw9ZODKV6OP4 dy0A== 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=1qC6zHvAgcTgYm8ljFpJs+7FVJXDek+LLyQQCiQNxfg=; b=GOCxl53AZ2Rli/jYawjW4xT0DzlpWTsWGFo/O+yCWEaa1KvplEFTbzzascxkJt9kQ2 p5uijWOvwX3dzqIvlNsi66v4GueWMPDzUMhQ84y3/TwwpNx/bnFvy3yl447cMqGpvt10 5mYAH0jrele+lcadAJxOZ1AuwVIrXGLootrTyVbfi7BOcB97AThDPk4iumH8Dhww/MLI VaJ/C2K625fCwRVEFRCpjzcUHKQO48n4h1uF4O5dE9CcpooXVIr4+Vz3BLVAIDpDwfTA u5yA8mpILTSlLkZNUOu1EBGaL5FiNhpWQHD15p9qQlm14E6A2r6//UZKbDyMzbochlDx TtZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=k6k7bPGM; 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 30-20020a17090600de00b0094e111c8786si2277728eji.808.2023.04.11.05.33.59; Tue, 11 Apr 2023 05:34:23 -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=k6k7bPGM; 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 S230059AbjDKM3i (ORCPT + 99 others); Tue, 11 Apr 2023 08:29:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229950AbjDKM3c (ORCPT ); Tue, 11 Apr 2023 08:29:32 -0400 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC8463C0D for ; Tue, 11 Apr 2023 05:29:27 -0700 (PDT) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20230411122926euoutp02092f927e6445f19c569c57cf70217528~U4TInhIKC0164001640euoutp02U for ; Tue, 11 Apr 2023 12:29:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20230411122926euoutp02092f927e6445f19c569c57cf70217528~U4TInhIKC0164001640euoutp02U DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1681216166; bh=1qC6zHvAgcTgYm8ljFpJs+7FVJXDek+LLyQQCiQNxfg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k6k7bPGMEm2WHoEuC8ctkZLXXHIOTQHQqoV82xAuO9/lme4BfzpuXcLwM22tTO2wG L3UTTJPx6bmJ5ObCRUWkgAaYB1PogBSfjKjSwToyDIL80kxUwhaOZn2anIaaf4esh3 /HVXMrUTHDMOG6Y1maEiN1Ktyk/5rrfuuZnaq0Po= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20230411122924eucas1p2a842969709d6b49b03f7c346bb6d7103~U4THBHNHL3227732277eucas1p2w; Tue, 11 Apr 2023 12:29:24 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 8E.9A.10014.4A255346; Tue, 11 Apr 2023 13:29:24 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20230411122924eucas1p16c6abcf91a3e04c6a0a225606ca0044d~U4TGnGH0t0202002020eucas1p1Q; Tue, 11 Apr 2023 12:29:24 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20230411122924eusmtrp241d6a59a92a6a323b6b491c16e7e34ca~U4TGmSAGr0100601006eusmtrp2p; Tue, 11 Apr 2023 12:29:24 +0000 (GMT) X-AuditID: cbfec7f5-ba1ff7000000271e-0a-643552a43e97 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 1D.58.22108.4A255346; Tue, 11 Apr 2023 13:29:24 +0100 (BST) Received: from localhost (unknown [106.210.248.243]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230411122924eusmtip2237fca85463f83e9b9eeb88cf4b5bc78~U4TGX3VXf1077210772eusmtip2d; Tue, 11 Apr 2023 12:29:23 +0000 (GMT) From: Pankaj Raghav To: hubcap@omnibond.com, brauner@kernel.org, martin@omnibond.com, willy@infradead.org, hch@lst.de, minchan@kernel.org, viro@zeniv.linux.org.uk, axboe@kernel.dk, akpm@linux-foundation.org, senozhatsky@chromium.org Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, devel@lists.orangefs.org, linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, gost.dev@samsung.com, mcgrof@kernel.org, Pankaj Raghav Subject: [PATCH v3 3/3] mpage: use folios in bio end_io handler Date: Tue, 11 Apr 2023 14:29:20 +0200 Message-Id: <20230411122920.30134-4-p.raghav@samsung.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230411122920.30134-1-p.raghav@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrJKsWRmVeSWpSXmKPExsWy7djP87pLgkxTDG4vUrOYs34Nm8Xqu/1s Fq8Pf2K02L95CpPFzQM7mSxWrj7KZNF+t4/JYu8tbYs9e0+yWFzeNYfN4t6a/6wWJ9f/Z7a4 MeEpo8Wyr+/ZLT4vbWG32L1xEZvF+b/HWS1+/5jD5iDkMbvhIovH5hVaHpfPlnpsWtXJ5rHp 0yR2jxMzfrN4NEy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ymxFGckGmoxFxUnAgCIKuLiagMAAA== X-CMS-MailID: 20230411122924eucas1p16c6abcf91a3e04c6a0a225606ca0044d X-Msg-Generator: CA X-RootMTR: 20230411122924eucas1p16c6abcf91a3e04c6a0a225606ca0044d X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230411122924eucas1p16c6abcf91a3e04c6a0a225606ca0044d References: <20230411122920.30134-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?1762883234807906833?= X-GMAIL-MSGID: =?utf-8?q?1762883234807906833?= 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 Reviewed-by: Christoph Hellwig --- fs/mpage.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/fs/mpage.c b/fs/mpage.c index d9540c1b7427..242e213ee064 100644 --- a/fs/mpage.c +++ b/fs/mpage.c @@ -45,24 +45,32 @@ */ 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) - page_endio(bv->bv_page, REQ_OP_READ, - blk_status_to_errno(bio->bi_status)); + bio_for_each_folio_all(fi, bio) { + if (err) + folio_set_error(fi.folio); + else + folio_mark_uptodate(fi.folio); + folio_unlock(fi.folio); + } bio_put(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) - page_endio(bv->bv_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); }