From patchwork Mon Jan 10 07:51:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 12708322 X-Patchwork-Delegate: snitzer@redhat.com 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 us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BDB27C433F5 for ; Mon, 10 Jan 2022 08:00:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641801604; h=from:from:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Je4LE7jhjzmn58LXdVXXBuliq3xca16XWNoejoKKFVM=; b=dP4UfeS/uboe0J84XS8a5Uk5qrkJ9srWqwyLAWUHdfYl2r8oiLpa/7nIAwi+6EsZB0MKcS 9MZQVLa4LptLP3oE64qmBDuoaEMa8S2JtDVB+iqjxnFPxBYslXEUIbtwUnW+YpkRP9w2qr 2M/fopr///zQbWHqOYis0rjY/H9yGxY= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-594-sGSgdBYbMeazVFBXNv9QjQ-1; Mon, 10 Jan 2022 02:57:27 -0500 X-MC-Unique: sGSgdBYbMeazVFBXNv9QjQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B10121006AA9; Mon, 10 Jan 2022 07:57:23 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 91955104B4C6; Mon, 10 Jan 2022 07:57:23 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 68C181809CBA; Mon, 10 Jan 2022 07:57:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20A7qQ9f015286 for ; Mon, 10 Jan 2022 02:52:26 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8B03A5F92D; Mon, 10 Jan 2022 07:52:26 +0000 (UTC) Received: from localhost (ovpn-8-24.pek2.redhat.com [10.72.8.24]) by smtp.corp.redhat.com (Postfix) with ESMTP id CADAB5ED4F; Mon, 10 Jan 2022 07:52:25 +0000 (UTC) From: Ming Lei To: Jens Axboe , Mike Snitzer Date: Mon, 10 Jan 2022 15:51:40 +0800 Message-Id: <20220110075141.389532-2-ming.lei@redhat.com> In-Reply-To: <20220110075141.389532-1-ming.lei@redhat.com> References: <20220110075141.389532-1-ming.lei@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: dm-devel@redhat.com Cc: Ming Lei , linux-block@vger.kernel.org, dm-devel@redhat.com, lining , Tejun Heo , Chunguang Xu Subject: [dm-devel] [PATCH 1/2] block: add resubmit_bio_noacct() X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dm-devel-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Add block layer API of resubmit_bio_noacct() for handling blk-throttle iops limit correctly. Typical use case is that bio split, and it isn't good to export blk_throtl_charge_bio_split() for drivers, so add new API for serving such purpose. Cc: lining Cc: Tejun Heo Cc: Chunguang Xu Signed-off-by: Ming Lei --- block/blk-core.c | 12 ++++++++++++ block/blk-merge.c | 4 +--- include/linux/blkdev.h | 1 + 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/block/blk-core.c b/block/blk-core.c index fd029c86d6ac..733fec7dc5d6 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -910,6 +910,18 @@ void submit_bio_noacct(struct bio *bio) } EXPORT_SYMBOL(submit_bio_noacct); +/* + * Usually for submitting one bio which has been checked by + * submit_bio_checks already. The typical use case is for handling + * blk-throttle iops limit correctly. + */ +void resubmit_bio_noacct(struct bio *bio) +{ + submit_bio_noacct(bio); + blk_throtl_charge_bio_split(bio); +} +EXPORT_SYMBOL(resubmit_bio_noacct); + /** * submit_bio - submit a bio to the block device layer for I/O * @bio: The &struct bio which describes the I/O diff --git a/block/blk-merge.c b/block/blk-merge.c index 4de34a332c9f..acc786d872e6 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c @@ -366,10 +366,8 @@ void __blk_queue_split(struct request_queue *q, struct bio **bio, bio_chain(split, *bio); trace_block_split(split, (*bio)->bi_iter.bi_sector); - submit_bio_noacct(*bio); + resubmit_bio_noacct(*bio); *bio = split; - - blk_throtl_charge_bio_split(*bio); } } diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 22746b2d6825..cce2db9fae1f 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -600,6 +600,7 @@ static inline unsigned int blk_queue_depth(struct request_queue *q) extern int blk_register_queue(struct gendisk *disk); extern void blk_unregister_queue(struct gendisk *disk); void submit_bio_noacct(struct bio *bio); +void resubmit_bio_noacct(struct bio *bio); extern int blk_lld_busy(struct request_queue *q); extern void blk_queue_split(struct bio **); From patchwork Mon Jan 10 07:51:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 12708313 X-Patchwork-Delegate: snitzer@redhat.com 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 us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 740A5C433F5 for ; Mon, 10 Jan 2022 07:55:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641801326; h=from:from:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=ow8IOCarsCDfu3QEUf4cSGpLtVFckeW9fftoym13QUo=; b=abZH3vBz0XLRj6XqPhY09FLvfj7497/CukpTID8GsCLdWzYvSXE7TGLibtYAXbfHAM/Fop v/cLu5Qp5phY8EAy3sda4bdS6IR5b9Mn5c32h6zoGr0n4QwOfurEtAhbVPIkmu5DTwX3fJ +fjsxlE6JAm9lcgMmbfz++zznPOvH5I= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-513-zNrPmyBxOY6t9vAcPZSkmA-1; Mon, 10 Jan 2022 02:55:22 -0500 X-MC-Unique: zNrPmyBxOY6t9vAcPZSkmA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1542A1006AA8; Mon, 10 Jan 2022 07:55:18 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2F7D91F2FB; Mon, 10 Jan 2022 07:55:16 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 469FA4BB7C; Mon, 10 Jan 2022 07:55:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20A7r0jG015350 for ; Mon, 10 Jan 2022 02:53:00 -0500 Received: by smtp.corp.redhat.com (Postfix) id B1351694DE; Mon, 10 Jan 2022 07:53:00 +0000 (UTC) Received: from localhost (ovpn-8-24.pek2.redhat.com [10.72.8.24]) by smtp.corp.redhat.com (Postfix) with ESMTP id 72BCB694D9; Mon, 10 Jan 2022 07:52:28 +0000 (UTC) From: Ming Lei To: Jens Axboe , Mike Snitzer Date: Mon, 10 Jan 2022 15:51:41 +0800 Message-Id: <20220110075141.389532-3-ming.lei@redhat.com> In-Reply-To: <20220110075141.389532-1-ming.lei@redhat.com> References: <20220110075141.389532-1-ming.lei@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: dm-devel@redhat.com Cc: Ming Lei , linux-block@vger.kernel.org, dm-devel@redhat.com, lining , Tejun Heo , Chunguang Xu Subject: [dm-devel] [PATCH 2/2] dm: use resubmit_bio_noacct to submit split bio X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dm-devel-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com lining reported that blk-throttle iops limit doesn't work correctly for dm-thin. Turns out it is same issue with the one addressed by commit 4f1e9630afe6 ("blk-throtl: optimize IOPS throttle for large IO scenarios"). So use the new added block layer API for addressing the same issue. Reported-by: lining Cc: Tejun Heo Cc: Chunguang Xu Signed-off-by: Ming Lei --- drivers/md/dm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 280918cdcabd..8a58379e737c 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -1562,7 +1562,7 @@ static void __split_and_process_bio(struct mapped_device *md, bio_chain(b, bio); trace_block_split(b, bio->bi_iter.bi_sector); - submit_bio_noacct(bio); + resubmit_bio_noacct(bio); } }