From patchwork Mon Apr 3 13:22: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: 13198166 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 F1CADC761A6 for ; Mon, 3 Apr 2023 13:22:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 894EF900003; Mon, 3 Apr 2023 09:22:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 846606B0078; Mon, 3 Apr 2023 09:22:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 425976B007B; Mon, 3 Apr 2023 09:22:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 0A12A900002 for ; Mon, 3 Apr 2023 09:22:32 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 9DB29ABF1D for ; Mon, 3 Apr 2023 13:22:31 +0000 (UTC) X-FDA: 80640144102.19.7A17BF4 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by imf19.hostedemail.com (Postfix) with ESMTP id 0E0481A0017 for ; Mon, 3 Apr 2023 13:22:28 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=samsung.com header.s=mail20170921 header.b=WXp2Xael; spf=pass (imf19.hostedemail.com: domain of p.raghav@samsung.com designates 210.118.77.11 as permitted sender) smtp.mailfrom=p.raghav@samsung.com; dmarc=pass (policy=none) header.from=samsung.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1680528149; 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=C4y5H34/b66lYzmCayiry+Dr/iI1gotrFjxRhbqI+PI=; b=qR9YCo7Bx7Ydt66KpTcu/Y8e1Un0pT/5AG71hku+RD3iLOH8g1Ms/c3lgqqbqTCXdSMwFk bnvTnzLZiKxuOBbwOZ0N4i1XjqOp2Rcx2qbuEKzrrrLySIj9FNjzOG0vN2eFqvVNKtDhMk D+LlIqCJkfyMN1zcbBAHBUFeSBqkrAQ= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=samsung.com header.s=mail20170921 header.b=WXp2Xael; spf=pass (imf19.hostedemail.com: domain of p.raghav@samsung.com designates 210.118.77.11 as permitted sender) smtp.mailfrom=p.raghav@samsung.com; dmarc=pass (policy=none) header.from=samsung.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1680528149; a=rsa-sha256; cv=none; b=2hZm9k3GXiP2Xm+IATtMBiUUni05WmpouRdw9cqfnG6ZTDhlEN2R35r04F8cF9KWYLgG6/ JDhI4P9S+/BfkPwFRUK1wVBzkYGTOy+7WV0J8h0hZRWrU2ksUMYfaPs07PCB9gkQW8HRk2 hleWbTqr1s5psr/3AcuhfuyXIhI632Y= Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20230403132227euoutp01c2ee7068f888a6ae4a843c1a64d12f73~Sb3JFZNVc1624716247euoutp010 for ; Mon, 3 Apr 2023 13:22:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20230403132227euoutp01c2ee7068f888a6ae4a843c1a64d12f73~Sb3JFZNVc1624716247euoutp010 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 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 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 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrOKsWRmVeSWpSXmKPExsWy7djP87qCl7VSDPZftbKYs34Nm8Xqu/1s Fq8Pf2K02L95CpPFzQM7mSxWrj7KZNF+t4/JYu8tbYs9e0+yWFzeNYfN4t6a/6wWJ9f/Z7a4 MeEpo8Wyr+/ZLT4vbWG32L1xEZvF+b/HWS1+/5jD5iDkMbvhIovH5hVaHpfPlnpsWtXJ5rHp 0yR2jxMzfrN4NEy9xeax+2YDm8ev23dYPfq2rGL0+LxJzmPTk7dMATxRXDYpqTmZZalF+nYJ XBkLXl5iKZjAW/Hn0j62BsY7XF2MnBwSAiYS16etY+li5OIQEljBKDF50wF2COcLo0Tr6g9Q zmdGiRNrTrDCtBxa9IEJIrGcUWL7yV1sEM4LRolvsx4ADePgYBPQkmjsBOsWEbjFKPGmZzZY B7PAfUaJebv3MoGMEhawl9jZupYRxGYRUJV4daYDzOYVsJSYd/ITI8Q6eYn9B88yg9icAlYS jdPnQtUISpyc+YQFxGYGqmneOpsZon43p8SRWzwQtovE/5MroeLCEq+Ob2GHsGUk/u+czwRh V0s8vfGbGeQ4CYEWRon+nevZQD6QELCW6DuTA2IyC2hKrN+lD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ZOdpBeEZDwsgvHWUAcZoHnjBJrpvxmBmkQFrCX2Nm6FmwQi4CqxKszHWA2r4Cl xLyTn6AWyEvsP3gWrJ5TwEqicfpcRohllhJfL95ihagXlDg58wkLiM0MVN+8dTbzBEaBWUhS s5CkFjAyrWIUSS0tzk3PLTbUK07MLS7NS9dLzs/dxAiM4W3Hfm7ewTjv1Ue9Q4xMHIyHGCU4 mJVEeFW7tFKEeFMSK6tSi/Lji0pzUosPMZoC3T2RWUo0OR+YRPJK4g3NDEwNTcwsDUwtzYyV xHk9CzoShQTSE0tSs1NTC1KLYPqYODilGpiymk/w5G2oWj4r4iKrZdfjvPB16yJijvkc2Jnm WDdd5JXYulznR9H9u4Ry3H4J/3X/LFgXUO//L6H1ghvz+woPFR9nWeZnobVbo+w5T/voWmQd +iAo0H6I78Tq2Tu0pktYhS2N1J+7bkZuTmj9m0+t0nV7tp2wrO97Kv/xh+CNZadbah/8/757 OdPL7sYPC3a++6l9bLKr7irvLbtf3Z1SlS0Z9rrwk5mNvnva6/zmywuLVgZoHdoafePuIuuf 1yeznihwWjFRaElt+A+rm79DOXvurOLm9XO772+Q8+P0YunoHuEqjxUzvDj3zD45c+7aJYHp p4RjGD4HX/p/gM307p3dEnGeWyQSbRbufzJPiaU4I9FQi7moOBEAW9tMD2oDAAA= X-CMS-MailID: 20230403132225eucas1p15848db3c850e950b21b339d5861080e1 X-Msg-Generator: CA X-RootMTR: 20230403132225eucas1p15848db3c850e950b21b339d5861080e1 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230403132225eucas1p15848db3c850e950b21b339d5861080e1 References: <20230403132221.94921-1-p.raghav@samsung.com> X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: w5bpb3u3tr4uwpqzk7gmkmsp6n5nyez5 X-Rspamd-Queue-Id: 0E0481A0017 X-HE-Tag: 1680528148-736947 X-HE-Meta: U2FsdGVkX195t5il1D3TrTkFLeUyPRwcgO3C0bTSiYrRcq6kiao3N0ICvJ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jyhe/96bR4Y2Lm7cjEuOV 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: 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, 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);