Skip to contentSkip to conversation

Support for zoned block devices

PATCH In review Hannes Reinecke 6 participants 32 messages Jul 19, 2016 – Jul 25, 2016

Subsystems (3)
lore
Share & tools
lore
#1 lore raw

PATCH 1/6 blk-sysfs: Add 'chunk_sectors' to sysfs attributes

In reply to Hannes Reinecke

The queue limits already have a 'chunk_sectors' setting, so we should be presenting it via sysfs.

---
 block/blk-sysfs.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
block/blk-sysfs.c +11 -0
index 9920596..73200b8 100644
@@ -130,6 +130,11 @@ static ssize_t queue_physical_block_size_show(struct request_queue *q, char *pag
 	return queue_var_show(queue_physical_block_size(q), page);
 }
 
+static ssize_t queue_chunk_sectors_show(struct request_queue *q, char *page)
+{
+	return queue_var_show(q->limits.chunk_sectors, page);
+}
+
 static ssize_t queue_io_min_show(struct request_queue *q, char *page)
 {
 	return queue_var_show(queue_io_min(q), page);
@@ -438,6 +443,11 @@ static struct queue_sysfs_entry queue_physical_block_size_entry = {
 	.show = queue_physical_block_size_show,
 };
 
+static struct queue_sysfs_entry queue_chunk_sectors_entry = {
+	.attr = {.name = "chunk_sectors", .mode = S_IRUGO },
+	.show = queue_chunk_sectors_show,
+};
+
 static struct queue_sysfs_entry queue_io_min_entry = {
 	.attr = {.name = "minimum_io_size", .mode = S_IRUGO },
 	.show = queue_io_min_show,
@@ -528,6 +538,7 @@ static struct attribute *default_attrs[] = {
 	&queue_hw_sector_size_entry.attr,
 	&queue_logical_block_size_entry.attr,
 	&queue_physical_block_size_entry.attr,
+	&queue_chunk_sectors_entry.attr,
 	&queue_io_min_entry.attr,
 	&queue_io_opt_entry.attr,
 	&queue_discard_granularity_entry.attr,
Signature · 1 line
1.8.5.6
#9 lore raw

PATCH 3/6 block: Implement support for zoned block devices

In reply to Hannes Reinecke

Implement a RB-Tree holding the zone information and add support functions for maintaining the RB-Tree.

---
 block/Kconfig          |  9 +++++++
 block/Makefile         |  1 +
 block/blk-core.c       |  5 ++++
 block/blk-zoned.c      | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/blkdev.h | 47 +++++++++++++++++++++++++++++++++
 5 files changed, 132 insertions(+)
 create mode 100644 block/blk-zoned.c
block/Kconfig +9 -0
index 0363cd7..8162312 100644
@@ -113,6 +113,15 @@ config BLK_DEV_THROTTLING
 
 	See Documentation/cgroups/blkio-controller.txt for more information.
 
+config BLK_DEV_ZONED
+	bool "Zoned block device support"
+	default n
+	---help---
+	Block layer zoned block device support. This option enables
+	support for zoned block (ZAC/ZBC) devices.
+
+	Say yes here if you have a ZAC or ZBC storage device.
+
 config BLK_CMDLINE_PARSER
 	bool "Block device command line partition parser"
 	default n
block/Makefile +1 -0
index 9eda232..bc9e62c 100644
@@ -15,6 +15,7 @@ obj-$(CONFIG_BLK_DEV_BSG)	+= bsg.o
 obj-$(CONFIG_BLK_DEV_BSGLIB)	+= bsg-lib.o
 obj-$(CONFIG_BLK_CGROUP)	+= blk-cgroup.o
 obj-$(CONFIG_BLK_DEV_THROTTLING)	+= blk-throttle.o
+obj-$(CONFIG_BLK_DEV_ZONED)	+= blk-zoned.o
 obj-$(CONFIG_IOSCHED_NOOP)	+= noop-iosched.o
 obj-$(CONFIG_IOSCHED_DEADLINE)	+= deadline-iosched.o
 obj-$(CONFIG_IOSCHED_CFQ)	+= cfq-iosched.o
block/blk-core.c +5 -0
index 2475b1c7..e273194 100644
@@ -588,6 +588,8 @@ void blk_cleanup_queue(struct request_queue *q)
 		blk_mq_free_queue(q);
 	percpu_ref_exit(&q->q_usage_counter);
 
+	blk_drop_zones(q);
+
 	spin_lock_irq(lock);
 	if (q->queue_lock != &q->__queue_lock)
 		q->queue_lock = &q->__queue_lock;
@@ -724,6 +726,9 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id)
 #ifdef CONFIG_BLK_CGROUP
 	INIT_LIST_HEAD(&q->blkg_list);
 #endif
+#ifdef CONFIG_BLK_DEV_ZONED
+	q->zones = RB_ROOT;
+#endif
 	INIT_DELAYED_WORK(&q->delay_work, blk_delay_work);
 
 	kobject_init(&q->kobj, &blk_queue_ktype);
block/blk-zoned.c new file +70 -0

70 lines not on this page · raw message

include/linux/blkdev.h +47 -0

59 lines not on this page · raw message

Signature · 1 line
1.8.5.6
#0 lore raw

cover Support for zoned block devices

Hi Jens,

this patchset adds support for zoned block devices to the block layer. Support for it is selected with the new 'BLK_DEV_ZONED' config option.

Patch has been made over Tejuns 'libata/for-4.8' repository.

As usual, comments and reviews are welcome.

Hannes Reinecke (6):
blk-sysfs: Add 'chunk_sectors' to sysfs attributes
block: update chunk_sectors in blk_stack_limits()
block: Implement support for zoned block devices
block: Add 'zoned' sysfs queue attribute
block: Introduce BLKPREP_DONE
block: Add 'BLK_MQ_RQ_QUEUE_DONE' return value

 block/Kconfig           |  9 +++++++
 block/Makefile          |  1 +
 block/blk-core.c        | 11 +++++++-
 block/blk-mq.c          |  1 +
 block/blk-settings.c    |  4 +++
 block/blk-sysfs.c       | 57 ++++++++++++++++++++++++++++++++++++++++
 block/blk-zoned.c       | 70 +++++++++++++++++++++++++++++++++++++++++++++++++
 drivers/scsi/scsi_lib.c |  4 +++
 include/linux/blk-mq.h  |  1 +
 include/linux/blkdev.h  | 48 +++++++++++++++++++++++++++++++++
 10 files changed, 205 insertions(+), 1 deletion(-)
 create mode 100644 block/blk-zoned.c
Signature · 1 line
1.8.5.6
#24 lore raw

PATCH 5/6 block: Introduce BLKPREP_DONE

Add a new blkprep return code BLKPREP_DONE to signal completion without I/O error.

---
 block/blk-core.c        | 6 +++++-
 drivers/scsi/scsi_lib.c | 1 +
 include/linux/blkdev.h  | 1 +
 3 files changed, 7 insertions(+), 1 deletion(-)
block/blk-core.c +5 -1
index e273194..4bcf30a 100644
@@ -2462,9 +2462,13 @@ struct request *blk_peek_request(struct request_queue *q)
 
 			rq = NULL;
 			break;
-		} else if (ret == BLKPREP_KILL || ret == BLKPREP_INVALID) {
+		} else if (ret == BLKPREP_KILL || ret == BLKPREP_INVALID ||
+			   ret == BLKPREP_DONE) {
 			int err = (ret == BLKPREP_INVALID) ? -EREMOTEIO : -EIO;
 
+			if (ret == BLKPREP_DONE)
+				err = 0;
+
 			rq->cmd_flags |= REQ_QUIET;
 			/*
 			 * Mark this request as started so we don't trigger
drivers/scsi/scsi_lib.c +1 -0
index b2e332a..f112926 100644
@@ -1257,6 +1257,7 @@ scsi_prep_return(struct request_queue *q, struct request *req, int ret)
 	case BLKPREP_KILL:
 	case BLKPREP_INVALID:
 		req->errors = DID_NO_CONNECT << 16;
+	case BLKPREP_DONE:
 		/* release the command and kill it */
 		if (req->special) {
 			struct scsi_cmnd *cmd = req->special;
include/linux/blkdev.h +1 -0
index d5e3d8b..c351444 100644
@@ -736,6 +736,7 @@ enum {
 	BLKPREP_KILL,		/* fatal error, kill, return -EIO */
 	BLKPREP_DEFER,		/* leave on queue */
 	BLKPREP_INVALID,	/* invalid command, kill, return -EREMOTEIO */
+	BLKPREP_DONE,		/* complete w/o error */
 };
 
 extern unsigned long blk_max_low_pfn, blk_max_pfn;
Signature · 1 line
1.8.5.6
#28 lore raw

PATCH 6/6 block: Add 'BLK_MQ_RQ_QUEUE_DONE' return value

In reply to Hannes Reinecke

Add a return value BLK_MQ_RQ_QUEUE_DONE to terminate a request without error.

---
 block/blk-mq.c          | 1 +
 drivers/scsi/scsi_lib.c | 3 +++
 include/linux/blk-mq.h  | 1 +
 3 files changed, 5 insertions(+)
block/blk-mq.c +1 -0
index 7df9c92..cd25d68 100644
@@ -793,6 +793,7 @@ static void __blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx)
 			pr_err("blk-mq: bad return on queue: %d\n", ret);
 		case BLK_MQ_RQ_QUEUE_ERROR:
 			rq->errors = -EIO;
+		case BLK_MQ_RQ_QUEUE_DONE:
 			blk_mq_end_request(rq, rq->errors);
 			break;
 		}
drivers/scsi/scsi_lib.c +3 -0
index f112926..d74108b 100644
@@ -1802,6 +1802,8 @@ static inline int prep_to_mq(int ret)
 		return 0;
 	case BLKPREP_DEFER:
 		return BLK_MQ_RQ_QUEUE_BUSY;
+	case BLKPREP_DONE:
+		return BLK_MQ_RQ_QUEUE_DONE;
 	default:
 		return BLK_MQ_RQ_QUEUE_ERROR;
 	}
@@ -1945,6 +1947,7 @@ out:
 			blk_mq_delay_queue(hctx, SCSI_QUEUE_DELAY);
 		break;
 	case BLK_MQ_RQ_QUEUE_ERROR:
+	case BLK_MQ_RQ_QUEUE_DONE:
 		/*
 		 * Make sure to release all allocated ressources when
 		 * we hit an error, as we will never see this command
include/linux/blk-mq.h +1 -0
index 2498fdf..f7a9e97 100644
@@ -151,6 +151,7 @@ enum {
 	BLK_MQ_RQ_QUEUE_OK	= 0,	/* queued fine */
 	BLK_MQ_RQ_QUEUE_BUSY	= 1,	/* requeue IO for later */
 	BLK_MQ_RQ_QUEUE_ERROR	= 2,	/* end IO with error */
+	BLK_MQ_RQ_QUEUE_DONE	= 3,	/* end IO w/o error */
 
 	BLK_MQ_F_SHOULD_MERGE	= 1 << 0,
 	BLK_MQ_F_TAG_SHARED	= 1 << 1,
Signature · 1 line
1.8.5.6
#5 lore raw

PATCH 2/6 block: update chunk_sectors in blk_stack_limits()

In reply to Hannes Reinecke
---
 block/blk-settings.c | 4 ++++
 1 file changed, 4 insertions(+)
block/blk-settings.c +4 -0
index f679ae1..bfaf579 100644
@@ -630,6 +630,10 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
 			t->discard_granularity;
 	}
 
+	if (b->chunk_sectors)
+		t->chunk_sectors = min_not_zero(t->chunk_sectors,
+						b->chunk_sectors);
+
 	return ret;
 }
 EXPORT_SYMBOL(blk_stack_limits);
Signature · 1 line
1.8.5.6
#11 lore raw

PATCH 4/6 block: Add 'zoned' sysfs queue attribute

In reply to Hannes Reinecke

Add a sysfs queue attribute 'zoned' to display the zone layout for zoned devices.

---
 block/blk-sysfs.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)
block/blk-sysfs.c +46 -0
index 73200b8..7ffbc44 100644
@@ -229,6 +229,42 @@ static ssize_t queue_max_hw_sectors_show(struct request_queue *q, char *page)
 	return queue_var_show(max_hw_sectors_kb, (page));
 }
 
+#ifdef CONFIG_BLK_DEV_ZONED
+static ssize_t queue_zoned_show(struct request_queue *q, char *page)
+{
+	struct rb_node *node;
+	struct blk_zone *zone;
+	ssize_t offset = 0, end = 0;
+	size_t size = 0, num = 0;
+	enum blk_zone_type type = BLK_ZONE_TYPE_UNKNOWN;
+
+	for (node = rb_first(&q->zones); node; node = rb_next(node)) {
+		zone = rb_entry(node, struct blk_zone, node);
+		if (zone->type != type ||
+		    zone->len != size ||
+		    end != zone->start) {
+			if (size != 0)
+				offset += sprintf(page + offset, "%zu\n", num);
+			/* We can only store one page ... */
+			if (offset + 42 > PAGE_SIZE) {
+				offset += sprintf(page + offset, "...\n");
+				return offset;
+			}
+			size = zone->len;
+			type = zone->type;
+			offset += sprintf(page + offset, "%zu %zu %d ",
+					  zone->start, size, type);
+			num = 0;
+			end = zone->start + size;
+		} else
+			end += zone->len;
+		num++;
+	}
+	offset += sprintf(page + offset, "%zu\n", num);
+	return offset;
+}
+#endif
+
 #define QUEUE_SYSFS_BIT_FNS(name, flag, neg)				\
 static ssize_t								\
 queue_show_##name(struct request_queue *q, char *page)			\
@@ -484,6 +520,13 @@ static struct queue_sysfs_entry queue_write_same_max_entry = {
 	.show = queue_write_same_max_show,
 };
 
+#ifdef CONFIG_BLK_DEV_ZONED
+static struct queue_sysfs_entry queue_zoned_entry = {
+	.attr = {.name = "zoned", .mode = S_IRUGO },
+	.show = queue_zoned_show,
+};
+#endif
+
 static struct queue_sysfs_entry queue_nonrot_entry = {
 	.attr = {.name = "rotational", .mode = S_IRUGO | S_IWUSR },
 	.show = queue_show_nonrot,
@@ -547,6 +590,9 @@ static struct attribute *default_attrs[] = {
 	&queue_discard_zeroes_data_entry.attr,
 	&queue_write_same_max_entry.attr,
 	&queue_nonrot_entry.attr,
+#ifdef CONFIG_BLK_DEV_ZONED
+	&queue_zoned_entry.attr,
+#endif
 	&queue_nomerges_entry.attr,
 	&queue_rq_affinity_entry.attr,
 	&queue_iostats_entry.attr,
Signature · 1 line
1.8.5.6
Reviewed-by Tested-by on v1 1/6
#2 lore raw

Re: [PATCH 1/6] blk-sysfs: Add 'chunk_sectors' to sysfs attributes

In reply to Hannes Reinecke
Quoted 7 lines · Hannes Reinecke

The queue limits already have a 'chunk_sectors' setting, so we should be presenting it via sysfs.

---
 block/blk-sysfs.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
Signature · 11 lines
Damien Le Moal, Ph.D.
Sr. Manager, System Software Group, HGST Research,
HGST, a Western Digital brand
[email protected]
(+81) 0466-98-3593 (ext. 513593)
1 kirihara-cho, Fujisawa,
Kanagawa, 252-0888 Japan
www.hgst.com
Western Digital Corporation (and its subsidiaries) E-mail Confidentiality Notice & Disclaimer:

This e-mail and any files transmitted with it may contain confidential or legally privileged information of WDC and/or its affiliates, and are intended solely for the use of the individual or entity to which they are addressed. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited. If you have received this e-mail in error, please notify the sender immediately and delete the e-mail in its entirety from your system.
Reviewed-by Tested-by on v1 2/6
#6 lore raw

Re: [PATCH 2/6] block: update chunk_sectors in blk_stack_limits()

In reply to Hannes Reinecke
Quoted 4 lines · Hannes Reinecke
---
 block/blk-settings.c | 4 ++++
 1 file changed, 4 insertions(+)
Signature · 11 lines
Damien Le Moal, Ph.D.
Sr. Manager, System Software Group, HGST Research,
HGST, a Western Digital brand
[email protected]
(+81) 0466-98-3593 (ext. 513593)
1 kirihara-cho, Fujisawa,
Kanagawa, 252-0888 Japan
www.hgst.com
Western Digital Corporation (and its subsidiaries) E-mail Confidentiality Notice & Disclaimer:

This e-mail and any files transmitted with it may contain confidential or legally privileged information of WDC and/or its affiliates, and are intended solely for the use of the individual or entity to which they are addressed. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited. If you have received this e-mail in error, please notify the sender immediately and delete the e-mail in its entirety from your system.
Reviewed-by Tested-by on v1 3/6
#10 lore raw

Re: [PATCH 3/6] block: Implement support for zoned block devices

In reply to Hannes Reinecke
Quoted 4 lines · Hannes Reinecke

Implement a RB-Tree holding the zone information and add support functions for maintaining the RB-Tree.

Quoted 8 lines
---
 block/Kconfig          |  9 +++++++
 block/Makefile         |  1 +
 block/blk-core.c       |  5 ++++
 block/blk-zoned.c      | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/blkdev.h | 47 +++++++++++++++++++++++++++++++++
 5 files changed, 132 insertions(+)
 create mode 100644 block/blk-zoned.c
Signature · 11 lines
Damien Le Moal, Ph.D.
Sr. Manager, System Software Group, HGST Research,
HGST, a Western Digital brand
[email protected]
(+81) 0466-98-3593 (ext. 513593)
1 kirihara-cho, Fujisawa,
Kanagawa, 252-0888 Japan
www.hgst.com
Western Digital Corporation (and its subsidiaries) E-mail Confidentiality Notice & Disclaimer:

This e-mail and any files transmitted with it may contain confidential or legally privileged information of WDC and/or its affiliates, and are intended solely for the use of the individual or entity to which they are addressed. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited. If you have received this e-mail in error, please notify the sender immediately and delete the e-mail in its entirety from your system.
Reviewed-by Tested-by on v1 4/6
#12 lore raw

Re: [PATCH 4/6] block: Add 'zoned' sysfs queue attribute

In reply to Hannes Reinecke
Quoted 7 lines · Hannes Reinecke

Add a sysfs queue attribute 'zoned' to display the zone layout for zoned devices.

---
 block/blk-sysfs.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)
Signature · 11 lines
Damien Le Moal, Ph.D.
Sr. Manager, System Software Group, HGST Research,
HGST, a Western Digital brand
[email protected]
(+81) 0466-98-3593 (ext. 513593)
1 kirihara-cho, Fujisawa,
Kanagawa, 252-0888 Japan
www.hgst.com
Western Digital Corporation (and its subsidiaries) E-mail Confidentiality Notice & Disclaimer:

This e-mail and any files transmitted with it may contain confidential or legally privileged information of WDC and/or its affiliates, and are intended solely for the use of the individual or entity to which they are addressed. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited. If you have received this e-mail in error, please notify the sender immediately and delete the e-mail in its entirety from your system.
Reviewed-by Tested-by on v1 5/6
#25 lore raw

Re: [PATCH 5/6] block: Introduce BLKPREP_DONE

In reply to Hannes Reinecke
Quoted 9 lines · Hannes Reinecke

Add a new blkprep return code BLKPREP_DONE to signal completion without I/O error.

---
 block/blk-core.c        | 6 +++++-
 drivers/scsi/scsi_lib.c | 1 +
 include/linux/blkdev.h  | 1 +
 3 files changed, 7 insertions(+), 1 deletion(-)
Signature · 11 lines
Damien Le Moal, Ph.D.
Sr. Manager, System Software Group, HGST Research,
HGST, a Western Digital brand
[email protected]
(+81) 0466-98-3593 (ext. 513593)
1 kirihara-cho, Fujisawa,
Kanagawa, 252-0888 Japan
www.hgst.com
Western Digital Corporation (and its subsidiaries) E-mail Confidentiality Notice & Disclaimer:

This e-mail and any files transmitted with it may contain confidential or legally privileged information of WDC and/or its affiliates, and are intended solely for the use of the individual or entity to which they are addressed. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited. If you have received this e-mail in error, please notify the sender immediately and delete the e-mail in its entirety from your system.
Reviewed-by Tested-by on v1 6/6
#29 lore raw

Re: [PATCH 6/6] block: Add 'BLK_MQ_RQ_QUEUE_DONE' return value

In reply to Hannes Reinecke
Quoted 9 lines · Hannes Reinecke

Add a return value BLK_MQ_RQ_QUEUE_DONE to terminate a request without error.

---
 block/blk-mq.c          | 1 +
 drivers/scsi/scsi_lib.c | 3 +++
 include/linux/blk-mq.h  | 1 +
 3 files changed, 5 insertions(+)
Signature · 11 lines
Damien Le Moal, Ph.D.
Sr. Manager, System Software Group, HGST Research,
HGST, a Western Digital brand
[email protected]
(+81) 0466-98-3593 (ext. 513593)
1 kirihara-cho, Fujisawa,
Kanagawa, 252-0888 Japan
www.hgst.com
Western Digital Corporation (and its subsidiaries) E-mail Confidentiality Notice & Disclaimer:

This e-mail and any files transmitted with it may contain confidential or legally privileged information of WDC and/or its affiliates, and are intended solely for the use of the individual or entity to which they are addressed. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited. If you have received this e-mail in error, please notify the sender immediately and delete the e-mail in its entirety from your system.
#30 lore raw

Re: [PATCH 6/6] block: Add 'BLK_MQ_RQ_QUEUE_DONE' return value

In reply to Hannes Reinecke
Quoted 2 lines · Hannes Reinecke

Add a return value BLK_MQ_RQ_QUEUE_DONE to terminate a request without error.

NAK. You can just do a blk_mq_end_request on the request and return 0 from ->queue_rq.

#26 lore raw

Re: [PATCH 5/6] block: Introduce BLKPREP_DONE

In reply to Hannes Reinecke

block/blk-core.c struct request *blk_peek_request(struct request_queue *q) · line 2471

Quoted 13 lines

+++ b/block/blk-core.c

block/blk-core.c +5 -1
@@ -2462,9 +2462,13 @@ struct request *blk_peek_request(struct request_queue *q)
 
 			rq = NULL;
 			break;
-		} else if (ret == BLKPREP_KILL || ret == BLKPREP_INVALID) {
+		} else if (ret == BLKPREP_KILL || ret == BLKPREP_INVALID ||
+			   ret == BLKPREP_DONE) {
 			int err = (ret == BLKPREP_INVALID) ? -EREMOTEIO : -EIO;
 
+			if (ret == BLKPREP_DONE)
+				err = 0;
+

Please just use a proper switch statement for the return values.

static void blk_prep_end_request(struct request *req, int error)

{
	rq->cmd_flags |= REQ_QUIET;
	blk_start_request(rq);
	__blk_end_request_all(rq, error);
}

struct request *blk_peek_request(struct request_queue *q) {

	...


	switch (ret) {
	...
	case BLKPREP_KILL:
		blk_prep_end_request(rq, -EIO);
		break;
	case BLKPREP_INVALID:
		blk_prep_end_request(rq, -EREMOTEIO);
		break;
	case BLKPREP_DONE:
		blk_prep_end_request(rq, 0);
		break;
	...
}
#31 lore raw

Re: [PATCH 6/6] block: Add 'BLK_MQ_RQ_QUEUE_DONE' return value

In reply to Christoph Hellwig
Quoted 7 lines · Christoph Hellwig
Quoted 2 lines · Hannes Reinecke

Add a return value BLK_MQ_RQ_QUEUE_DONE to terminate a request without error.

NAK. You can just do a blk_mq_end_request on the request and return 0 from ->queue_rq.

Okay, will be doing so.

Cheers,

Hannes

Signature · 9 lines
Dr. Hannes Reinecke		   Teamlead Storage & Networking
[email protected]			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-block" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#27 lore raw

Re: [PATCH 5/6] block: Introduce BLKPREP_DONE

In reply to Christoph Hellwig
Quoted 10 lines · Christoph Hellwig
Quoted 10 lines

+++ b/block/blk-core.c

block/blk-core.c +2 -1
@@ -2462,9 +2462,13 @@ struct request *blk_peek_request(struct request_queue *q)
 
 			rq = NULL;
 			break;
-		} else if (ret == BLKPREP_KILL || ret == BLKPREP_INVALID) {
+		} else if (ret == BLKPREP_KILL || ret == BLKPREP_INVALID ||
+			   ret == BLKPREP_DONE) {
 			int err = (ret == BLKPREP_INVALID) ? -EREMOTEIO : -EIO;
 
Quoted 6 lines

block/blk-core.c struct request *blk_peek_request(struct request_queue *q) · line 2471

Quoted 3 lines
block/blk-core.c +3 -0
+			if (ret == BLKPREP_DONE)
+				err = 0;
+

Please just use a proper switch statement for the return values.

Ok.

Cheers,

Hannes

Signature · 5 lines
Dr. Hannes Reinecke		   Teamlead Storage & Networking
[email protected]			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N�rnberg
GF: F. Imend�rffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG N�rnberg)
Reviewed-by on v1 1/6
#4 lore raw

Re: [PATCH 1/6] blk-sysfs: Add 'chunk_sectors' to sysfs attributes

In reply to Hannes Reinecke
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Hannes" == Hannes Reinecke <[email protected]> writes:

Hannes> The queue limits already have a 'chunk_sectors' setting, so we Hannes> should be presenting it via sysfs.

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#13 lore raw

Re: [PATCH 4/6] block: Add 'zoned' sysfs queue attribute

In reply to Hannes Reinecke
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Hannes" == Hannes Reinecke <[email protected]> writes:

Hannes> Add a sysfs queue attribute 'zoned' to display the zone layout Hannes> for zoned devices.

Not quite one value per file :(

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#14 lore raw

Re: [PATCH 4/6] block: Add 'zoned' sysfs queue attribute

In reply to Martin K. Petersen
Quoted 7 lines · Martin K. Petersen
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Hannes" == Hannes Reinecke <[email protected]> writes:

Hannes> Add a sysfs queue attribute 'zoned' to display the zone layout Hannes> for zoned devices.

Not quite one value per file :(

Yes.
But I wanted to display the zone layout in a concise way allowing user-space programs to determine the zone layout without having to issue a 'REPORT ZONES' command themselves.
I found it slightly pointless to add one sysfs entry per zone, and at the same time a simple 'zone_size' attribute wouldn't cover all possibilities.

However, as SMR drives seem to stabilise around having a fixed zone size (with a possible exemption of the last zone to cover left-overs) I'd be fine a replace this with a single 'zone_size' attribute which could be set to eg '-1' for drives which indeed would implement variable zone sizes.

Cheers,

Hannes

Signature · 8 lines
Dr. Hannes Reinecke		      zSeries & Storage
[email protected]			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-block" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#15 lore raw

Re: [PATCH 4/6] block: Add 'zoned' sysfs queue attribute

Quoted 16 lines · Hannes Reinecke
Quoted 7 lines · Martin K. Petersen
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Hannes" == Hannes Reinecke <[email protected]> writes:

Hannes> Add a sysfs queue attribute 'zoned' to display the zone layout Hannes> for zoned devices.

Not quite one value per file :(

Yes.
But I wanted to display the zone layout in a concise way allowing user-space programs to determine the zone layout without having to issue a 'REPORT ZONES' command themselves.
I found it slightly pointless to add one sysfs entry per zone, and at the same time a simple 'zone_size' attribute wouldn't cover all possibilities.

Quoted 5 lines

However, as SMR drives seem to stabilise around having a fixed zone size (with a possible exemption of the last zone to cover left-overs) I'd be fine a replace this with a single 'zone_size' attribute which could be set to eg '-1' for drives which indeed would implement variable zone sizes.

It's not that hard to convert the information exported by queue_zoned_show() from a single sysfs attribute into one directory per zone. Doing so would make it much easier for scripts to parse that information and would also avoid that the zone information has to be truncated because not all of it fits into a single page.

Bart.

#16 lore raw

Re: [PATCH 4/6] block: Add 'zoned' sysfs queue attribute

Quoted 23 lines · Bart Van Assche
Quoted 16 lines · Hannes Reinecke
Quoted 7 lines · Martin K. Petersen
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Hannes" == Hannes Reinecke <[email protected]> writes:

Hannes> Add a sysfs queue attribute 'zoned' to display the zone layout Hannes> for zoned devices.

Not quite one value per file :(

Yes.
But I wanted to display the zone layout in a concise way allowing user-space programs to determine the zone layout without having to issue a 'REPORT ZONES' command themselves.
I found it slightly pointless to add one sysfs entry per zone, and at the same time a simple 'zone_size' attribute wouldn't cover all possibilities.

Quoted 5 lines

However, as SMR drives seem to stabilise around having a fixed zone size (with a possible exemption of the last zone to cover left-overs) I'd be fine a replace this with a single 'zone_size' attribute which could be set to eg '-1' for drives which indeed would implement variable zone sizes.

Quoted 6 lines

It's not that hard to convert the information exported by queue_zoned_show() from a single sysfs attribute into one directory per zone. Doing so would make it much easier for scripts to parse that information and would also avoid that the zone information has to be truncated because not all of it fits into a single page.

But this is precisely what I've tried to avoid.
Creating one file or directory per zone would mean we'll end up with rough 20k files/directories.
Which I found rather excessive.

Of course, it that is not a concern that I can easily convert it.

Cheers,

Hannes

Signature · 8 lines
Dr. Hannes Reinecke		      zSeries & Storage
[email protected]			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-block" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#17 lore raw

Re: [PATCH 4/6] block: Add 'zoned' sysfs queue attribute

Quoted 30 lines · Hannes Reinecke
Quoted 23 lines · Bart Van Assche
Quoted 16 lines · Hannes Reinecke
Quoted 7 lines · Martin K. Petersen
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Hannes" == Hannes Reinecke <[email protected]> writes:

Hannes> Add a sysfs queue attribute 'zoned' to display the zone layout Hannes> for zoned devices.

Not quite one value per file :(

Yes.
But I wanted to display the zone layout in a concise way allowing user-space programs to determine the zone layout without having to issue a 'REPORT ZONES' command themselves.
I found it slightly pointless to add one sysfs entry per zone, and at the same time a simple 'zone_size' attribute wouldn't cover all possibilities.

Quoted 5 lines

However, as SMR drives seem to stabilise around having a fixed zone size (with a possible exemption of the last zone to cover left-overs) I'd be fine a replace this with a single 'zone_size' attribute which could be set to eg '-1' for drives which indeed would implement variable zone sizes.

Quoted 6 lines

It's not that hard to convert the information exported by queue_zoned_show() from a single sysfs attribute into one directory per zone. Doing so would make it much easier for scripts to parse that information and would also avoid that the zone information has to be truncated because not all of it fits into a single page.

Quoted 6 lines

But this is precisely what I've tried to avoid.
Creating one file or directory per zone would mean we'll end up with rough 20k files/directories.
Which I found rather excessive.

Of course, it that is not a concern that I can easily convert it.

If there are 10K zones and since queue_zoned_show() is limited to one page then only a very small fraction of the zone information will be available through sysfs. I remember from your presentations that reading the zone information is slow. Is 10K zones a typical value or a worst case value?

Bart.

#18 lore raw

Re: [PATCH 4/6] block: Add 'zoned' sysfs queue attribute

Quoted 36 lines · Bart Van Assche
Quoted 35 lines · Hannes Reinecke
Quoted 23 lines · Bart Van Assche
Quoted 16 lines · Hannes Reinecke
Quoted 7 lines · Martin K. Petersen
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Hannes" == Hannes Reinecke <[email protected]> writes:

Hannes> Add a sysfs queue attribute 'zoned' to display the zone layout Hannes> for zoned devices.

Not quite one value per file :(

Yes.
But I wanted to display the zone layout in a concise way allowing user-space programs to determine the zone layout without having to issue a 'REPORT ZONES' command themselves.
I found it slightly pointless to add one sysfs entry per zone, and at the same time a simple 'zone_size' attribute wouldn't cover all possibilities.

Quoted 5 lines

However, as SMR drives seem to stabilise around having a fixed zone size (with a possible exemption of the last zone to cover left-overs) I'd be fine a replace this with a single 'zone_size' attribute which could be set to eg '-1' for drives which indeed would implement variable zone sizes.

Quoted 6 lines

It's not that hard to convert the information exported by queue_zoned_show() from a single sysfs attribute into one directory per zone. Doing so would make it much easier for scripts to parse that information and would also avoid that the zone information has to be truncated because not all of it fits into a single page.

But this is precisely what I've tried to avoid.
Creating one file or directory per zone would mean we'll end up with rough 20k files/directories.
Which I found rather excessive.

Quoted 7 lines
Quoted 1 line

Of course, it that is not a concern that I can easily convert it.

If there are 10K zones and since queue_zoned_show() is limited to one page then only a very small fraction of the zone information will be available through sysfs. I remember from your presentations that reading the zone information is slow. Is 10K zones a typical value or a worst case value?

(replying to my own e-mail)

Something I should have asked before: is the zone information intended for end users or rather for software developers? In the latter case, have you considered to use debugfs instead of sysfs to export this information? From Documentation/filesystems/debugfs.txt: "Unlike /proc, which is only meant for information about a process, or sysfs, which has strict one-value-per-file rules, debugfs has no rules at all."

Bart.

#22 lore raw

Re: [PATCH 4/6] block: Add 'zoned' sysfs queue attribute

In reply to Bart Van Assche

Bart,

Quoted 3 lines · Bart Van Assche

If there are 10K zones and since queue_zoned_show() is limited to one page then only a very small fraction of the zone information will be available through sysfs. I remember from your presentations that reading the zone information is slow. Is 10K zones a typical value or a worst case value?

Our 10 TB drive with 256 MB zones has 37256 zones. A drive with the same capacity and 128 MB zones will double that (there are some out there with 128 MB zones). And higher capacities are coming. So 100K+ zones is not unrealistic in the very near future.

I think that what Hannes proposed, i.e. to have the zoned file only specify the zone size (so only one value), is OK as long as we also add an ioctl to get the detailed zone information, which would be much faster for applications than using something like libzbc which will be sending SG_IOs to retrieve the zone information from the disk.

Best regards.

------------------------
Damien Le Moal, Ph.D.
Sr. Manager, System Software Group, HGST Research,
HGST, a Western Digital brand
[email protected]
(+81) 0466-98-3593 (ext. 513593)
1 kirihara-cho, Fujisawa,
Kanagawa, 252-0888 Japan
www.hgst.com
Western Digital Corporation (and its subsidiaries) E-mail Confidentiality Notice & Disclaimer:

This e-mail and any files transmitted with it may contain confidential or legally privileged information of WDC and/or its affiliates, and are intended solely for the use of the individual or entity to which they are addressed. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited. If you have received this e-mail in error, please notify the sender immediately and delete the e-mail in its entirety from your system.

#19 lore raw

Re: [PATCH 4/6] block: Add 'zoned' sysfs queue attribute

In reply to Bart Van Assche

Bart,

Quoted 3 lines · Bart Van Assche

Something I should have asked before: is the zone information intended for end users or rather for software developers? In the latter case, have you considered to use debugfs instead of sysfs to export this information? From Documentation/filesystems/debugfs.txt: "Unlike /proc, which is only meant for information about a process, or sysfs, which has strict one-value-per-file rules, debugfs has no rules at all."

I think that the zone information will definitively be of higher value for software developers rather than end users. But that information must be available at run time for things like mkfs.xxx and having to mount debugfs on a production system to be able to run mkfs on an SMR disk (or initialize an application using the raw block device) does not sound ideal.

Back to my previous reply, having the sysfs zoned file specifying just the disk zone size and having an ioctl to retrieve the detailed zone information looks to me much more sensible.

Best regards.

------------------------
Damien Le Moal, Ph.D.
Sr. Manager, System Software Group, HGST Research, HGST, a Western Digital brand [email protected]
(+81) 0466-98-3593 (ext. 513593)
1 kirihara-cho, Fujisawa,
Kanagawa, 252-0888 Japan
www.hgst.com

Western Digital Corporation (and its subsidiaries) E-mail Confidentiality Notice & Disclaimer:

This e-mail and any files transmitted with it may contain confidential or legally privileged information of WDC and/or its affiliates, and are intended solely for the use of the individual or entity to which they are addressed. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited. If you have received this e-mail in error, please notify the sender immediately and delete the e-mail in its entirety from your system.

#20 lore raw

Re: [PATCH 4/6] block: Add 'zoned' sysfs queue attribute

In reply to Bart Van Assche
Quoted 48 lines · Bart Van Assche
Quoted 39 lines · Bart Van Assche
Quoted 38 lines · Hannes Reinecke
Quoted 26 lines · Bart Van Assche
Quoted 17 lines · Hannes Reinecke
Quoted 8 lines · Martin K. Petersen
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Hannes" == Hannes Reinecke <[email protected]> writes:

Hannes> Add a sysfs queue attribute 'zoned' to display the zone layout
Hannes> for zoned devices.

Not quite one value per file :(

Yes.
But I wanted to display the zone layout in a concise way allowing user-space programs to determine the zone layout without having to issue a 'REPORT ZONES' command themselves.
I found it slightly pointless to add one sysfs entry per zone, and at the same time a simple 'zone_size' attribute wouldn't cover all possibilities.

Quoted 7 lines

However, as SMR drives seem to stabilise around having a fixed zone size
(with a possible exemption of the last zone to cover left-overs) I'd be fine a replace this with a single 'zone_size' attribute which could be set to eg '-1' for drives which indeed would implement variable
zone sizes.

Quoted 6 lines

It's not that hard to convert the information exported by queue_zoned_show() from a single sysfs attribute into one directory per zone. Doing so would make it much easier for scripts to parse that information and would also avoid that the zone information has to be truncated because not all of it fits into a single page.

But this is precisely what I've tried to avoid.
Creating one file or directory per zone would mean we'll end up with rough 20k files/directories.
Which I found rather excessive.

Quoted 7 lines
Quoted 1 line

Of course, it that is not a concern that I can easily convert it.

If there are 10K zones and since queue_zoned_show() is limited to one page then only a very small fraction of the zone information will be available through sysfs. I remember from your presentations that reading the zone information is slow. Is 10K zones a typical value or a worst case value?

Quoted 9 lines

(replying to my own e-mail)

Something I should have asked before: is the zone information intended for end users or rather for software developers? In the latter case, have you considered to use debugfs instead of sysfs to export this information? From Documentation/filesystems/debugfs.txt: "Unlike /proc, which is only meant for information about a process, or sysfs, which has strict one-value-per-file rules, debugfs has no rules at all."

I would be perfectly fine with exporting the zone information via debugfs. But at the same time I would like to have a simple sysfs representation for SMR drives which can be utilized by mkfs and friend. Typically SMR drives have a fixed zone size, and more often than not the size of the zones is identical.
So mkfs would benefit from knowing the fixed zone layout as it then can arrange the filesystem structures to align to those zones.
At the same time it doesn't need to know the write pointer, so full zone information is not required here.
And during normal operation ideally the zone information is handled within the kernel, so again userspace doesn't necessarily need to have access to the full zone information.

So I guess I'll redo this one to export a sysfs attribute 'zone_size' (if the zones are of identical size), and make the full zone information available via debugfs.

Cheers,

Hannes

Signature · 5 lines
Dr. Hannes Reinecke		   Teamlead Storage & Networking
[email protected]			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
maintainer
#23 lore raw

Re: [PATCH 4/6] block: Add 'zoned' sysfs queue attribute

In reply to Bart Van Assche
Quoted 38 lines · Bart Van Assche
Quoted 37 lines · Hannes Reinecke
Quoted 25 lines · Bart Van Assche
Quoted 16 lines · Hannes Reinecke
Quoted 7 lines · Martin K. Petersen
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Hannes" == Hannes Reinecke <[email protected]> writes:

Hannes> Add a sysfs queue attribute 'zoned' to display the zone layout Hannes> for zoned devices.

Not quite one value per file :(

Yes.
But I wanted to display the zone layout in a concise way allowing user-space programs to determine the zone layout without having to issue a 'REPORT ZONES' command themselves.
I found it slightly pointless to add one sysfs entry per zone, and at the same time a simple 'zone_size' attribute wouldn't cover all possibilities.

Quoted 7 lines

However, as SMR drives seem to stabilise around having a fixed zone size
(with a possible exemption of the last zone to cover left-overs) I'd be fine a replace this with a single 'zone_size' attribute which could be set to eg '-1' for drives which indeed would implement variable
zone sizes.

Quoted 6 lines

It's not that hard to convert the information exported by queue_zoned_show() from a single sysfs attribute into one directory per zone. Doing so would make it much easier for scripts to parse that information and would also avoid that the zone information has to be truncated because not all of it fits into a single page.

But this is precisely what I've tried to avoid.
Creating one file or directory per zone would mean we'll end up with rough 20k files/directories.
Which I found rather excessive.

Quoted 7 lines
Quoted 1 line

Of course, it that is not a concern that I can easily convert it.

If there are 10K zones and since queue_zoned_show() is limited to one page then only a very small fraction of the zone information will be available through sysfs. I remember from your presentations that reading the zone information is slow. Is 10K zones a typical value or a worst case value?

Just kill the sysfs file, it's useless for many zones. Either have the application use some library to provide the information, or use bsg and similar to get it.

Signature · 1 line
Jens Axboe
maintainer
#21 lore raw

Re: [PATCH 4/6] block: Add 'zoned' sysfs queue attribute

In reply to Hannes Reinecke
Quoted 58 lines · Hannes Reinecke
Quoted 48 lines · Bart Van Assche
Quoted 39 lines · Bart Van Assche
Quoted 38 lines · Hannes Reinecke
Quoted 26 lines · Bart Van Assche
Quoted 17 lines · Hannes Reinecke
Quoted 8 lines · Martin K. Petersen
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Hannes" == Hannes Reinecke <[email protected]> writes:

Hannes> Add a sysfs queue attribute 'zoned' to display the zone layout
Hannes> for zoned devices.

Not quite one value per file :(

Yes.
But I wanted to display the zone layout in a concise way allowing user-space programs to determine the zone layout without having to issue a 'REPORT ZONES' command themselves.
I found it slightly pointless to add one sysfs entry per zone, and at the same time a simple 'zone_size' attribute wouldn't cover all possibilities.

Quoted 7 lines

However, as SMR drives seem to stabilise around having a fixed zone size
(with a possible exemption of the last zone to cover left-overs) I'd be fine a replace this with a single 'zone_size' attribute which could be set to eg '-1' for drives which indeed would implement variable
zone sizes.

Quoted 6 lines

It's not that hard to convert the information exported by queue_zoned_show() from a single sysfs attribute into one directory per zone. Doing so would make it much easier for scripts to parse that information and would also avoid that the zone information has to be truncated because not all of it fits into a single page.

But this is precisely what I've tried to avoid.
Creating one file or directory per zone would mean we'll end up with rough 20k files/directories.
Which I found rather excessive.

Quoted 7 lines
Quoted 1 line

Of course, it that is not a concern that I can easily convert it.

If there are 10K zones and since queue_zoned_show() is limited to one page then only a very small fraction of the zone information will be available through sysfs. I remember from your presentations that reading the zone information is slow. Is 10K zones a typical value or a worst case value?

Quoted 9 lines

(replying to my own e-mail)

Something I should have asked before: is the zone information intended for end users or rather for software developers? In the latter case, have you considered to use debugfs instead of sysfs to export this information? From Documentation/filesystems/debugfs.txt: "Unlike /proc, which is only meant for information about a process, or sysfs, which has strict one-value-per-file rules, debugfs has no rules at all."

Quoted 3 lines

I would be perfectly fine with exporting the zone information via debugfs. But at the same time I would like to have a simple sysfs representation for SMR drives which can be utilized by mkfs and friend.

Then provide a real interface, through a library. Don't expose tons of zones through sysfs, and expect applications to parse that. That's silly.

Signature · 1 line
Jens Axboe