Message ID | 20230403132221.94921-5-p.raghav@samsung.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2313600vqo; Mon, 3 Apr 2023 06:45:20 -0700 (PDT) X-Google-Smtp-Source: AKy350a4Ld7Kb7XDUX+z47rV5dIW+qTiUKOq3MY2SzwQ4JgwsAJa81y0I6H2eN8aHcNITTHl4/Fz X-Received: by 2002:a17:906:eb49:b0:889:58bd:86f1 with SMTP id mc9-20020a170906eb4900b0088958bd86f1mr36724272ejb.14.1680529520622; Mon, 03 Apr 2023 06:45:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680529520; cv=none; d=google.com; s=arc-20160816; b=YzHdKH80n1+nd0OomBBOnWhD5tPHPTh+6SLpxSoqE6Q7iXxeXn+iFkUPPvbqr+wg4X in7T4WYEeDhcgg1lXVoOYYlECVIo6va5xO9gGAb6/yZ1O/9pJjwsRDpICvlJh6nbzQUo DW24Zmp2+k6ZBQwukP4N8TywOpFXeni4ReHxtczqrLv+LA37k9SJLShuoNJyhul9Ypba nyKWY+z1n/ZZwPOvk1SFIAhROsjjV5pOInKSIBPtJKtf7kJsaL9u19QgYMRHfyY7rONw 7EN0Jsa/I/9Ig1YwkfrzAWRExWHr+wfuT5ScAhbpm+6VuvvoGtRToYQgPVIvjZFs7yPz VHyA== 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=W8pmr53I80YMgDXKAWDtsHEVSaAkBNBB56QxDR7DiSr0CiUo4FcJyr1Xl/Y2uJ3mD8 D51Am9AxjBqrYNkylskQMj1WcFJBMnSSlKuDISUaWYUsHUDHEeONNT+DI7hUpy5JbhYV fWNrudeN8Bj/s4RWvsAID8oYWUDr7v9OZ0ZzPM6oR25nkkt0WcoLzGgxiQdWyz3XUg8I 4gA9XHoJQ3mnWdK+xlM9EyjsRrWvdJl8sD+bt8Em8B5LvjdOXhPWZLMUQ8u1Oh18GLbn XonSASkMFIXfOzphhpZW9JqcWr3bcDIGBfakzK2yqAvQ16if10F+Y4QlGhBL5BF3+zHf 3ZZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=WXp2Xael; 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 q4-20020a170906388400b00931038178ecsi6338207ejd.330.2023.04.03.06.44.57; Mon, 03 Apr 2023 06:45:20 -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=WXp2Xael; 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 S232579AbjDCNWu (ORCPT <rfc822;zwp10758@gmail.com> + 99 others); Mon, 3 Apr 2023 09:22:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231795AbjDCNWd (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 3 Apr 2023 09:22:33 -0400 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E73CCA0B for <linux-kernel@vger.kernel.org>; Mon, 3 Apr 2023 06:22:32 -0700 (PDT) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20230403132227euoutp012a29ce89d5b4404e7a0d85ef0738a971~Sb3JIUbm61624016240euoutp01H for <linux-kernel@vger.kernel.org>; Mon, 3 Apr 2023 13:22:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20230403132227euoutp012a29ce89d5b4404e7a0d85ef0738a971~Sb3JIUbm61624016240euoutp01H DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1680528147; bh=C4y5H34/b66lYzmCayiry+Dr/iI1gotrFjxRhbqI+PI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WXp2XaelSwCkYKfkU9KMaQBicOuPO5FCl6eazPBuaqDzxeI0oeAp8adbZL8WddZmx X7uAsdaOnFuuiLwMj/35Lgs8J5U4FynuBTYEt2GUI96Y7F7qp/ZfxHo532agr5ULM5 JawW7/UyfI363OcIirmZR3Qt5uDyxChn97iVJZfQ= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20230403132226eucas1p27c60b550a84a0f9a8d83aeb35c2131a7~Sb3Hq6jkH1831918319eucas1p26; Mon, 3 Apr 2023 13:22:26 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 9C.F4.09503.113DA246; Mon, 3 Apr 2023 14:22:25 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20230403132225eucas1p15848db3c850e950b21b339d5861080e1~Sb3HLozNU1121911219eucas1p1e; Mon, 3 Apr 2023 13:22:25 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20230403132225eusmtrp222d08e847a640f99b1692735673dfaa4~Sb3HK3YsO0200802008eusmtrp2N; Mon, 3 Apr 2023 13:22:25 +0000 (GMT) X-AuditID: cbfec7f2-ea5ff7000000251f-b8-642ad3114817 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id EF.16.08862.113DA246; Mon, 3 Apr 2023 14:22:25 +0100 (BST) Received: from localhost (unknown [106.210.248.30]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20230403132225eusmtip18dbb686db7c510460cd06cbef5485d8b~Sb3G_SMEG2613126131eusmtip1C; Mon, 3 Apr 2023 13:22:25 +0000 (GMT) From: Pankaj Raghav <p.raghav@samsung.com> To: axboe@kernel.dk, minchan@kernel.org, martin@omnibond.com, hubcap@omnibond.com, brauner@kernel.org, viro@zeniv.linux.org.uk, senozhatsky@chromium.org, akpm@linux-foundation.org, willy@infradead.org, hch@lst.de Cc: devel@lists.orangefs.org, mcgrof@kernel.org, linux-block@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, gost.dev@samsung.com, linux-fsdevel@vger.kernel.org, Pankaj Raghav <p.raghav@samsung.com> Subject: [PATCH v2 4/5] mpage: use folios in bio end_io handler Date: Mon, 3 Apr 2023 15:22:20 +0200 Message-Id: <20230403132221.94921-5-p.raghav@samsung.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230403132221.94921-1-p.raghav@samsung.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrOKsWRmVeSWpSXmKPExsWy7djP87qCl7VSDPZftbKYs34Nm8Xqu/1s Fq8Pf2K02L95CpPFzQM7mSxWrj7KZNF+t4/JYu8tbYs9e0+yWFzeNYfN4t6a/6wWJ9f/Z7a4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A+rm79DOXvurOLm9XO772+Q8+P0YunoHuEqjxUzvDj3zD45c+7aJYHp p4RjGD4HX/p/gM307p3dEnGeWyQSbRbufzJPiaU4I9FQi7moOBEAW9tMD2oDAAA= X-CMS-MailID: 20230403132225eucas1p15848db3c850e950b21b339d5861080e1 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20230403132225eucas1p15848db3c850e950b21b339d5861080e1 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230403132225eucas1p15848db3c850e950b21b339d5861080e1 References: <20230403132221.94921-1-p.raghav@samsung.com> <CGME20230403132225eucas1p15848db3c850e950b21b339d5861080e1@eucas1p1.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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762162922486246534?= X-GMAIL-MSGID: =?utf-8?q?1762162922486246534?= |
Series | remove page_endio() | |
Commit Message
Pankaj Raghav
April 3, 2023, 1:22 p.m. UTC
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 <p.raghav@samsung.com>
---
fs/mpage.c | 28 ++++++++++++++++------------
1 file changed, 16 insertions(+), 12 deletions(-)
Comments
> + bio_for_each_folio_all(fi, bio) { > + if (!err) > + folio_mark_uptodate(fi.folio); > + else > + folio_set_error(fi.folio); > + folio_unlock(fi.folio); Super nitpicky, but I'd avoid inverted conditions unless there is a very clear benefit. I.e. I'd rather write this as: if (err) folio_set_error(fi.folio); else folio_mark_uptodate(fi.folio); Otherwise looks good: Reviewed-by: Christoph Hellwig <hch@lst.de>
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);