From patchwork Sun Sep 25 18:53:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Raghav X-Patchwork-Id: 12988098 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 3C11CC6FA82 for ; Sun, 25 Sep 2022 18:53:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231396AbiIYSx5 (ORCPT ); Sun, 25 Sep 2022 14:53:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231169AbiIYSxz (ORCPT ); Sun, 25 Sep 2022 14:53:55 -0400 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C30C812AF6 for ; Sun, 25 Sep 2022 11:53:53 -0700 (PDT) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20220925185352euoutp02affca627b04d407dd359324d0f26f222~YL0RJ1mta2348323483euoutp02F for ; Sun, 25 Sep 2022 18:53:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20220925185352euoutp02affca627b04d407dd359324d0f26f222~YL0RJ1mta2348323483euoutp02F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1664132032; bh=9Vp3pv5yyz+4l10DcE3fo6lgTfafWIbWfxxlr2bc/YU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oi91aago0HE7tuUyM/FDNvr6R/hx2HgUzAoG2L40kFJbkB8fKhZG1660sM/sFHTkn xWZFY5Fr13DuFBoUknwocboem1Bc9EQ7JB+3pyoXQcPgcmps+78BmjleL17aMu+9pI Cdn32PmJluewjlM2WR4SO/I3r+ZlRUNxLsMmCiz4= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20220925185350eucas1p21ec04b807565b3b1f126e1ea9339d261~YL0PfYNpm2813128131eucas1p2h; Sun, 25 Sep 2022 18:53:50 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 27.D8.19378.EB3A0336; Sun, 25 Sep 2022 19:53:50 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20220925185350eucas1p1fc354429027a88de7e548a3a4529b4ef~YL0O5KWKW1290012900eucas1p1_; Sun, 25 Sep 2022 18:53:50 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20220925185350eusmtrp12884db8ebdefc0af464b1814ceb081f1~YL0O4mOy50942709427eusmtrp1K; Sun, 25 Sep 2022 18:53:50 +0000 (GMT) X-AuditID: cbfec7f5-a4dff70000014bb2-3a-6330a3beca14 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id BF.00.07473.EB3A0336; Sun, 25 Sep 2022 19:53:50 +0100 (BST) Received: from localhost (unknown [106.210.248.168]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20220925185349eusmtip1b72890b26b59c83bc5a654832ea28c16~YL0OmbSHH0145001450eusmtip10; Sun, 25 Sep 2022 18:53:49 +0000 (GMT) From: Pankaj Raghav To: linux-block@vger.kernel.org, axboe@kernel.dk Cc: damien.lemoal@opensource.wdc.com, gost.dev@samsung.com, Pankaj Raghav Subject: [PATCH 1/2] block: modify blk_mq_plug() to allow only reads for zoned block devices Date: Sun, 25 Sep 2022 20:53:46 +0200 Message-Id: <20220925185348.120964-2-p.raghav@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220925185348.120964-1-p.raghav@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrLIsWRmVeSWpSXmKPExsWy7djP87r7FhskGzxaZ2Cx+m4/m8Xvs+eZ LW4e2MlksfeWtsXnpS3sDqwel8+Weuxsvc/q0bdlFaPH501yASxRXDYpqTmZZalF+nYJXBnL fsxmLmjnrlixbilrA+MXji5GTg4JAROJFU1NzF2MXBxCAisYJfbcamSFcL4wSnw7dYERwvnM KNF74BwrTMvPb5vZIRLLGSWe/VjDAuG8ZJS4f/0PWxcjBwebgJZEYyc7SIOIgIHEqnUdbCA2 s0CSxJe/K5lBbGGBOImJ+1aC1bAIqEp8vLIErIZXwEpiVeNfJohl8hIzL31nBxnJKWAt0X7d BqJEUOLkzCcsECPlJZq3zmaGKF/IITHjNj+E7SLx7vIJdghbWOLV8S1QtozE6ck9LBB2tcTT G7/B3pcQaGGU6N+5Hux8CaBdfWdyQExmAU2J9bv0IcodJc78W8AMUcEnceOtIMQFfBKTtk2H CvNKdLQJQVQrSez8+QRqqYTE5aY5UEs9JL4u+8s8gVFxFpJfZiH5ZRbC3gWMzKsYxVNLi3PT U4uN81LL9YoTc4tL89L1kvNzNzECU8jpf8e/7mBc8eqj3iFGJg7GQ4wSHMxKIrwpF3WThXhT EiurUovy44tKc1KLDzFKc7AoifOyzdBKFhJITyxJzU5NLUgtgskycXBKNTB1LBW+yrhmccE2 5sJrO9VaPNTqYjfvzvhtF2Ju75L1IWe+VdqSg08kewQkTievNGYTzTlu08HX/vEm06d1Sj+z HcrtHt7PeDUxO3+jrn1q8vIDHw0nrcvevb1Z2mvidLH1+7isc90TDzVr1h34wGy0lFvx+cdy Jp/8865/bwceKZMJbqv5MqFmnZxq8sLWzilTPRtDr2l+1t0Wa3HivVJT+zPZGJX1Nk+zg4oc WI99fC+au71cRrx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cevt2j3qvzF+vaT d+w7PYen8L3y42d9nNYnTVQ33Q1jS1FiKc5INNRiLipOBAD8Am/nAAMAAA== X-CMS-MailID: 20220925185350eucas1p1fc354429027a88de7e548a3a4529b4ef X-Msg-Generator: CA X-RootMTR: 20220925185350eucas1p1fc354429027a88de7e548a3a4529b4ef X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20220925185350eucas1p1fc354429027a88de7e548a3a4529b4ef References: <20220925185348.120964-1-p.raghav@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Modify blk_mq_plug() to allow plugging only for read operations in zoned block devices as there are alternative IO paths in the linux block layer which can end up doing a write via driver private requests in sequential write zones. Signed-off-by: Pankaj Raghav Reviewed-by: Damien Le Moal Signed-off-by: Pankaj Raghav --- block/blk-mq.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/block/blk-mq.h b/block/blk-mq.h index 8ca453ac243d..005343df64ca 100644 --- a/block/blk-mq.h +++ b/block/blk-mq.h @@ -305,14 +305,15 @@ static inline void blk_mq_clear_mq_map(struct blk_mq_queue_map *qmap) * change can cause write BIO failures with zoned block devices as these * require sequential write patterns to zones. Prevent this from happening by * ignoring the plug state of a BIO issuing context if it is for a zoned block - * device and the BIO to plug is a write operation. + * device and the BIO to plug is not a read operation. + * * * Return current->plug if the bio can be plugged and NULL otherwise */ static inline struct blk_plug *blk_mq_plug( struct bio *bio) { - /* Zoned block device write operation case: do not plug the BIO */ - if (bdev_is_zoned(bio->bi_bdev) && op_is_write(bio_op(bio))) + /* Allow plugging only for read operations in zoned block devices */ + if (bdev_is_zoned(bio->bi_bdev) && bio_op(bio) != REQ_OP_READ) return NULL; /* From patchwork Sun Sep 25 18:53:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Raghav X-Patchwork-Id: 12988099 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 EA6DDC54EE9 for ; Sun, 25 Sep 2022 18:53:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231169AbiIYSx5 (ORCPT ); Sun, 25 Sep 2022 14:53:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230435AbiIYSx5 (ORCPT ); Sun, 25 Sep 2022 14:53:57 -0400 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 292E82E9F0 for ; Sun, 25 Sep 2022 11:53:56 -0700 (PDT) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20220925185353euoutp01db061cc0891b297468115088620c0aef~YL0Rm_79e0714507145euoutp01E for ; Sun, 25 Sep 2022 18:53:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20220925185353euoutp01db061cc0891b297468115088620c0aef~YL0Rm_79e0714507145euoutp01E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1664132033; bh=Ue10Z1qFDMnoAD/RWgDr2Sr/jCLAYc+JS8fwi1z9b6Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F4y5fGBPZTdgZekSutV6k8j6Uon4oIyNz+HXaRIEe9QLvW7yK2YG79bkaJB8SIofJ 7/hLt9Phb/o/gd6TkhO9mGsLvDaq/EGE5mnorikT0tSJpZpdjuD564M3bh9AH1dvO0 uGMRcz3+g9N4yrl8S1yckkMTHmUER4pZUr6OwklI= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20220925185352eucas1p231eb5e413d4aec0f0c0469e92cc7aa8f~YL0Q0vXOD3009130091eucas1p2R; Sun, 25 Sep 2022 18:53:52 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id B2.50.07817.0C3A0336; Sun, 25 Sep 2022 19:53:52 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20220925185351eucas1p1e0c37396c09611509c0b18bdcdeddfe1~YL0P4Kr721286912869eucas1p1l; Sun, 25 Sep 2022 18:53:51 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20220925185351eusmtrp24822ab53a906ce7561abe83bf2c6b254~YL0P3ojRp1617516175eusmtrp2R; Sun, 25 Sep 2022 18:53:51 +0000 (GMT) X-AuditID: cbfec7f4-8abff70000011e89-02-6330a3c0ff6d Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id B4.37.10862.FB3A0336; Sun, 25 Sep 2022 19:53:51 +0100 (BST) Received: from localhost (unknown [106.210.248.168]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20220925185350eusmtip2d1db84efc16027aff16bbd09ed6d3607~YL0Pj0Ygv2337223372eusmtip2K; Sun, 25 Sep 2022 18:53:50 +0000 (GMT) From: Pankaj Raghav To: linux-block@vger.kernel.org, axboe@kernel.dk Cc: damien.lemoal@opensource.wdc.com, gost.dev@samsung.com, Pankaj Raghav Subject: [PATCH 2/2] block: use blk_mq_plug() in blk_execute_rq_nowait() Date: Sun, 25 Sep 2022 20:53:47 +0200 Message-Id: <20220925185348.120964-3-p.raghav@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220925185348.120964-1-p.raghav@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAA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AG+Yym6QAwAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrLLMWRmVeSWpSXmKPExsVy+t/xe7r7FxskG+yby2Ox+m4/m8Xvs+eZ LW4e2MlksfeWtsXnpS3sDqwel8+Weuxsvc/q0bdlFaPH501yASxRejZF+aUlqQoZ+cUltkrR hhZGeoaWFnpGJpZ6hsbmsVZGpkr6djYpqTmZZalF+nYJehmXLu9kK1jIUTFt2n+mBsb/bF2M nBwSAiYSn/6fY+pi5OIQEljKKPF5dQMTREJC4vbCJkYIW1jiz7UuNoii54wS7zo2sHQxcnCw CWhJNHayg9SICBhJ/F57jRXEZhZIkVj75jDYHGEBD4m/Kz4zg9gsAqoSM/8/ZAGxeQWsJM5P e8wKMV9eYual7+wgIzkFrCXar9uAhIWASrZduM4IUS4ocXLmExaI8fISzVtnM09gFJiFJDUL SWoBI9MqRpHU0uLc9NxiI73ixNzi0rx0veT83E2MwHDfduznlh2MK1991DvEyMTBeIhRgoNZ SYQ35aJushBvSmJlVWpRfnxRaU5q8SFGU6CzJzJLiSbnAyMuryTe0MzA1NDEzNLA1NLMWEmc 17OgI1FIID2xJDU7NbUgtQimj4mDU6qBSVJ19caS73eEBL0/rr4f+/nEdck9ie7HeCut34e6 urxomhvcevbGufgQub33yn4HSqd5K8i17Sh68tbTfckk25Lft27l50zYs9mFj3vHzsQXto4S oS7MN57vvqmXNkO25vcBhssvCg6HGa4NcX7qdDMupnHNRidBpw1rvPS27OKwqHeftl07X1Yn +df53ZdmS3H8YdDwPDDrqcabtObmozEL8tNOPmy5kJHBy3x47dRvb1c/EZF88Wzm7FyPiO0K r692PRXUMzpW7CBTUv9V1uEwx16z7TEvt73+p3crecmZcxP2ppkd+dG0MWa9Zu2ByodcK+4V B7G8M9su8lF6RvXthJVb1PL2uzEcZfqy7JkSS3FGoqEWc1FxIgBsvL5bAAMAAA== X-CMS-MailID: 20220925185351eucas1p1e0c37396c09611509c0b18bdcdeddfe1 X-Msg-Generator: CA X-RootMTR: 20220925185351eucas1p1e0c37396c09611509c0b18bdcdeddfe1 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20220925185351eucas1p1e0c37396c09611509c0b18bdcdeddfe1 References: <20220925185348.120964-1-p.raghav@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org blk_execute_rq_nowait() function mainly was used by low-level drivers such as NVMe to submit one-off passthrough requests. However, recently introduced uring-cmd based io-passthrough also uses the same function to submit io requests. As the plugging support is coming to io-passthrough[1], use the blk_mq_plug() helper to ensure plugging is not used in all scenarios. [1] https://lore.kernel.org/linux-block/20220922182805.96173-1-axboe@kernel.dk/ Signed-off-by: Pankaj Raghav Reviewed-by: Damien Le Moal --- block/blk-mq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index c11949d66163..840541c1ab40 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -1213,7 +1213,7 @@ void blk_execute_rq_nowait(struct request *rq, bool at_head) WARN_ON(!blk_rq_is_passthrough(rq)); blk_account_io_start(rq); - if (current->plug) + if (blk_mq_plug(rq->bio)) blk_add_rq_to_plug(current->plug, rq); else blk_mq_sched_insert_request(rq, at_head, true, false);