From patchwork Tue Feb 15 10:05:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12746845 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 50CEFC433EF for ; Tue, 15 Feb 2022 10:05:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236310AbiBOKF5 (ORCPT ); Tue, 15 Feb 2022 05:05:57 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236180AbiBOKF5 (ORCPT ); Tue, 15 Feb 2022 05:05:57 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6220724F for ; Tue, 15 Feb 2022 02:05:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=qYt3ZRzuNpc/iVF9KpXQfh6CaJwRkNUI9Fcucnd17Kw=; b=TOK4G84fmgSdBeKMwZBqanqZi9 U0VS/vYayRKqpHG+yUOx5NkfjIR4qRGwVzfj1Bm5RNt7vvgJyJxKi665Xh+7RPh01JVdSwlB6plOo pmmyTv+TgVrXbN28Fh08Q6cnHbd2occRUp9ojQMCwIYx3bkk+GjfL3rmrP6DLmgAATiQVixeT+bb+ V0UpkQEoSWpm86S9jn2spT84+VgplHJFud0BZpsJnKUf8gzmovx1wG9gfippJioPz2Pzjg3CqCHkR x+YsgBarnkCegAX3S8zAXN1Y9qgVSpRr5JiXhsJm4L5pGElmLjh7/BTKNHKepHJJSpV+JkSy4NlJx 59tOnNOw==; Received: from [2001:4bb8:184:543c:6bdf:22f4:7f0a:fe97] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nJuiP-002E1A-AE; Tue, 15 Feb 2022 10:05:45 +0000 From: Christoph Hellwig To: Jens Axboe , Mike Snitzer Cc: dm-devel@redhat.com, linux-block@vger.kernel.org Subject: [PATCH 1/5] blk-mq: make the blk-mq stacking code optional Date: Tue, 15 Feb 2022 11:05:36 +0100 Message-Id: <20220215100540.3892965-2-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220215100540.3892965-1-hch@lst.de> References: <20220215100540.3892965-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org The code to stack blk-mq drivers is only used by dm-multipath, and will preferably stay that way. Make it optional and only selected by device mapper, so that the buildbots more easily catch abuses like the one that slipped in in the ufs driver in the last merged window. Another positive side effects is that kernel builds without device mapper shrink a little bit as well. Signed-off-by: Christoph Hellwig --- block/Kconfig | 3 +++ block/blk-mq.c | 2 ++ drivers/md/Kconfig | 1 + 3 files changed, 6 insertions(+) diff --git a/block/Kconfig b/block/Kconfig index 205f8d01c6952..168b873eb666d 100644 --- a/block/Kconfig +++ b/block/Kconfig @@ -230,6 +230,9 @@ config BLK_PM config BLOCK_HOLDER_DEPRECATED bool +config BLK_MQ_STACKING + bool + source "block/Kconfig.iosched" endif # BLOCK diff --git a/block/blk-mq.c b/block/blk-mq.c index 6c59ffe765fde..db62d34afb637 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -2840,6 +2840,7 @@ void blk_mq_submit_bio(struct bio *bio) blk_mq_try_issue_directly(rq->mq_hctx, rq)); } +#ifdef CONFIG_BLK_MQ_STACKING /** * blk_cloned_rq_check_limits - Helper function to check a cloned request * for the new queue limits @@ -3017,6 +3018,7 @@ int blk_rq_prep_clone(struct request *rq, struct request *rq_src, return -ENOMEM; } EXPORT_SYMBOL_GPL(blk_rq_prep_clone); +#endif /* CONFIG_BLK_MQ_STACKING */ /* * Steal bios from a request and add them to a bio list. diff --git a/drivers/md/Kconfig b/drivers/md/Kconfig index b5ea378e66cb1..998a5cfdbc4e9 100644 --- a/drivers/md/Kconfig +++ b/drivers/md/Kconfig @@ -204,6 +204,7 @@ config BLK_DEV_DM tristate "Device mapper support" select BLOCK_HOLDER_DEPRECATED if SYSFS select BLK_DEV_DM_BUILTIN + select BLK_MQ_STACKING depends on DAX || DAX=n help Device-mapper is a low level volume manager. It works by allowing From patchwork Tue Feb 15 10:05:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12746846 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 0E1E4C433EF for ; Tue, 15 Feb 2022 10:05:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232405AbiBOKF7 (ORCPT ); Tue, 15 Feb 2022 05:05:59 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231127AbiBOKF7 (ORCPT ); Tue, 15 Feb 2022 05:05:59 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9F9A24F for ; Tue, 15 Feb 2022 02:05:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=ReAiumxdBv1XVEkgCdJh8kXAnU3jtNvTIPeXyDr/xfo=; b=ooslR8dyDAPpWIaYY4MDesMLQo OjZRr/+Mv8znXJGwG421jfdyg7KU4nhrj8e2nCZxtLhHkgVncs57X0Qp/7FT3t+YeEpvXk5xR6cz+ aMIPNULQVbLXYn7Pme+qP71LG3Ksh4+jodjzqRDES7ViRyiY1poV5sQREqISL2Ysyciop2HL6Nos+ n5xjMHHZhYVrqTKqusF5bWeIwfep7afDaNIViVGTBnq47yijs0TcTug5Gs3M2hRccZ8PqUZLukhHx TU1Vb8U+2oufjrmecKN7A22uC3hq05uMALzoNBGSSgQiGVoVs+qs03aoeK1iFzA/Jej6n0+N7+rHk +So7DGTA==; Received: from [2001:4bb8:184:543c:6bdf:22f4:7f0a:fe97] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nJuiS-002E29-2V; Tue, 15 Feb 2022 10:05:48 +0000 From: Christoph Hellwig To: Jens Axboe , Mike Snitzer Cc: dm-devel@redhat.com, linux-block@vger.kernel.org Subject: [PATCH 2/5] blk-mq: fold blk_cloned_rq_check_limits into blk_insert_cloned_request Date: Tue, 15 Feb 2022 11:05:37 +0100 Message-Id: <20220215100540.3892965-3-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220215100540.3892965-1-hch@lst.de> References: <20220215100540.3892965-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Fold blk_cloned_rq_check_limits into its only caller. Signed-off-by: Christoph Hellwig --- block/blk-mq.c | 38 +++++--------------------------------- 1 file changed, 5 insertions(+), 33 deletions(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index db62d34afb637..fc132933397fb 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -2842,26 +2842,14 @@ void blk_mq_submit_bio(struct bio *bio) #ifdef CONFIG_BLK_MQ_STACKING /** - * blk_cloned_rq_check_limits - Helper function to check a cloned request - * for the new queue limits - * @q: the queue - * @rq: the request being checked - * - * Description: - * @rq may have been made based on weaker limitations of upper-level queues - * in request stacking drivers, and it may violate the limitation of @q. - * Since the block layer and the underlying device driver trust @rq - * after it is inserted to @q, it should be checked against @q before - * the insertion using this generic function. - * - * Request stacking drivers like request-based dm may change the queue - * limits when retrying requests on other queues. Those requests need - * to be checked against the new queue limits again during dispatch. + * blk_insert_cloned_request - Helper for stacking drivers to submit a request + * @q: the queue to submit the request + * @rq: the request being queued */ -static blk_status_t blk_cloned_rq_check_limits(struct request_queue *q, - struct request *rq) +blk_status_t blk_insert_cloned_request(struct request_queue *q, struct request *rq) { unsigned int max_sectors = blk_queue_get_max_sectors(q, req_op(rq)); + blk_status_t ret; if (blk_rq_sectors(rq) > max_sectors) { /* @@ -2893,22 +2881,6 @@ static blk_status_t blk_cloned_rq_check_limits(struct request_queue *q, return BLK_STS_IOERR; } - return BLK_STS_OK; -} - -/** - * blk_insert_cloned_request - Helper for stacking drivers to submit a request - * @q: the queue to submit the request - * @rq: the request being queued - */ -blk_status_t blk_insert_cloned_request(struct request_queue *q, struct request *rq) -{ - blk_status_t ret; - - ret = blk_cloned_rq_check_limits(q, rq); - if (ret != BLK_STS_OK) - return ret; - if (rq->q->disk && should_fail_request(rq->q->disk->part0, blk_rq_bytes(rq))) return BLK_STS_IOERR; From patchwork Tue Feb 15 10:05:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12746847 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 88E53C433FE for ; Tue, 15 Feb 2022 10:05:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235153AbiBOKGC (ORCPT ); Tue, 15 Feb 2022 05:06:02 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230108AbiBOKGB (ORCPT ); Tue, 15 Feb 2022 05:06:01 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C83924F for ; Tue, 15 Feb 2022 02:05:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=jiV+g/hzm3FCHU1Mry05zuZvudJcJN93Ahz09Tk15VU=; b=rEC8uWtMD7JxVhb2EwUPC6u2Uf b6h6x1ctO/VZFIHfILOvq3dQYKIVSgd1mqiwU3T5+7yq0cx6iVcowneTuqwNWRJL7YsKQapOJoWA2 qaXZa6dDuTpIfpj9wIyMRot+HQP2cNC9TTnc//1mgCEeNUeS6QKJp4u3uMWKM2PH9XuaTBzG9++/b 18UxX/A0PqONu1gMV6QgZIlaxUni/HI8BbosLYs9cxbFrOySx7Z9/R9zecwG0hO7+mXthNEXkw99K Pgf4d/OY5XeFIj6nYLW+rPDQXtqmKRcQ0nHz02NlPZDbtw368PuvDmx3eLiEsuK1ZoulMAGn7He79 uU8mluow==; Received: from [2001:4bb8:184:543c:6bdf:22f4:7f0a:fe97] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nJuiU-002E3T-OO; Tue, 15 Feb 2022 10:05:51 +0000 From: Christoph Hellwig To: Jens Axboe , Mike Snitzer Cc: dm-devel@redhat.com, linux-block@vger.kernel.org Subject: [PATCH 3/5] blk-mq: remove the request_queue argument to blk_insert_cloned_request Date: Tue, 15 Feb 2022 11:05:38 +0100 Message-Id: <20220215100540.3892965-4-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220215100540.3892965-1-hch@lst.de> References: <20220215100540.3892965-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org The request must be submitted to the queue it was allocated for, so remove the extra request_queue argument. Signed-off-by: Christoph Hellwig --- block/blk-mq.c | 9 ++++----- drivers/md/dm-rq.c | 2 +- include/linux/blk-mq.h | 3 +-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index fc132933397fb..886836a54064c 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -2843,11 +2843,11 @@ void blk_mq_submit_bio(struct bio *bio) #ifdef CONFIG_BLK_MQ_STACKING /** * blk_insert_cloned_request - Helper for stacking drivers to submit a request - * @q: the queue to submit the request * @rq: the request being queued */ -blk_status_t blk_insert_cloned_request(struct request_queue *q, struct request *rq) +blk_status_t blk_insert_cloned_request(struct request *rq) { + struct request_queue *q = rq->q; unsigned int max_sectors = blk_queue_get_max_sectors(q, req_op(rq)); blk_status_t ret; @@ -2881,8 +2881,7 @@ blk_status_t blk_insert_cloned_request(struct request_queue *q, struct request * return BLK_STS_IOERR; } - if (rq->q->disk && - should_fail_request(rq->q->disk->part0, blk_rq_bytes(rq))) + if (q->disk && should_fail_request(q->disk->part0, blk_rq_bytes(rq))) return BLK_STS_IOERR; if (blk_crypto_insert_cloned_request(rq)) @@ -2895,7 +2894,7 @@ blk_status_t blk_insert_cloned_request(struct request_queue *q, struct request * * bypass a potential scheduler on the bottom device for * insert. */ - blk_mq_run_dispatch_ops(rq->q, + blk_mq_run_dispatch_ops(q, ret = blk_mq_request_issue_directly(rq, true)); if (ret) blk_account_io_done(rq, ktime_get_ns()); diff --git a/drivers/md/dm-rq.c b/drivers/md/dm-rq.c index 579ab6183d4d8..2fcc9b7f391b3 100644 --- a/drivers/md/dm-rq.c +++ b/drivers/md/dm-rq.c @@ -311,7 +311,7 @@ static blk_status_t dm_dispatch_clone_request(struct request *clone, struct requ clone->rq_flags |= RQF_IO_STAT; clone->start_time_ns = ktime_get_ns(); - r = blk_insert_cloned_request(clone->q, clone); + r = blk_insert_cloned_request(clone); if (r != BLK_STS_OK && r != BLK_STS_RESOURCE && r != BLK_STS_DEV_RESOURCE) /* must complete clone in terms of original request */ dm_complete_request(rq, r); diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h index d319ffa59354a..3a41d50b85d3a 100644 --- a/include/linux/blk-mq.h +++ b/include/linux/blk-mq.h @@ -952,8 +952,7 @@ int blk_rq_prep_clone(struct request *rq, struct request *rq_src, struct bio_set *bs, gfp_t gfp_mask, int (*bio_ctr)(struct bio *, struct bio *, void *), void *data); void blk_rq_unprep_clone(struct request *rq); -blk_status_t blk_insert_cloned_request(struct request_queue *q, - struct request *rq); +blk_status_t blk_insert_cloned_request(struct request *rq); struct rq_map_data { struct page **pages; From patchwork Tue Feb 15 10:05:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12746848 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 AA855C433F5 for ; Tue, 15 Feb 2022 10:05:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233595AbiBOKGF (ORCPT ); Tue, 15 Feb 2022 05:06:05 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230108AbiBOKGF (ORCPT ); Tue, 15 Feb 2022 05:06:05 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0AB624F for ; Tue, 15 Feb 2022 02:05:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=7rzMBCheXI6s6ZmGT/40NcplVoa+oeu+cZp5B+iU6Vk=; b=ZsSEGkOPwOp5GZ11N423WzJwb2 h0IzNRuZKhh5tt+uFqD+F2bI9y6qF77J5qcGK77ZS9huB8swE2MoV3LbdLSagzMq6z5lju1i1fxz9 MMHTp0j2BdsWimqdySOX3bIBbGv03XyUxlufrveawQDkhZvxqrHSIYE4T56HCgTh1FiLe9gOtjxzc QzsDVJDwmYvhFm86mXLgbv8zla10m9LAKrKIhtc1oUW1q/5Lm8w95unhfU9Ty4PouuoF1bPVL3359 0Chp3Xz9JkFZeDzsdE5ofuQseHN9YssoDDhKSLaXf5c7Sw1nbsG6+G2sTndBbwJUjANxH3sDsi/NU H/RM4vRQ==; Received: from [2001:4bb8:184:543c:6bdf:22f4:7f0a:fe97] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nJuiX-002E4g-Gk; Tue, 15 Feb 2022 10:05:53 +0000 From: Christoph Hellwig To: Jens Axboe , Mike Snitzer Cc: dm-devel@redhat.com, linux-block@vger.kernel.org Subject: [PATCH 4/5] dm: remove useless code from dm_dispatch_clone_request Date: Tue, 15 Feb 2022 11:05:39 +0100 Message-Id: <20220215100540.3892965-5-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220215100540.3892965-1-hch@lst.de> References: <20220215100540.3892965-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Both ->start_time_ns and the RQF_IO_STAT are set when the request is allocated using blk_mq_alloc_request by dm-mpath in blk_mq_rq_ctx_init. The block layer also ensures ->start_time_ns is only set when actually needed. Signed-off-by: Christoph Hellwig --- drivers/md/dm-rq.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/md/dm-rq.c b/drivers/md/dm-rq.c index 2fcc9b7f391b3..8f6117342d322 100644 --- a/drivers/md/dm-rq.c +++ b/drivers/md/dm-rq.c @@ -307,10 +307,6 @@ static blk_status_t dm_dispatch_clone_request(struct request *clone, struct requ { blk_status_t r; - if (blk_queue_io_stat(clone->q)) - clone->rq_flags |= RQF_IO_STAT; - - clone->start_time_ns = ktime_get_ns(); r = blk_insert_cloned_request(clone); if (r != BLK_STS_OK && r != BLK_STS_RESOURCE && r != BLK_STS_DEV_RESOURCE) /* must complete clone in terms of original request */ From patchwork Tue Feb 15 10:05:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12746849 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 610C3C433EF for ; Tue, 15 Feb 2022 10:06:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236180AbiBOKGN (ORCPT ); Tue, 15 Feb 2022 05:06:13 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230108AbiBOKGM (ORCPT ); Tue, 15 Feb 2022 05:06:12 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A762524F for ; Tue, 15 Feb 2022 02:06:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=mEpu3vLLpJD6+zaWJH61Lv4c0zETFy7I0xIIePhVsvQ=; b=BHGTNtDeaOoBo8NYTj1iBNOdp+ Fn8V0hfyOae5XZH3axH1f85+af3IOnUA170vntD5j3VadxXKbTM8Y5J4SdLba0/YimYh7ITn+q1er qpONzYw41R0HYECxF/O8qCiBtyhWQ/5QDAvLEigEAAOjGO0pHzzzTIFVK5Stp+KWbbdJTlHofLwOT IyNhCtHDI6xhrg8RQnembUuyN76kD/wD8B8NConXszH/vzswdvc5D+7AfSmXc6En5FAXq/wl2U0MS Cdbr2D+j2fIokW5VC7zr7nPc0gukffLWoa5bVcLLeaHhJGyMl+SR5qZd9FoGw5AksH4h+iMymo0Oo tqxReBFA==; Received: from [2001:4bb8:184:543c:6bdf:22f4:7f0a:fe97] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nJuia-002E73-9Y; Tue, 15 Feb 2022 10:05:56 +0000 From: Christoph Hellwig To: Jens Axboe , Mike Snitzer Cc: dm-devel@redhat.com, linux-block@vger.kernel.org Subject: [PATCH 5/5] dm: remove dm_dispatch_clone_request Date: Tue, 15 Feb 2022 11:05:40 +0100 Message-Id: <20220215100540.3892965-6-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220215100540.3892965-1-hch@lst.de> References: <20220215100540.3892965-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Fold dm_dispatch_clone_request into it's only caller, and use a switch statement to single dispatch for the handling of the different return values from blk_insert_cloned_request. Signed-off-by: Christoph Hellwig --- drivers/md/dm-rq.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/drivers/md/dm-rq.c b/drivers/md/dm-rq.c index 8f6117342d322..6948d5db90925 100644 --- a/drivers/md/dm-rq.c +++ b/drivers/md/dm-rq.c @@ -303,17 +303,6 @@ static void end_clone_request(struct request *clone, blk_status_t error) dm_complete_request(tio->orig, error); } -static blk_status_t dm_dispatch_clone_request(struct request *clone, struct request *rq) -{ - blk_status_t r; - - r = blk_insert_cloned_request(clone); - if (r != BLK_STS_OK && r != BLK_STS_RESOURCE && r != BLK_STS_DEV_RESOURCE) - /* must complete clone in terms of original request */ - dm_complete_request(rq, r); - return r; -} - static int dm_rq_bio_constructor(struct bio *bio, struct bio *bio_orig, void *data) { @@ -394,13 +383,20 @@ static int map_request(struct dm_rq_target_io *tio) /* The target has remapped the I/O so dispatch it */ trace_block_rq_remap(clone, disk_devt(dm_disk(md)), blk_rq_pos(rq)); - ret = dm_dispatch_clone_request(clone, rq); - if (ret == BLK_STS_RESOURCE || ret == BLK_STS_DEV_RESOURCE) { + ret = blk_insert_cloned_request(clone); + switch (ret) { + case BLK_STS_OK: + break; + case BLK_STS_RESOURCE: + case BLK_STS_DEV_RESOURCE: blk_rq_unprep_clone(clone); blk_mq_cleanup_rq(clone); tio->ti->type->release_clone_rq(clone, &tio->info); tio->clone = NULL; return DM_MAPIO_REQUEUE; + default: + /* must complete clone in terms of original request */ + dm_complete_request(rq, ret); } break; case DM_MAPIO_REQUEUE: