From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 20412CD1292 for ; Mon, 8 Apr 2024 01:44:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=2K2G14nW7s3d2BJ6iiiGR3XNdWkFMK8NOklTzhYEFgI=; b=NTBtFARGgElXB1MnfvarEpCTom v56ATU2NYjjSYEZi0bWbO7mjkbOsU9IqOBkEe6kiY1hKv6B15jNWk3P+pwkwQD/02UxIS2vI9HM5W ASZmJpcrBmYZQKZLssdAROqcL2ZR4LTO3jXupAyxDGL5+CJkFiK8MgFrpSz3WxKlPF3uaMijnngYq V06EmTHf0tbt2PYdpfcBuR0PH9p7gBVoMAnEfuZnJbC8SV930WhStJ+MgoEDUSM1YUkUcsy6RI7r/ 82eo4fFkmOnRp3cOhj0h8gtkDRjH0L+ygPD5ickW4omfxLAesAiI60bq9jO2Os/BkL2RysSTTs1W9 663BAnog==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rte3G-0000000DwzI-4APS; Mon, 08 Apr 2024 01:44:03 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rte29-0000000DwEP-0Fvn for linux-nvme@bombadil.infradead.org; Mon, 08 Apr 2024 01:42:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc: Content-Type:Content-ID:Content-Description; bh=2K2G14nW7s3d2BJ6iiiGR3XNdWkFMK8NOklTzhYEFgI=; b=gbGYhgF+bcw4ky4HuoKILQVWH4 yE+zjGwq7Ya5KKDuNIyllyKJPAPqXR2oIKWVLmO66aZbcVpdm9BEd8wyfnf7HIuOKGQcHcIS2b99I 7s258sQZjeNx2xLFk8itiwOhJWraQ4EQFSgmTbP1RVsRHE+u0PjPCgXmCLUaufLHluv9TGN8OEoOR UfnrIgb5KvPIl4A9b4WmobBASb6xajVkC485HQWd4HSo9sLc0YWtvevm+9FD8tMnt2ELpcE7WWltv 07g2jFdMHqFuROgP2thHkyoj7BCZQn2ryLVjoo7IY7LPgTmwQA5Rg6zCjitVBCbmOKwn4tfC+aA5T 1s/MNMKQ==; Received: from sin.source.kernel.org ([145.40.73.55]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rte21-00000006trw-0EO6 for linux-nvme@lists.infradead.org; Mon, 08 Apr 2024 01:42:50 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 0D231CE0B9D; Mon, 8 Apr 2024 01:42:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6855AC433F1; Mon, 8 Apr 2024 01:42:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712540536; bh=+JVRlxBX5aHT/XzoHY0UOH1PXIqeE4dJyv+Nxl96AQY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=HpFLi7dL8zTkAprcsLjDjkTlBcIUNMPvr3lYyJTwmuufXd45q9mb4Mh1zOuE9Q/0D Hap4gPTYrdIm6ll2crGeSr15WH6EWR9pIMmINyOriNs6z5YlUTDbk38CTGkwSa0sOW 8zzXHrgo7KzTymgTxxLmlB1kYnxPutICJHBmx5+R5zTpj2H5rGtM/QX/55yRnUCamM qvHCYfyhAeZG44taq2GkLRKJ5K9po8bXPy3VJGACimbQWaart5HHfKDwT5rxUuYBTS FdIwsqifbnkFQLdGP0MLvtBLHdxNZma9JKXko89qLPQi4hrOp0sVyVte4E7rcUQp+Q A94+QlmRr4uxg== From: Damien Le Moal To: linux-block@vger.kernel.org, Jens Axboe , linux-scsi@vger.kernel.org, "Martin K . Petersen" , dm-devel@lists.linux.dev, Mike Snitzer , linux-nvme@lists.infradead.org, Keith Busch , Christoph Hellwig Subject: [PATCH v7 25/28] block: Replace zone_wlock debugfs entry with zone_wplugs entry Date: Mon, 8 Apr 2024 10:41:25 +0900 Message-ID: <20240408014128.205141-26-dlemoal@kernel.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240408014128.205141-1-dlemoal@kernel.org> References: <20240408014128.205141-1-dlemoal@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240408_024246_538679_DAFE12C8 X-CRM114-Status: GOOD ( 16.58 ) X-BeenThere: linux-nvme@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-nvme" Errors-To: linux-nvme-bounces+linux-nvme=archiver.kernel.org@lists.infradead.org In preparation to completely remove zone write locking, replace the "zone_wlock" mq-debugfs entry that was listing zones that are write-locked with the zone_wplugs entry which lists the zones that currently have a write plug allocated. The write plug information provided is: the zone number, the zone write plug flags, the zone write plug write pointer offset and the number of BIOs currently waiting for execution in the zone write plug BIO list. Signed-off-by: Damien Le Moal Reviewed-by: Christoph Hellwig Reviewed-by: Bart Van Assche Reviewed-by: Hannes Reinecke Tested-by: Hans Holmberg Tested-by: Dennis Maisenbacher Reviewed-by: Martin K. Petersen --- block/blk-mq-debugfs.c | 2 +- block/blk-mq-debugfs.h | 4 ++-- block/blk-zoned.c | 31 ++++++++++++++++++++++++------- 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c index 94668e72ab09..ca1f2b9422d5 100644 --- a/block/blk-mq-debugfs.c +++ b/block/blk-mq-debugfs.c @@ -160,7 +160,7 @@ static const struct blk_mq_debugfs_attr blk_mq_debugfs_queue_attrs[] = { { "requeue_list", 0400, .seq_ops = &queue_requeue_list_seq_ops }, { "pm_only", 0600, queue_pm_only_show, NULL }, { "state", 0600, queue_state_show, queue_state_write }, - { "zone_wlock", 0400, queue_zone_wlock_show, NULL }, + { "zone_wplugs", 0400, queue_zone_wplugs_show, NULL }, { }, }; diff --git a/block/blk-mq-debugfs.h b/block/blk-mq-debugfs.h index 3ebe2c29b624..c80e453e3014 100644 --- a/block/blk-mq-debugfs.h +++ b/block/blk-mq-debugfs.h @@ -84,9 +84,9 @@ static inline void blk_mq_debugfs_unregister_rqos(struct rq_qos *rqos) #endif #if defined(CONFIG_BLK_DEV_ZONED) && defined(CONFIG_BLK_DEBUG_FS) -int queue_zone_wlock_show(void *data, struct seq_file *m); +int queue_zone_wplugs_show(void *data, struct seq_file *m); #else -static inline int queue_zone_wlock_show(void *data, struct seq_file *m) +static inline int queue_zone_wplugs_show(void *data, struct seq_file *m) { return 0; } diff --git a/block/blk-zoned.c b/block/blk-zoned.c index a06d7f7a54c7..44699b431ad0 100644 --- a/block/blk-zoned.c +++ b/block/blk-zoned.c @@ -1808,17 +1808,34 @@ EXPORT_SYMBOL_GPL(blk_revalidate_disk_zones); #ifdef CONFIG_BLK_DEBUG_FS -int queue_zone_wlock_show(void *data, struct seq_file *m) +int queue_zone_wplugs_show(void *data, struct seq_file *m) { struct request_queue *q = data; - unsigned int i; + struct gendisk *disk = q->disk; + struct blk_zone_wplug *zwplug; + unsigned int zwp_wp_offset, zwp_flags; + unsigned int zwp_zone_no, zwp_ref; + unsigned int zwp_bio_list_size, i; + unsigned long flags; - if (!q->disk->seq_zones_wlock) - return 0; + rcu_read_lock(); + for (i = 0; i < disk_zone_wplugs_hash_size(disk); i++) { + hlist_for_each_entry_rcu(zwplug, + &disk->zone_wplugs_hash[i], node) { + spin_lock_irqsave(&zwplug->lock, flags); + zwp_zone_no = zwplug->zone_no; + zwp_flags = zwplug->flags; + zwp_ref = atomic_read(&zwplug->ref); + zwp_wp_offset = zwplug->wp_offset; + zwp_bio_list_size = bio_list_size(&zwplug->bio_list); + spin_unlock_irqrestore(&zwplug->lock, flags); - for (i = 0; i < q->disk->nr_zones; i++) - if (test_bit(i, q->disk->seq_zones_wlock)) - seq_printf(m, "%u\n", i); + seq_printf(m, "%u 0x%x %u %u %u\n", + zwp_zone_no, zwp_flags, zwp_ref, + zwp_wp_offset, zwp_bio_list_size); + } + } + rcu_read_unlock(); return 0; } -- 2.44.0