All of lore.kernel.org
 help / color / mirror / Atom feed
From: Damien Le Moal <damien.lemoal@wdc.com>
To: linux-block@vger.kernel.org, Jens Axboe <axboe@kernel.dk>,
	linux-scsi@vger.kernel.org,
	"Martin K . Petersen" <martin.petersen@oracle.com>,
	dm-devel@redhat.com, Mike Snitzer <snitzer@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>,
	Matias Bjorling <matias.bjorling@wdc.com>
Subject: [PATCH v2 09/11] block: Expose queue nr_zones in sysfs
Date: Thu, 11 Oct 2018 16:09:50 +0900	[thread overview]
Message-ID: <20181011070952.13248-10-damien.lemoal@wdc.com> (raw)
In-Reply-To: <20181011070952.13248-1-damien.lemoal@wdc.com>

Expose through sysfs the nr_zones field of a zoned block device request
queue. This represents the total number of zones of the device
calculated using the known disk capacity and zone size.

Exposing this value helps in debugging disk issues as well as
facilitating scripts based use of the disk (e.g. blktests).

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
---
 block/blk-sysfs.c      | 11 +++++++++++
 include/linux/blkdev.h |  2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index 3772671cf2bc..f7060a938bf9 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -300,6 +300,11 @@ static ssize_t queue_zoned_show(struct request_queue *q, char *page)
 	}
 }
 
+static ssize_t queue_nr_zones_show(struct request_queue *q, char *page)
+{
+	return queue_var_show(q->nr_zones, page);
+}
+
 static ssize_t queue_nomerges_show(struct request_queue *q, char *page)
 {
 	return queue_var_show((blk_queue_nomerges(q) << 1) |
@@ -637,6 +642,11 @@ static struct queue_sysfs_entry queue_zoned_entry = {
 	.show = queue_zoned_show,
 };
 
+static struct queue_sysfs_entry queue_nr_zones_entry = {
+	.attr = {.name = "nr_zones", .mode = 0444 },
+	.show = queue_nr_zones_show,
+};
+
 static struct queue_sysfs_entry queue_nomerges_entry = {
 	.attr = {.name = "nomerges", .mode = 0644 },
 	.show = queue_nomerges_show,
@@ -727,6 +737,7 @@ static struct attribute *default_attrs[] = {
 	&queue_write_zeroes_max_entry.attr,
 	&queue_nonrot_entry.attr,
 	&queue_zoned_entry.attr,
+	&queue_nr_zones_entry.attr,
 	&queue_nomerges_entry.attr,
 	&queue_rq_affinity_entry.attr,
 	&queue_iostats_entry.attr,
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index c24969b1741b..23ab53d2d4ca 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -593,7 +593,6 @@ struct request_queue {
 
 	struct queue_limits	limits;
 
-#ifdef CONFIG_BLK_DEV_ZONED
 	/*
 	 * Zoned block device information for request dispatch control.
 	 * nr_zones is the total number of zones of the device. This is always
@@ -612,6 +611,7 @@ struct request_queue {
 	 * blk_mq_unfreeze_queue().
 	 */
 	unsigned int		nr_zones;
+#ifdef CONFIG_BLK_DEV_ZONED
 	unsigned long		*seq_zones_bitmap;
 	unsigned long		*seq_zones_wlock;
 #endif /* CONFIG_BLK_DEV_ZONED */
-- 
2.17.1

  parent reply	other threads:[~2018-10-11  7:09 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-11  7:09 [PATCH v2 00/11] Zoned block device support improvements Damien Le Moal
2018-10-11  7:09 ` [PATCH v2 01/11] scsi: sd_zbc: Rearrange code Damien Le Moal
2018-10-11  7:09 ` [PATCH v2 02/11] scsi: sd_zbc: Reduce boot device scan and revalidate time Damien Le Moal
2018-10-11  7:09 ` [PATCH v2 03/11] scsi: sd_zbc: Fix sd_zbc_check_zones() error checks Damien Le Moal
2018-10-11  7:09 ` [PATCH v2 04/11] block: Introduce blkdev_nr_zones() helper Damien Le Moal
2018-10-11  7:09 ` [PATCH v2 05/11] block: Limit allocation of zone descriptors for report zones Damien Le Moal
2018-10-11  7:09 ` [PATCH v2 06/11] block: Introduce BLKGETZONESZ ioctl Damien Le Moal
2018-10-11  7:09 ` [PATCH v2 07/11] block: Introduce BLKGETNRZONES ioctl Damien Le Moal
2018-10-11  7:09 ` [PATCH v2 08/11] block: Improve zone reset execution Damien Le Moal
2018-10-11  7:09 ` Damien Le Moal [this message]
2018-10-11 14:42   ` [PATCH v2 09/11] block: Expose queue nr_zones in sysfs Ewan D. Milne
2018-10-11 14:42     ` Ewan D. Milne
2018-10-12  0:41     ` Damien Le Moal
2018-10-12  0:41       ` Damien Le Moal
2018-10-11  7:09 ` [PATCH v2 10/11] block: add a report_zones method Damien Le Moal
2018-10-11  7:09 ` [PATCH v2 11/11] block: Introduce blk_revalidate_disk_zones() Damien Le Moal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181011070952.13248-10-damien.lemoal@wdc.com \
    --to=damien.lemoal@wdc.com \
    --cc=axboe@kernel.dk \
    --cc=dm-devel@redhat.com \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=matias.bjorling@wdc.com \
    --cc=snitzer@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.