From patchwork Tue Apr 11 12:29:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Raghav X-Patchwork-Id: 13207509 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5E62C77B70 for ; Tue, 11 Apr 2023 12:29:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229980AbjDKM3c (ORCPT ); Tue, 11 Apr 2023 08:29:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229490AbjDKM3a (ORCPT ); Tue, 11 Apr 2023 08:29:30 -0400 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3B0A1BE8 for ; Tue, 11 Apr 2023 05:29:26 -0700 (PDT) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20230411122925euoutp0166592db218433964ee1f02197a02bc58~U4THx9iap0721707217euoutp01h for ; Tue, 11 Apr 2023 12:29:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20230411122925euoutp0166592db218433964ee1f02197a02bc58~U4THx9iap0721707217euoutp01h DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1681216165; bh=PIVtaWRdXFvvGvca/utIz/lLXjHseGY076GdVp9CofQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s+NcSqyqbq11RtsrC+miaqtF9/zatU92pOylTRwd7fqlJapAX0PouHP1PgEAx/uXx DyeEETwwsyKbo+sFwMBF1sju9QKbpPx1/GJyuzdssfrueHqz7EcEhAZP0KLactXS2B wP3ZGLEpiAXdItnsQ4DEPTcKYoI50y18gs5kxSuc= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20230411122923eucas1p2f756a287f9f45b8c76bdbd7f81d949db~U4TF8Df2y3228532285eucas1p2t; Tue, 11 Apr 2023 12:29:23 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id B8.9A.10014.3A255346; Tue, 11 Apr 2023 13:29:23 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20230411122923eucas1p27e097fa66db8e166d14658bc7c6f180b~U4TFlFxcc3003730037eucas1p27; Tue, 11 Apr 2023 12:29:23 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20230411122923eusmtrp1f4a4812316778b3dcb34ac05a45a01dd~U4TFkUivq0646206462eusmtrp1S; Tue, 11 Apr 2023 12:29:23 +0000 (GMT) X-AuditID: cbfec7f5-b8bff7000000271e-03-643552a3acbc Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id B7.FB.34412.2A255346; Tue, 11 Apr 2023 13:29:23 +0100 (BST) Received: from localhost (unknown [106.210.248.243]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230411122922eusmtip22c05afaf469dd0ad10bc0ac238306b53~U4TFSq8M32761927619eusmtip2k; Tue, 11 Apr 2023 12:29:22 +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 1/3] orangefs: use folios in orangefs_readahead Date: Tue, 11 Apr 2023 14:29:18 +0200 Message-Id: <20230411122920.30134-2-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+NgFnrGKsWRmVeSWpSXmKPExsWy7djP87qLg0xTDJqvyVnMWb+GzWL13X42 i9eHPzFa7N88hcni5oGdTBYrVx9lsmi/28dksfeWtsWevSdZLC7vmsNmcW/Nf1aLk+v/M1vc mPCU0WLZ1/fsFp+XtrBb7N64iM3i/N/jrBa/f8xhcxDymN1wkcVj8wotj8tnSz02repk89j0 aRK7x4kZv1k8GqbeYvPYfbOBzePX7TusHn1bVjF6fN4k57HpyVumAJ4oLpuU1JzMstQifbsE roxzS26zFjRwV9x9e5+pgbGZs4uRg0NCwERic593FyMXh5DACkaJnS93sEA4Xxglbm+7ygTh fGaUeHFlKWMXIydYx97Pe9lBbCGB5YwS7Yf8IYpeMkpM2rCLCWQsm4CWRGMnO0hcROAWo8SC z1cYQRxmgfuMEg9vnQLrFhZwkliyeQYriM0ioCrxbv1fZpBmXgFLifbFTBDL5CX2HzzLDGJz ClhJrF71AewIXgFBiZMzn7CA2MxANc1bZzODzJcQ2M0p0X15KRtEs4vE5glHWCFsYYlXx7ew Q9gyEqcn97BA2NUST2/8hmpuYZTo37meDRIw1hJ9Z3JATGYBTYn1u/Qhyh0l9n7bxwhRwSdx 460gxAl8EpO2TWeGCPNKdLQJQVQrSez8+QRqqYTE5aY5UEs9JH71HWefwKg4C8kzs5A8Mwth 7wJG5lWM4qmlxbnpqcXGeanlesWJucWleel6yfm5mxiBSfH0v+NfdzCuePVR7xAjEwfjIUYJ DmYlEd4fLqYpQrwpiZVV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37uWUH48pXH/UOMTJxMB5ilOBg VhLh/eFimiLEm5JYWZValB9fVJqTWnyI0RTo7InMUqLJ+cAEklcSb2hmYGpoYmZpYGppZqwk zutZ0JEoJJCeWJKanZpakFoE08fEwSnVwLQ93KVDxE3m+9vDar+Mz0p8/1bln2KS8P2w0b97 3lMzqht59tmv+yM8sbzajeF+3MY9BwWrzrM8z8wt3XzhRsdn4+o4l7e6cufMz0W+512x//iT I2dm7cqqZbuo4FT3uoZl8ZkGkX3+nA+Xne74dXSPaV3jWcFdpS8KPx+b++CB992C3Us/Zs91 /RFmfCb/ucYU9i/8obeMYo/6zThy03ZXQLj86b663BOLyn6V+K1j33Fv95t/ndcSv9nruDOo 3rnC929L3s7/Fuxpnkn8TKJFD2oyXnkFbD8h2CWzUX+6mOq1Vfe+Bl0o9evQuBo62aXz56Wy pD2TXpp0qV9fffT1PlZHs9opi+X0GpnYZq9UYinOSDTUYi4qTgQAQYdjlmgDAAA= X-CMS-MailID: 20230411122923eucas1p27e097fa66db8e166d14658bc7c6f180b X-Msg-Generator: CA X-RootMTR: 20230411122923eucas1p27e097fa66db8e166d14658bc7c6f180b X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230411122923eucas1p27e097fa66db8e166d14658bc7c6f180b References: <20230411122920.30134-1-p.raghav@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Convert orangefs_readahead() from using struct page to struct folio. This conversion removes the call to page_endio() which is soon to be removed, and simplifies the final page handling. The page error flags is not required to be set in the error case as orangefs doesn't depend on them. Reviewed-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig Tested-by: Mike Marshall Signed-off-by: Pankaj Raghav --- fs/orangefs/inode.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c index aefdf1d3be7c..9014bbcc8031 100644 --- a/fs/orangefs/inode.c +++ b/fs/orangefs/inode.c @@ -244,7 +244,7 @@ static void orangefs_readahead(struct readahead_control *rac) struct iov_iter iter; struct inode *inode = rac->mapping->host; struct xarray *i_pages; - struct page *page; + struct folio *folio; loff_t new_start = readahead_pos(rac); int ret; size_t new_len = 0; @@ -275,9 +275,10 @@ static void orangefs_readahead(struct readahead_control *rac) ret = 0; /* clean up. */ - while ((page = readahead_page(rac))) { - page_endio(page, false, ret); - put_page(page); + while ((folio = readahead_folio(rac))) { + if (!ret) + folio_mark_uptodate(folio); + folio_unlock(folio); } } From patchwork Tue Apr 11 12:29:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Raghav X-Patchwork-Id: 13207510 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3CBA3C77B6F for ; Tue, 11 Apr 2023 12:29:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230026AbjDKM3e (ORCPT ); Tue, 11 Apr 2023 08:29:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229804AbjDKM3b (ORCPT ); Tue, 11 Apr 2023 08:29:31 -0400 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00DF02D6B for ; Tue, 11 Apr 2023 05:29:26 -0700 (PDT) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20230411122925euoutp02a5314f02f1a70150cdf560be568cb623~U4TIE7DJa0163801638euoutp02K for ; Tue, 11 Apr 2023 12:29:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20230411122925euoutp02a5314f02f1a70150cdf560be568cb623~U4TIE7DJa0163801638euoutp02K DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1681216165; bh=l7peqDnGhiOjw0ljVfPNDYGwu5jQ8i9/ouCQ6iiHQ5Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BeGheTcdFlFG0Wy/rnM5V3J1/7UuTP2b7hrT0YCLH3mEZsS66F/accCZV0rybI1ZW T6lLMoTjtYTrD8djfrYre+eYhpCFlyPe1R5X7SI9wc4DU7C8vyn7cN8trYygUKURw8 Wu/0T/zi8O9pfVHfeeQV7kiZfKILmuM+4jXtTnts= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20230411122924eucas1p23bed121ab289f68a56408d8d79c0df63~U4TGdJ_6P3227632276eucas1p2o; Tue, 11 Apr 2023 12:29:24 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 5A.9A.10014.3A255346; 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 20230411122923eucas1p1dfc182a2c785eeb362b9d670dfe3ba2f~U4TGDwBJQ1913619136eucas1p1q; Tue, 11 Apr 2023 12:29:23 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20230411122923eusmtrp21cfb01c80494ecf51988510dd7078da0~U4TGCeyKw0100601006eusmtrp2n; Tue, 11 Apr 2023 12:29:23 +0000 (GMT) X-AuditID: cbfec7f5-b8bff7000000271e-07-643552a3af96 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 7B.58.22108.3A255346; Tue, 11 Apr 2023 13:29:23 +0100 (BST) Received: from localhost (unknown [106.210.248.243]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230411122923eusmtip2e2017259e26006e17d70d3dee3efbbc0~U4TF2Bbap1393113931eusmtip22; 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 2/3] mpage: split submit_bio and bio end_io handler for reads and writes Date: Tue, 11 Apr 2023 14:29:19 +0200 Message-Id: <20230411122920.30134-3-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: H4sIAAAAAAAAA01Sf0wTZxjmu7veHZ11Z2HxC9Nt1qARMxxxNZ863C+SXcKSGcElIxrs6A3N 2opXkLpmplOyrUD4tYECna3Oza6YIFXRAg3ya6xIIVpxUKBIVtyAkG1UlvKjdpRjmf89z/c+ 7/s875uPxqV/iOLoY5pcjtcoVDJSTDT+PN/36uUDcuVrj24BZKq/SqK60VISTXfMAtR6/VsM Dd1xYOinui4MfTVagiGndztqcboI5Gkykch3NSxCrvowjgbLJgD6ce5PCgV+KKBQc8MlEvWH ukVoMWgi35KytYZ7BHvdmsB63Hms3WYkWftsBcX+cn6RYA2VXpJtHjKQ7MLwiIgtuWEDbMD+ Emv3z2D712SI31ByqmMnOX7HviPiow+r/6FyHAm632ZLMQN4IisENA2Z1+E9N1UIxLSUsQLY 83gAE8gTAFt8IUIgAQCnFm3LJHqlo+17Oy4UrgDY5bGIBDIJYOflIioyl2QS4BfGlbmxjBdA S+ABiBCcGQ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pZ6hsbmsVZGpkr6djYpqTmZZalF+nYJehnXZn5jL9ipVfH4Uz9TA+MX pS5GTg4JAROJg4s3MXcxcnEICSxllLg2aQ0TREJC4vbCJkYIW1jiz7UuNoii54wSe29MY+9i 5OBgE9CSaOxkB4mLCDxjlJi9YQsrSAMzSNGvR7wgtrBAtETD/P1sIDaLgKrEv5eXwGp4BSwl FtzrYYVYIC+x/+BZZhCbU8BKYvWqD2CLhYBqLrTPg6oXlDg58wkLxHx5ieats5knMArMQpKa hSS1gJFpFaNIamlxbnpusaFecWJucWleul5yfu4mRmAMbzv2c/MOxnmvPuodYmTiYDzEKMHB rCTC+8PFNEWINyWxsiq1KD++qDQntfgQoynQ3ROZpUST84FJJK8k3tDMwNTQxMzSwNTSzFhJ nNezoCNRSCA9sSQ1OzW1ILUIpo+Jg1OqgcnOzFGrsHqbxTrXK9M7GqY9YZ1e7Pw+9oPj9v+m 3k2np69VOlqkfkN+zuJlk+vVygSKFX3XRKb7tjW/0J9mcujVt6Z11ytqsh5dy552rFpL/2O9 aaM7r8fxF9aiCUuSdysXKi8r0qprUXZ8W790L7/Zk4tp4hyntFIXqpx9uHPe9V9/X1XyVK1Z WGEUaj2rZLXYjkPH7vO8DWhYmTO1xTn1hNPfHfLXL78L2pG4dKH1kh83L4Z0fg7Nrrit2ua6 5UXzI1aDvxfYs8MtLYMV3ly/dFj+6VR/V8ZEvlt/WTqqFPh/dal6R7jXrd+WX5Aes/OhXeyH v5tWz3lpY5B0U+Dr4snzM/pqzh2Z2hI5s1aJpTgj0VCLuag4EQBqd7ZaagMAAA== X-CMS-MailID: 20230411122923eucas1p1dfc182a2c785eeb362b9d670dfe3ba2f X-Msg-Generator: CA X-RootMTR: 20230411122923eucas1p1dfc182a2c785eeb362b9d670dfe3ba2f X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230411122923eucas1p1dfc182a2c785eeb362b9d670dfe3ba2f References: <20230411122920.30134-1-p.raghav@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Split the submit_bio() and bio 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 Reviewed-by: Christoph Hellwig --- fs/mpage.c | 54 ++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 18 deletions(-) diff --git a/fs/mpage.c b/fs/mpage.c index 22b9de5ddd68..d9540c1b7427 100644 --- a/fs/mpage.c +++ b/fs/mpage.c @@ -43,23 +43,41 @@ * 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), + 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_put(bio); } -static struct bio *mpage_bio_submit(struct bio *bio) +static void mpage_write_end_io(struct bio *bio) { - bio->bi_end_io = mpage_end_io; + struct bio_vec *bv; + struct bvec_iter_all iter_all; + + 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_put(bio); +} + +static struct bio *mpage_bio_submit_read(struct bio *bio) +{ + bio->bi_end_io = mpage_read_end_io; + guard_bio_eod(bio); + submit_bio(bio); + return NULL; +} + +static struct bio *mpage_bio_submit_write(struct bio *bio) +{ + bio->bi_end_io = mpage_write_end_io; guard_bio_eod(bio); submit_bio(bio); return NULL; @@ -265,7 +283,7 @@ static struct bio *do_mpage_readpage(struct mpage_readpage_args *args) * This folio will go to BIO. Do we need to send this BIO off first? */ if (args->bio && (args->last_block_in_bio != blocks[0] - 1)) - args->bio = mpage_bio_submit(args->bio); + args->bio = mpage_bio_submit_read(args->bio); alloc_new: if (args->bio == NULL) { @@ -278,7 +296,7 @@ static struct bio *do_mpage_readpage(struct mpage_readpage_args *args) length = first_hole << blkbits; if (!bio_add_folio(args->bio, folio, length, 0)) { - args->bio = mpage_bio_submit(args->bio); + args->bio = mpage_bio_submit_read(args->bio); goto alloc_new; } @@ -286,7 +304,7 @@ static struct bio *do_mpage_readpage(struct mpage_readpage_args *args) nblocks = map_bh->b_size >> blkbits; if ((buffer_boundary(map_bh) && relative_block == nblocks) || (first_hole != blocks_per_page)) - args->bio = mpage_bio_submit(args->bio); + args->bio = mpage_bio_submit_read(args->bio); else args->last_block_in_bio = blocks[blocks_per_page - 1]; out: @@ -294,7 +312,7 @@ static struct bio *do_mpage_readpage(struct mpage_readpage_args *args) confused: if (args->bio) - args->bio = mpage_bio_submit(args->bio); + args->bio = mpage_bio_submit_read(args->bio); if (!folio_test_uptodate(folio)) block_read_full_folio(folio, args->get_block); else @@ -356,7 +374,7 @@ void mpage_readahead(struct readahead_control *rac, get_block_t get_block) args.bio = do_mpage_readpage(&args); } if (args.bio) - mpage_bio_submit(args.bio); + mpage_bio_submit_read(args.bio); } EXPORT_SYMBOL(mpage_readahead); @@ -373,7 +391,7 @@ int mpage_read_folio(struct folio *folio, get_block_t get_block) args.bio = do_mpage_readpage(&args); if (args.bio) - mpage_bio_submit(args.bio); + mpage_bio_submit_read(args.bio); return 0; } EXPORT_SYMBOL(mpage_read_folio); @@ -577,7 +595,7 @@ static int __mpage_writepage(struct folio *folio, struct writeback_control *wbc, * This page will go to BIO. Do we need to send this BIO off first? */ if (bio && mpd->last_block_in_bio != blocks[0] - 1) - bio = mpage_bio_submit(bio); + bio = mpage_bio_submit_write(bio); alloc_new: if (bio == NULL) { @@ -596,7 +614,7 @@ static int __mpage_writepage(struct folio *folio, struct writeback_control *wbc, wbc_account_cgroup_owner(wbc, &folio->page, folio_size(folio)); length = first_unmapped << blkbits; if (!bio_add_folio(bio, folio, length, 0)) { - bio = mpage_bio_submit(bio); + bio = mpage_bio_submit_write(bio); goto alloc_new; } @@ -606,7 +624,7 @@ static int __mpage_writepage(struct folio *folio, struct writeback_control *wbc, folio_start_writeback(folio); folio_unlock(folio); if (boundary || (first_unmapped != blocks_per_page)) { - bio = mpage_bio_submit(bio); + bio = mpage_bio_submit_write(bio); if (boundary_block) { write_boundary_block(boundary_bdev, boundary_block, 1 << blkbits); @@ -618,7 +636,7 @@ static int __mpage_writepage(struct folio *folio, struct writeback_control *wbc, confused: if (bio) - bio = mpage_bio_submit(bio); + bio = mpage_bio_submit_write(bio); /* * The caller has a ref on the inode, so *mapping is stable @@ -652,7 +670,7 @@ mpage_writepages(struct address_space *mapping, blk_start_plug(&plug); ret = write_cache_pages(mapping, wbc, __mpage_writepage, &mpd); if (mpd.bio) - mpage_bio_submit(mpd.bio); + mpage_bio_submit_write(mpd.bio); blk_finish_plug(&plug); return ret; } 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: 13207511 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0047CC77B70 for ; Tue, 11 Apr 2023 12:29:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230014AbjDKM3g (ORCPT ); Tue, 11 Apr 2023 08:29:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229703AbjDKM3d (ORCPT ); Tue, 11 Apr 2023 08:29:33 -0400 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 032671BE8 for ; Tue, 11 Apr 2023 05:29:32 -0700 (PDT) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20230411122926euoutp01a6db6c08e96b638b5a90a95e0293c06b~U4TImgna80722007220euoutp01Y for ; Tue, 11 Apr 2023 12:29:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20230411122926euoutp01a6db6c08e96b638b5a90a95e0293c06b~U4TImgna80722007220euoutp01Y 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 0yR2jxMzfrN4NEy9xeax+2YDm8ev23dYPfq2rGL0+LxJzmPTk7dMATxRXDYpqTmZZalF+nYJ XBmfVs5iKTjAU7FhzgbGBsb5XF2Mn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X-RootMTR: 20230411122924eucas1p16c6abcf91a3e04c6a0a225606ca0044d X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230411122924eucas1p16c6abcf91a3e04c6a0a225606ca0044d References: <20230411122920.30134-1-p.raghav@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org 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); }