From patchwork Tue Mar 28 11:27:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Raghav X-Patchwork-Id: 76016 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2152910vqo; Tue, 28 Mar 2023 04:52:19 -0700 (PDT) X-Google-Smtp-Source: AKy350YCnpNLORmZtl/LXb3Zohns1VT5hdobcRZ6gvhBu8M1lVHBfGRHjAoUvCXjYxpHFdogHiMZ X-Received: by 2002:a17:906:4b08:b0:8b1:7de3:cfaa with SMTP id y8-20020a1709064b0800b008b17de3cfaamr16352896eju.3.1680004338936; Tue, 28 Mar 2023 04:52:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680004338; cv=none; d=google.com; s=arc-20160816; b=uq+0TNAuCoSPZmQb3C6B/sa0BUe1w76qQ4dAiC2NyWKl/4sJ6QKfEkCHQUdsC40dOG 6BPdgHYIHYXnfGb+6RfaIxcnMvhRDQieWgDrkte7r7h+ChFndjAhlfAsYSiAaBosEflf Leg3rXBU2mLkp2T+8qIQAtJz6D9R4VllYO8WL3wZlQA1lG3ILUvv5wK3cZGd/WyE24vP FXQu0cyd0gHb83fsx1plcrTcxKzaByrlD4I6dgjBbDoo1qXOng+lG71QPi//V1KRvVVs GBiIzsnIdBFl5hIycyYUgsGjt2+b76ei4DOMRYR8JmtKocUdJpJSH0uSoUTA+zd0+60h hmtA== 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=5/+0KaEbpjyZkaLqtYLBQz1+pPqkvr1OOiQOg6+VTQI=; b=cTisUpveC6b+Yjfs6qbtNn8e2XwGL3ejWsGpjw5BVmxXtC6Dx5fZyMDMHRiLwvWbvp p7HF7VVyl/W+Yyk2Zk2Ktqb97j/6blZprPlNbryJIybv2wLLqa6XQEHdTOnmDoq7ylAU eoOtw3SORidMRXNcZcvXArwqZOLhZCvg5Q0Sac3wxXK9LbykVpKp59GZOABB5ovdhQdB NZu934yS1LAFPTRZGh67WaVYAEVJKfGwEVbxEZEaLy+2hXPKs+QxJNEl/lrA3uI5CnLY V5x5aOxqKKsDq6GD5Kb19Qv4uCxUH6ihajjC6GTh03G4eZlOE/Q5OgD5Sw7Yjs1csKV/ o1+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=X8veZPRU; 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 n16-20020a170906b31000b009267d6857ebsi29206677ejz.952.2023.03.28.04.51.55; Tue, 28 Mar 2023 04:52:18 -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=X8veZPRU; 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 S232394AbjC1L12 (ORCPT + 99 others); Tue, 28 Mar 2023 07:27:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229848AbjC1L1Z (ORCPT ); Tue, 28 Mar 2023 07:27:25 -0400 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0D0E3C22 for ; Tue, 28 Mar 2023 04:27:22 -0700 (PDT) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20230328112721euoutp013b5cc971c61974993514c8ca25b83fe0~Qka8Ayd5Q0173901739euoutp01k for ; Tue, 28 Mar 2023 11:27:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20230328112721euoutp013b5cc971c61974993514c8ca25b83fe0~Qka8Ayd5Q0173901739euoutp01k DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1680002841; bh=5/+0KaEbpjyZkaLqtYLBQz1+pPqkvr1OOiQOg6+VTQI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X8veZPRUscTbo+csuyoBzJR3U41Q+EmfypVD8wc3G9EESXJDZizknQm0BysjftENp 7A7p+glY1oSYzot0AYfTKdxnMFGYgLUMcXjGSitN+JrzARRrIZHLf3dtA6cPZ8MyYv S+79mloau2Nn8yJ7L9kJGA/quO8JGZfTHftIr/DU= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20230328112720eucas1p22832e14ccc0ab8aa31019946721f05ee~Qka6fKv8z0111901119eucas1p2l; Tue, 28 Mar 2023 11:27:20 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 75.51.09503.81FC2246; Tue, 28 Mar 2023 12:27:20 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20230328112719eucas1p2b0f94ad7b06990203081d2b125dfc6ac~Qka531zRT0949409494eucas1p26; Tue, 28 Mar 2023 11:27:19 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20230328112719eusmtrp2e345237a90bdb05950bbce0a693b0b7e~Qka53IS6i0134701347eusmtrp2Q; Tue, 28 Mar 2023 11:27:19 +0000 (GMT) X-AuditID: cbfec7f2-e8fff7000000251f-7c-6422cf18c5ba Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 9D.71.09583.71FC2246; Tue, 28 Mar 2023 12:27:19 +0100 (BST) Received: from localhost (unknown [106.210.248.108]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20230328112719eusmtip1eb2b40496aafbd97f77244d6662ebaed~Qka5ppj340337303373eusmtip1Z; 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 , Christoph Hellwig Subject: [PATCH 3/5] mpage: split bi_end_io callback for reads and writes Date: Tue, 28 Mar 2023 13:27:14 +0200 Message-Id: <20230328112716.50120-4-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+NgFnrEKsWRmVeSWpSXmKPExsWy7djP87oS55VSDObuZ7eYs34Nm8Xqu/1s Fq8Pf2K02L95CpPFzQM7mSxWrj7KZNF+t4/JYu8tbYs9e0+yWFzeNYfN4t6a/6wWJ9f/Z7a4 MeEpo8Wyr+/ZLT4vbWG32L1xEZvF+b/HWS1+/5jD5iDkMbvhIovH5hVaHpfPlnpsWtXJ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7nS8mKcdv3wkXsx1b5x742HpzVWyIoqsRRnJBpqMRcVJwIALLf4ZWgDAAA= X-CMS-MailID: 20230328112719eucas1p2b0f94ad7b06990203081d2b125dfc6ac X-Msg-Generator: CA X-RootMTR: 20230328112719eucas1p2b0f94ad7b06990203081d2b125dfc6ac X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230328112719eucas1p2b0f94ad7b06990203081d2b125dfc6ac 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?1761612229728061351?= X-GMAIL-MSGID: =?utf-8?q?1761612229728061351?= Split the bi_end_io handler for reads and writes similar to other aops. This is a prep patch before we convert end_io handlers to use folios. Suggested-by: Christoph Hellwig Signed-off-by: Pankaj Raghav --- fs/mpage.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/fs/mpage.c b/fs/mpage.c index 22b9de5ddd68..3a545bf0f184 100644 --- a/fs/mpage.c +++ b/fs/mpage.c @@ -43,14 +43,28 @@ * status of that page is hard. See end_buffer_async_read() for the details. * There is no point in duplicating all that complexity. */ -static void mpage_end_io(struct bio *bio) +static void mpage_read_end_io(struct bio *bio) { struct bio_vec *bv; struct bvec_iter_all iter_all; bio_for_each_segment_all(bv, bio, iter_all) { struct page *page = bv->bv_page; - page_endio(page, bio_op(bio), + page_endio(page, REQ_OP_READ, + blk_status_to_errno(bio->bi_status)); + } + + bio_put(bio); +} + +static void mpage_write_end_io(struct bio *bio) +{ + struct bio_vec *bv; + struct bvec_iter_all iter_all; + + 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)); } @@ -59,7 +73,11 @@ static void mpage_end_io(struct bio *bio) static struct bio *mpage_bio_submit(struct bio *bio) { - bio->bi_end_io = mpage_end_io; + if (op_is_write(bio_op(bio))) + bio->bi_end_io = mpage_write_end_io; + else + bio->bi_end_io = mpage_read_end_io; + guard_bio_eod(bio); submit_bio(bio); return NULL;