From patchwork Wed Mar 22 13:50:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Raghav X-Patchwork-Id: 13184080 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D58AC74A5B for ; Wed, 22 Mar 2023 13:50:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8004D6B007B; Wed, 22 Mar 2023 09:50:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 712B86B007D; Wed, 22 Mar 2023 09:50:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 565B96B007E; Wed, 22 Mar 2023 09:50:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 3EC626B007B for ; Wed, 22 Mar 2023 09:50:25 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id F25AE1A0484 for ; Wed, 22 Mar 2023 13:50:24 +0000 (UTC) X-FDA: 80596668768.17.DA47C9C Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by imf24.hostedemail.com (Postfix) with ESMTP id 6BF93180015 for ; Wed, 22 Mar 2023 13:50:21 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=samsung.com header.s=mail20170921 header.b=NsCW33O+; spf=pass (imf24.hostedemail.com: domain of p.raghav@samsung.com designates 210.118.77.12 as permitted sender) smtp.mailfrom=p.raghav@samsung.com; dmarc=permerror reason="Multiple policies defined in DNS" header.from=samsung.com (policy=permerror) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1679493021; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=5/+0KaEbpjyZkaLqtYLBQz1+pPqkvr1OOiQOg6+VTQI=; b=J2a3TaBJp7wdiZ+a6mN2CQmdTaz4WLaMW37G1LgMctCkyyAwIjbyCQVtO4MFBx+ZIQaHJB Jz3VrZz1+jPSOO4mZmM9JBFrjXxJantizUs0ZgoUBiM8zxTw4Bop6u6/RvRAtcS1Sn3VrC JR8Gn3YyQluK0/Rk1hrkLJ9MrCDfK/0= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=samsung.com header.s=mail20170921 header.b=NsCW33O+; spf=pass (imf24.hostedemail.com: domain of p.raghav@samsung.com designates 210.118.77.12 as permitted sender) smtp.mailfrom=p.raghav@samsung.com; dmarc=permerror reason="Multiple policies defined in DNS" header.from=samsung.com (policy=permerror) ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1679493021; a=rsa-sha256; cv=none; b=RBU91FDiBGTWiy+KtYVGfUBeymBmm7y15tQxnEEKjC2TQ4jsoT9cWFUNI/0m/0Dz/26f10 SnyAHWCwBJKlqEK3wbwmc6TEmAtGWn068MWKqKGtTTC2ZaNxmEQYq1R4nJs1SO8tUnlzoC KaRPDsy2HolLQS7fTdPopgAOI1L+QWE= Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20230322135019euoutp029c212509bc53b81c997cd1cca3f5d862~OwgDIjnyO1787317873euoutp02x for ; Wed, 22 Mar 2023 13:50:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20230322135019euoutp029c212509bc53b81c997cd1cca3f5d862~OwgDIjnyO1787317873euoutp02x DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1679493019; bh=5/+0KaEbpjyZkaLqtYLBQz1+pPqkvr1OOiQOg6+VTQI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NsCW33O+y//g7yZSiWUmZFyW1iX5GhKRBk/wos093lNoKU7oN+ONmCmnW6Yfy3C2X w4SFKZ0FUJuYgM2ehVYaW1z8F/NEdAnEOIalrhVrkD8U6hCCLUL7Fayj14BIqgLNZv rHkzlVEMDZRKXe5G0KSZmc0i7oBQOasfkP8+SNDA= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20230322135017eucas1p2629dcfb1875f78654e25001786cb234f~OwgBPtNpR2731127311eucas1p2j; Wed, 22 Mar 2023 13:50:17 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 91.38.10014.9970B146; Wed, 22 Mar 2023 13:50:17 +0000 (GMT) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20230322135017eucas1p1350c6e130fa367263432fa35894bdf1e~OwgAwlFQT1542115421eucas1p1C; Wed, 22 Mar 2023 13:50:17 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20230322135017eusmtrp271a5c4fe6e5c76bbc457c0ee9d299624~OwgAvzLhg0726007260eusmtrp2I; Wed, 22 Mar 2023 13:50:17 +0000 (GMT) X-AuditID: cbfec7f5-ba1ff7000000271e-14-641b079936f1 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 9B.6E.09583.9970B146; Wed, 22 Mar 2023 13:50:17 +0000 (GMT) Received: from localhost (unknown [106.210.248.108]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230322135016eusmtip2064511fdb3f41a6d5ea559782138fbae~OwgAjsse92536025360eusmtip2u; Wed, 22 Mar 2023 13:50:16 +0000 (GMT) From: Pankaj Raghav To: senozhatsky@chromium.org, viro@zeniv.linux.org.uk, axboe@kernel.dk, willy@infradead.org, brauner@kernel.org, akpm@linux-foundation.org, minchan@kernel.org, hubcap@omnibond.com, martin@omnibond.com Cc: mcgrof@kernel.org, devel@lists.orangefs.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, gost.dev@samsung.com, Pankaj Raghav , Christoph Hellwig Subject: [RFC v2 3/5] mpage: split bi_end_io callback for reads and writes Date: Wed, 22 Mar 2023 14:50:11 +0100 Message-Id: <20230322135013.197076-4-p.raghav@samsung.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230322135013.197076-1-p.raghav@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrGKsWRmVeSWpSXmKPExsWy7djPc7oz2aVTDBquKFrMWb+GzWL13X42 i9eHPzFa7N88hcni5oGdTBYrVx9lsmi/28dksfeWtsWevSdZLC7vmsNmcW/Nf1aLk+v/M1vc mPCU0WLZ1/fsFp+XtrBb7N64iM3i/N/jrBa/f8xhcxDymN1wkcVj8wotj8tnSz02repk89j0 aRK7x4kZv1k8GqbeYvPYfbOBzePX7TusHn1bVjF6fN4k57HpyVumAJ4oLpuU1JzMstQifbsE roxVG/wL/vFU/F3n28B4jKuLkZNDQsBE4uqnRrYuRi4OIYEVjBJPXj9jgXC+MEp8OPuFHcL5 zCixrPEVG0zL6z2ToVqWM0rcPfIMynnJKPH17HzGLkYODjYBLYnGTrBuEYEzjBJTmmYwgjjM Av8ZJXoPLwQbJSzgJbFs+gcmEJtFQFXi6OOdzCA2r4CVxJGHE5kh1slL7D94FszmFLCWeLRo GhtEjaDEyZlPWEBsZqCa5q2zmUEWSAjs5pTYee0YM8gVEgIuEg0dxhBzhCVeHd/CDmHLSPzf OZ8Jw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p09B1mhkhISNxe2MQIYQtL/LnWBVX0nFFiy6lf7F2MHBxs AloSjZ3sIDUiAjcYJdpX6YHUMAt0Mkmc+DITLCEs4CWxbPoHJhCbRUBV4ujjnWALeAWsJI48 nAi1TF5i/8GzYDangLXEo0XT2EBsIaCay/snsULUC0qcnPmEBcRmBqpv3jqbeQKjwCwkqVlI UgsYmVYxiqSWFuem5xYb6RUn5haX5qXrJefnbmIExu+2Yz+37GBc+eqj3iFGJg7GQ4wSHMxK IrxuzBIpQrwpiZVVqUX58UWlOanFhxhNge6eyCwlmpwPTCB5JfGGZgamhiZmlgamlmbGSuK8 ngUdiUIC6YklqdmpqQWpRTB9TBycUg1M7Yfd/v7W55q/vP501as9vL2nzL9smMe87eXj/TlH E092Ppn8mDPq3cIlj61CVaun8R0yENb9Unfmvv7ve8G8PGUSh4XOu9pELJA+63j3Zp9K3I1e R7vS+06njteVdj4I5zrz+8sHH++r8659C57/RbKsoax2q/QP7SfGL5aevZbAvY/v7PGj/y0X lVtW9rFmc+zx8p3W//jy/G8REn5r1YPu/t2nJWzod0Er5lNmxfT7LN5XpmUExq99sWpBaP+m bSePShycV7y+/vqvTXbX9s/S+Rf78/vjlydOmbC5swWbTJ1rOOuV1o1L6hWvvJfe1ZRofDz5 HPts6fjy//6se7W6788NeFTz2rimMt0nvlGJpTgj0VCLuag4EQD9lYbvaAMAAA== X-CMS-MailID: 20230322135017eucas1p1350c6e130fa367263432fa35894bdf1e X-Msg-Generator: CA X-RootMTR: 20230322135017eucas1p1350c6e130fa367263432fa35894bdf1e X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230322135017eucas1p1350c6e130fa367263432fa35894bdf1e References: <20230322135013.197076-1-p.raghav@samsung.com> X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 6BF93180015 X-Rspam-User: X-Stat-Signature: wscszuwi5sz9uyqfz8nb7uerdiwo7qg3 X-HE-Tag: 1679493021-462107 X-HE-Meta: U2FsdGVkX1+MTNLRQa2k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EMOsoNlmP5scNUAu092msQFS4380hzt6N2wyOa2FHi7byuKXw3krq8IxrFFjotD+KuNn3UW5LAxEubJ X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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;