Skip to contentSkip to conversation

block: export SSD/non-rotational queue flag through sysfs

PATCH Applied Bartlomiej Zolnierkiewicz 12 participants 28 messages Jan 5, 2009 – Feb 3, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block: export SSD/non-rotational queue flag through sysfs

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] block: export SSD/non-rotational queue flag through sysfs

For some devices (i.e. CFA ATA) we can't reliably detect whether the device is of rotational or non-rotational type so we need to leave the final decision about this setting to the user-space.

---
 block/blk-sysfs.c |   30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)
block/blk-sysfs.c +29 -1
Index: b/block/blk-sysfs.c
===================================================================
@@ -130,6 +130,27 @@ static ssize_t queue_max_hw_sectors_show
 	return queue_var_show(max_hw_sectors_kb, (page));
 }
 
+static ssize_t queue_nonrot_show(struct request_queue *q, char *page)
+{
+	return queue_var_show(blk_queue_nonrot(q), page);
+}
+
+static ssize_t queue_nonrot_store(struct request_queue *q, const char *page,
+				  size_t count)
+{
+	unsigned long nm;
+	ssize_t ret = queue_var_store(&nm, page, count);
+
+	spin_lock_irq(q->queue_lock);
+	if (nm)
+		queue_flag_set(QUEUE_FLAG_NONROT, q);
+	else
+		queue_flag_clear(QUEUE_FLAG_NONROT, q);
+	spin_unlock_irq(q->queue_lock);
+
+	return ret;
+}
+
 static ssize_t queue_nomerges_show(struct request_queue *q, char *page)
 {
 	return queue_var_show(blk_queue_nomerges(q), page);
@@ -146,8 +167,8 @@ static ssize_t queue_nomerges_store(stru
 		queue_flag_set(QUEUE_FLAG_NOMERGES, q);
 	else
 		queue_flag_clear(QUEUE_FLAG_NOMERGES, q);
-
 	spin_unlock_irq(q->queue_lock);
+
 	return ret;
 }
 
@@ -210,6 +231,12 @@ static struct queue_sysfs_entry queue_hw
 	.show = queue_hw_sector_size_show,
 };
 
+static struct queue_sysfs_entry queue_nonrot_entry = {
+	.attr = {.name = "nonrot", .mode = S_IRUGO | S_IWUSR },
+	.show = queue_nonrot_show,
+	.store = queue_nonrot_store,
+};
+
 static struct queue_sysfs_entry queue_nomerges_entry = {
 	.attr = {.name = "nomerges", .mode = S_IRUGO | S_IWUSR },
 	.show = queue_nomerges_show,
@@ -229,6 +256,7 @@ static struct attribute *default_attrs[]
 	&queue_max_sectors_entry.attr,
 	&queue_iosched_entry.attr,
 	&queue_hw_sector_size_entry.attr,
+	&queue_nonrot_entry.attr,
 	&queue_nomerges_entry.attr,
 	&queue_rq_affinity_entry.attr,
 	NULL,

#1 lore raw
Quoted 6 lines · Bartlomiej Zolnierkiewicz

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] block: export SSD/non-rotational queue flag through sysfs

For some devices (i.e. CFA ATA) we can't reliably detect whether the device is of rotational or non-rotational type so we need to leave the final decision about this setting to the user-space.

I agree with that, was actually planning on doing that myself.

Review static ssize_t queue_nomerges_store(stru · line 174

Quoted 10 lines
(quoted diff) +1 -1
@@ -146,8 +167,8 @@ static ssize_t queue_nomerges_store(stru
 		queue_flag_set(QUEUE_FLAG_NOMERGES, q);
 	else
 		queue_flag_clear(QUEUE_FLAG_NOMERGES, q);
-
 	spin_unlock_irq(q->queue_lock);
+
 	return ret;
 }
 

Hmm?

Review static struct queue_sysfs_entry queue_hw · line 239

Quoted 10 lines
(quoted diff) +6 -0
@@ -210,6 +231,12 @@ static struct queue_sysfs_entry queue_hw
 	.show = queue_hw_sector_size_show,
 };
 
+static struct queue_sysfs_entry queue_nonrot_entry = {
+	.attr = {.name = "nonrot", .mode = S_IRUGO | S_IWUSR },
+	.show = queue_nonrot_show,
+	.store = queue_nonrot_store,
+};
+

Lets please use a better name for export reasons, non-rotational is a lot better. Nobody will know what nonrot means :-)

Signature · 1 line
Jens Axboe
#2 lore raw
Quoted 10 lines · Jens Axboe
Quoted 6 lines · Bartlomiej Zolnierkiewicz

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] block: export SSD/non-rotational queue flag through sysfs

For some devices (i.e. CFA ATA) we can't reliably detect whether the device is of rotational or non-rotational type so we need to leave the final decision about this setting to the user-space.

I agree with that, was actually planning on doing that myself.

Quoted 12 lines

Review static ssize_t queue_nomerges_store(stru · line 174

Quoted 10 lines
(quoted diff) +1 -1
@@ -146,8 +167,8 @@ static ssize_t queue_nomerges_store(stru
 		queue_flag_set(QUEUE_FLAG_NOMERGES, q);
 	else
 		queue_flag_clear(QUEUE_FLAG_NOMERGES, q);
-
 	spin_unlock_irq(q->queue_lock);
+
 	return ret;
 }
 

Hmm?

This is just a "bonus". :)

Quoted 4 lines
Quoted 4 lines
(quoted diff) +0 -0
@@ -210,6 +231,12 @@ static struct queue_sysfs_entry queue_hw
 	.show = queue_hw_sector_size_show,
 };
 
Quoted 9 lines

Review static struct queue_sysfs_entry queue_hw · line 239

Quoted 6 lines
(quoted diff) +6 -0
+static struct queue_sysfs_entry queue_nonrot_entry = {
+	.attr = {.name = "nonrot", .mode = S_IRUGO | S_IWUSR },
+	.show = queue_nonrot_show,
+	.store = queue_nonrot_store,
+};
+

Lets please use a better name for export reasons, non-rotational is a lot better. Nobody will know what nonrot means :-)

Yeah...

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH v2] block: export SSD/non-rotational queue flag through sysfs

For some devices (i.e. CFA ATA) we can't reliably detect whether the device is of rotational or non-rotational type so we need to leave the final decision about this setting to the user-space.

As a bonus do a minor CodingStyle fixup in queue_nomerges_store().

---
 block/blk-sysfs.c |   30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)
block/blk-sysfs.c +29 -1
Index: b/block/blk-sysfs.c
===================================================================
@@ -130,6 +130,27 @@ static ssize_t queue_max_hw_sectors_show
 	return queue_var_show(max_hw_sectors_kb, (page));
 }
 
+static ssize_t queue_nonrot_show(struct request_queue *q, char *page)
+{
+	return queue_var_show(blk_queue_nonrot(q), page);
+}
+
+static ssize_t queue_nonrot_store(struct request_queue *q, const char *page,
+				  size_t count)
+{
+	unsigned long nm;
+	ssize_t ret = queue_var_store(&nm, page, count);
+
+	spin_lock_irq(q->queue_lock);
+	if (nm)
+		queue_flag_set(QUEUE_FLAG_NONROT, q);
+	else
+		queue_flag_clear(QUEUE_FLAG_NONROT, q);
+	spin_unlock_irq(q->queue_lock);
+
+	return ret;
+}
+
 static ssize_t queue_nomerges_show(struct request_queue *q, char *page)
 {
 	return queue_var_show(blk_queue_nomerges(q), page);
@@ -146,8 +167,8 @@ static ssize_t queue_nomerges_store(stru
 		queue_flag_set(QUEUE_FLAG_NOMERGES, q);
 	else
 		queue_flag_clear(QUEUE_FLAG_NOMERGES, q);
-
 	spin_unlock_irq(q->queue_lock);
+
 	return ret;
 }
 
@@ -210,6 +231,12 @@ static struct queue_sysfs_entry queue_hw
 	.show = queue_hw_sector_size_show,
 };
 
+static struct queue_sysfs_entry queue_nonrot_entry = {
+	.attr = {.name = "non-rotational", .mode = S_IRUGO | S_IWUSR },
+	.show = queue_nonrot_show,
+	.store = queue_nonrot_store,
+};
+
 static struct queue_sysfs_entry queue_nomerges_entry = {
 	.attr = {.name = "nomerges", .mode = S_IRUGO | S_IWUSR },
 	.show = queue_nomerges_show,
@@ -229,6 +256,7 @@ static struct attribute *default_attrs[]
 	&queue_max_sectors_entry.attr,
 	&queue_iosched_entry.attr,
 	&queue_hw_sector_size_entry.attr,
+	&queue_nonrot_entry.attr,
 	&queue_nomerges_entry.attr,
 	&queue_rq_affinity_entry.attr,
 	NULL,
#3 lore raw
Quoted 113 lines · Bartlomiej Zolnierkiewicz
Quoted 10 lines · Jens Axboe
Quoted 6 lines · Bartlomiej Zolnierkiewicz

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] block: export SSD/non-rotational queue flag through sysfs

For some devices (i.e. CFA ATA) we can't reliably detect whether the device is of rotational or non-rotational type so we need to leave the final decision about this setting to the user-space.

I agree with that, was actually planning on doing that myself.

Quoted 12 lines

block/blk-sysfs.c static ssize_t queue_nomerges_store(stru · line 174

Quoted 10 lines
block/blk-sysfs.c +1 -1
@@ -146,8 +167,8 @@ static ssize_t queue_nomerges_store(stru
 		queue_flag_set(QUEUE_FLAG_NOMERGES, q);
 	else
 		queue_flag_clear(QUEUE_FLAG_NOMERGES, q);
-
 	spin_unlock_irq(q->queue_lock);
+
 	return ret;
 }
 

Hmm?

This is just a "bonus". :)

Quoted 4 lines
Quoted 4 lines
block/blk-sysfs.c +0 -0
@@ -210,6 +231,12 @@ static struct queue_sysfs_entry queue_hw
 	.show = queue_hw_sector_size_show,
 };
 
Quoted 9 lines

block/blk-sysfs.c static struct queue_sysfs_entry queue_hw · line 239

Quoted 6 lines
block/blk-sysfs.c +6 -0
+static struct queue_sysfs_entry queue_nonrot_entry = {
+	.attr = {.name = "nonrot", .mode = S_IRUGO | S_IWUSR },
+	.show = queue_nonrot_show,
+	.store = queue_nonrot_store,
+};
+

Lets please use a better name for export reasons, non-rotational is a lot better. Nobody will know what nonrot means :-)

Yeah...

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH v2] block: export SSD/non-rotational queue flag through sysfs

For some devices (i.e. CFA ATA) we can't reliably detect whether the device is of rotational or non-rotational type so we need to leave the final decision about this setting to the user-space.

As a bonus do a minor CodingStyle fixup in queue_nomerges_store().

---
 block/blk-sysfs.c |   30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

Index: b/block/blk-sysfs.c
===================================================================

block/blk-sysfs.c +28 -1
@@ -130,6 +130,27 @@ static ssize_t queue_max_hw_sectors_show
 	return queue_var_show(max_hw_sectors_kb, (page));
 }
 
+static ssize_t queue_nonrot_show(struct request_queue *q, char *page)
+{
+	return queue_var_show(blk_queue_nonrot(q), page);
+}
+
+static ssize_t queue_nonrot_store(struct request_queue *q, const char *page,
+				  size_t count)
+{
+	unsigned long nm;
+	ssize_t ret = queue_var_store(&nm, page, count);
+
+	spin_lock_irq(q->queue_lock);
+	if (nm)
+		queue_flag_set(QUEUE_FLAG_NONROT, q);
+	else
+		queue_flag_clear(QUEUE_FLAG_NONROT, q);
+	spin_unlock_irq(q->queue_lock);
+
+	return ret;
+}
+
 static ssize_t queue_nomerges_show(struct request_queue *q, char *page)
 {
 	return queue_var_show(blk_queue_nomerges(q), page);
@@ -146,8 +167,8 @@ static ssize_t queue_nomerges_store(stru
 		queue_flag_set(QUEUE_FLAG_NOMERGES, q);
 	else
 		queue_flag_clear(QUEUE_FLAG_NOMERGES, q);
-
 	spin_unlock_irq(q->queue_lock);
+
 	return ret;
 }
 
@@ -210,6 +231,12 @@ static struct queue_sysfs_entry queue_hw
 	.show = queue_hw_sector_size_show,
 };
 
+static struct queue_sysfs_entry queue_nonrot_entry = {
+	.attr = {.name = "non-rotational", .mode = S_IRUGO | S_IWUSR },
+	.show = queue_nonrot_show,
+	.store = queue_nonrot_store,
+};
+
 static struct queue_sysfs_entry queue_nomerges_entry = {
 	.attr = {.name = "nomerges", .mode = S_IRUGO | S_IWUSR },
 	.show = queue_nomerges_show,

block/blk-sysfs.c static struct attribute *default_attrs[] · line 262

Quoted 7 lines
block/blk-sysfs.c +1 -0
@@ -229,6 +256,7 @@ static struct attribute *default_attrs[]
 	&queue_max_sectors_entry.attr,
 	&queue_iosched_entry.attr,
 	&queue_hw_sector_size_entry.attr,
+	&queue_nonrot_entry.attr,
 	&queue_nomerges_entry.attr,
 	&queue_rq_affinity_entry.attr,
 	NULL,

Almost all block devices might find this useful. Ought not this flag to be in the block layer appearing under /sys/block/<dev>?

James

#4 lore raw
Quoted 116 lines · James Bottomley
Quoted 115 lines · Bartlomiej Zolnierkiewicz
Quoted 10 lines · Jens Axboe
Quoted 6 lines · Bartlomiej Zolnierkiewicz

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] block: export SSD/non-rotational queue flag through sysfs

For some devices (i.e. CFA ATA) we can't reliably detect whether the device is of rotational or non-rotational type so we need to leave the final decision about this setting to the user-space.

I agree with that, was actually planning on doing that myself.

Quoted 12 lines

block/blk-sysfs.c static ssize_t queue_nomerges_store(stru · line 174

Quoted 10 lines
block/blk-sysfs.c +1 -1
@@ -146,8 +167,8 @@ static ssize_t queue_nomerges_store(stru
 		queue_flag_set(QUEUE_FLAG_NOMERGES, q);
 	else
 		queue_flag_clear(QUEUE_FLAG_NOMERGES, q);
-
 	spin_unlock_irq(q->queue_lock);
+
 	return ret;
 }
 

Hmm?

This is just a "bonus". :)

Quoted 4 lines
Quoted 4 lines
block/blk-sysfs.c +0 -0
@@ -210,6 +231,12 @@ static struct queue_sysfs_entry queue_hw
 	.show = queue_hw_sector_size_show,
 };
 
Quoted 9 lines

block/blk-sysfs.c static struct queue_sysfs_entry queue_hw · line 239

Quoted 6 lines
block/blk-sysfs.c +6 -0
+static struct queue_sysfs_entry queue_nonrot_entry = {
+	.attr = {.name = "nonrot", .mode = S_IRUGO | S_IWUSR },
+	.show = queue_nonrot_show,
+	.store = queue_nonrot_store,
+};
+

Lets please use a better name for export reasons, non-rotational is a lot better. Nobody will know what nonrot means :-)

Yeah...

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH v2] block: export SSD/non-rotational queue flag through sysfs

For some devices (i.e. CFA ATA) we can't reliably detect whether the device is of rotational or non-rotational type so we need to leave the final decision about this setting to the user-space.

As a bonus do a minor CodingStyle fixup in queue_nomerges_store().

---
 block/blk-sysfs.c |   30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

Index: b/block/blk-sysfs.c
===================================================================

block/blk-sysfs.c +28 -1
@@ -130,6 +130,27 @@ static ssize_t queue_max_hw_sectors_show
 	return queue_var_show(max_hw_sectors_kb, (page));
 }
 
+static ssize_t queue_nonrot_show(struct request_queue *q, char *page)
+{
+	return queue_var_show(blk_queue_nonrot(q), page);
+}
+
+static ssize_t queue_nonrot_store(struct request_queue *q, const char *page,
+				  size_t count)
+{
+	unsigned long nm;
+	ssize_t ret = queue_var_store(&nm, page, count);
+
+	spin_lock_irq(q->queue_lock);
+	if (nm)
+		queue_flag_set(QUEUE_FLAG_NONROT, q);
+	else
+		queue_flag_clear(QUEUE_FLAG_NONROT, q);
+	spin_unlock_irq(q->queue_lock);
+
+	return ret;
+}
+
 static ssize_t queue_nomerges_show(struct request_queue *q, char *page)
 {
 	return queue_var_show(blk_queue_nomerges(q), page);
@@ -146,8 +167,8 @@ static ssize_t queue_nomerges_store(stru
 		queue_flag_set(QUEUE_FLAG_NOMERGES, q);
 	else
 		queue_flag_clear(QUEUE_FLAG_NOMERGES, q);
-
 	spin_unlock_irq(q->queue_lock);
+
 	return ret;
 }
 
@@ -210,6 +231,12 @@ static struct queue_sysfs_entry queue_hw
 	.show = queue_hw_sector_size_show,
 };
 
+static struct queue_sysfs_entry queue_nonrot_entry = {
+	.attr = {.name = "non-rotational", .mode = S_IRUGO | S_IWUSR },
+	.show = queue_nonrot_show,
+	.store = queue_nonrot_store,
+};
+
 static struct queue_sysfs_entry queue_nomerges_entry = {
 	.attr = {.name = "nomerges", .mode = S_IRUGO | S_IWUSR },
 	.show = queue_nomerges_show,
@@ -229,6 +256,7 @@ static struct attribute *default_attrs[]
 	&queue_max_sectors_entry.attr,
 	&queue_iosched_entry.attr,
Quoted 8 lines

block/blk-sysfs.c static struct attribute *default_attrs[] · line 262

Quoted 5 lines
block/blk-sysfs.c +1 -0
 	&queue_hw_sector_size_entry.attr,
+	&queue_nonrot_entry.attr,
 	&queue_nomerges_entry.attr,
 	&queue_rq_affinity_entry.attr,
 	NULL,

Almost all block devices might find this useful. Ought not this flag to be in the block layer appearing under /sys/block/<dev>?

The block layer only uses it for scheduling purposes, in which case it fits well in queue/ since you need the io scheduler.

Signature · 1 line
Jens Axboe
Applied
#5 lore raw
In reply to Bartlomiej Zolnierkiewicz
Quoted 24 lines · Bartlomiej Zolnierkiewicz
Quoted 10 lines · Jens Axboe
Quoted 6 lines · Bartlomiej Zolnierkiewicz

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] block: export SSD/non-rotational queue flag through sysfs

For some devices (i.e. CFA ATA) we can't reliably detect whether the device is of rotational or non-rotational type so we need to leave the final decision about this setting to the user-space.

I agree with that, was actually planning on doing that myself.

Quoted 12 lines

block/blk-sysfs.c static ssize_t queue_nomerges_store(stru · line 174

Quoted 10 lines
block/blk-sysfs.c +1 -1
@@ -146,8 +167,8 @@ static ssize_t queue_nomerges_store(stru
 		queue_flag_set(QUEUE_FLAG_NOMERGES, q);
 	else
 		queue_flag_clear(QUEUE_FLAG_NOMERGES, q);
-
 	spin_unlock_irq(q->queue_lock);
+
 	return ret;
 }
 

Hmm?

Quoted 1 line

This is just a "bonus". :)

I typically prefer a line in-between, but apparently blk-sysfs uses the other style, so it's good to at least be consistent locally :-)

I've applied the updated patch, thanks!

Signature · 1 line
Jens Axboe
#6 lore raw
In reply to Jens Axboe
Quoted 11 lines · Jens Axboe

Review

Quoted 6 lines · Bartlomiej Zolnierkiewicz
(quoted diff) +6 -0
+static struct queue_sysfs_entry queue_nonrot_entry = {
+     .attr = {.name = "nonrot", .mode = S_IRUGO | S_IWUSR },
+     .show = queue_nonrot_show,
+     .store = queue_nonrot_store,
+};
+

Lets please use a better name for export reasons, non-rotational is a lot better. Nobody will know what nonrot means :-)

What's that negation good for? Can't we just have "rotational", like we have "removable" and not "non-removable"? :)

Thanks?
Kay

#7 lore raw
Quoted 13 lines · Kay Sievers
Quoted 11 lines · Jens Axboe

Review

Quoted 6 lines · Bartlomiej Zolnierkiewicz
(quoted diff) +6 -0
+static struct queue_sysfs_entry queue_nonrot_entry = {
+     .attr = {.name = "nonrot", .mode = S_IRUGO | S_IWUSR },
+     .show = queue_nonrot_show,
+     .store = queue_nonrot_store,
+};
+

Lets please use a better name for export reasons, non-rotational is a lot better. Nobody will know what nonrot means :-)

Quoted 2 lines

What's that negation good for? Can't we just have "rotational", like we have "removable" and not "non-removable"? :)

Non-rotational is the term typically used, since rotational is the norm (still). So I think the negation actually makes sense in this case :-)

Signature · 1 line
Jens Axboe
#8 lore raw
Quoted 11 lines · Jens Axboe
Quoted 10 lines · Kay Sievers
Quoted 9 lines · Jens Axboe

Review

Quoted 6 lines · Bartlomiej Zolnierkiewicz
(quoted diff) +6 -0
+static struct queue_sysfs_entry queue_nonrot_entry = {
+     .attr = {.name = "nonrot", .mode = S_IRUGO | S_IWUSR },
+     .show = queue_nonrot_show,
+     .store = queue_nonrot_store,
+};
+

Lets please use a better name for export reasons, non-rotational is a lot better. Nobody will know what nonrot means :-)

Quoted 5 lines
Quoted 2 lines

What's that negation good for? Can't we just have "rotational", like we have "removable" and not "non-removable"? :)

Non-rotational is the term typically used, since rotational is the norm (still). So I think the negation actually makes sense in this case :-)

You used the word "still" yourself. I mean, in 5 years SSD will be more common than rotational media, and "the norm" will be !rotational.. So let's name them correctly and uniformly from the beginning.. ;)

/mjt

#9 lore raw
Quoted 15 lines · Michael Tokarev
Quoted 14 lines · Jens Axboe
Quoted 12 lines · Kay Sievers
Quoted 9 lines · Jens Axboe

Review

Quoted 6 lines · Bartlomiej Zolnierkiewicz
(quoted diff) +6 -0
+static struct queue_sysfs_entry queue_nonrot_entry = {
+     .attr = {.name = "nonrot", .mode = S_IRUGO | S_IWUSR },
+     .show = queue_nonrot_show,
+     .store = queue_nonrot_store,
+};
+

Lets please use a better name for export reasons, non-rotational is a lot better. Nobody will know what nonrot means :-)

What's that negation good for? Can't we just have "rotational", like we have "removable" and not "non-removable"? :)

Quoted 6 lines
Quoted 2 lines

Non-rotational is the term typically used, since rotational is the norm (still). So I think the negation actually makes sense in this case :-)

You used the word "still" yourself. I mean, in 5 years SSD will be more common than rotational media, and "the norm" will be !rotational.. So let's name them correctly and uniformly from the beginning.. ;)

Not sure I agree with your SSD adoption rate, but that's beside the point :-)

But I'm inclined to agree with you and Kay after all, lets just call it 'rotational'. I think alternatives like 'cheapseek' are truly horrible, nobody will know what that means - how cheap is cheap?

I'll fixup the patch.

Signature · 1 line
Jens Axboe
#10 lore raw
In reply to Michael Tokarev
Quoted 15 lines · Michael Tokarev
Quoted 14 lines · Jens Axboe
Quoted 12 lines · Kay Sievers
Quoted 9 lines · Jens Axboe

Review

Quoted 6 lines · Bartlomiej Zolnierkiewicz
(quoted diff) +6 -0
+static struct queue_sysfs_entry queue_nonrot_entry = {
+     .attr = {.name = "nonrot", .mode = S_IRUGO | S_IWUSR },
+     .show = queue_nonrot_show,
+     .store = queue_nonrot_store,
+};
+

Lets please use a better name for export reasons, non-rotational is a lot better. Nobody will know what nonrot means :-)

What's that negation good for? Can't we just have "rotational", like we have "removable" and not "non-removable"? :)

Quoted 6 lines
Quoted 2 lines

Non-rotational is the term typically used, since rotational is the norm (still). So I think the negation actually makes sense in this case :-)

You used the word "still" yourself. I mean, in 5 years SSD will be more common than rotational media, and "the norm" will be !rotational.. So let's name them correctly and uniformly from the beginning.. ;)

I'm afraid that's pretty much marketing coolaid. Rotational storage will dominate for the forseeable future: just do a simple back of the envelope calculation:

* Total shipped spinning storage in 2008: 128EB (Gartner figures)
* If all the chip FABs in all the world were turned solely to flash production, they'd be able to ship about 16EB per year (or about 13% of the total 2008 consumption [estimate from Steve Hetzler, IBM]), assuming any given FAB can produce about 0.5EB per year).
* Then factor in that storage requirements are growing exponentially (the 2009 estimated requirement is 400EB).
* Given that it costs ~$3-7bn for one fab plant and that we're in an economic depression, no-one is making the necessary trillion dollar capital investment to even make Flash be a significant fraction of the current storage market ... it's not even clear that it will be able to break the 1% barrier, let alone the 10% one.

That's not to say flash isn't important, it is; it's just to remind everyone that storage subsystems will be focused on rotating media. Any flash features we add have to make sure they don't impact our rotating performance.

Sorry, now we can go back to regularly scheduled programming. This isn't the first "everything will be flash and we should be planning for it" type statement, but I thought a little reality injection would be appropriate at this juncture.

James

#11 lore raw

Hello,

Quoted 3 lines · James Bottomley

I'm afraid that's pretty much marketing coolaid. Rotational storage will dominate for the forseeable future: just do a simple back of the envelope calculation:

Or just compare prices per byte of memory, flash and rotation disk. They haven't had changed too much during last several years. Secondary storage which is only slightly cheaper than the primary storage doesn't have much chance of flying high and far.

Thanks.

Signature · 1 line
tejun
#12 lore raw
Quoted 12 lines · Tejun Heo

Hello,

Quoted 3 lines · James Bottomley

I'm afraid that's pretty much marketing coolaid. Rotational storage will dominate for the forseeable future: just do a simple back of the envelope calculation:

Or just compare prices per byte of memory, flash and rotation disk. They haven't had changed too much during last several years. Secondary storage which is only slightly cheaper than the primary storage doesn't have much chance of flying high and far.

Quoted 4 lines

Thanks.

--
tejun

Have you seen the new pricing Samsung has announced for their 3rd generation SSD. It is about 1/3 of the Intel' SSD price if I recall correctly and the performance is approaching Intel's from what I've seen.

I've been talking to the OpenHSM (Hierachical Storage Manager) team about their project. They are working on getting the logic in place now to move data blocks from one class of storage to another while leaving the filesystem itself un-affected from the users perspective.

http://code.google.com/p/fscops/

They have a very long way to go with their code/project, but it is conceptually similar to the ext4_defrag patch that already exists. The big difference is the data block allocation algorithm will have to be totally different.

If and when that get their code done, I would love to have 500 GB of SSD teamed with several TB of rotational HDD and have the HSM move my files between fast SSD and slow rotational. I typically know which datasets I will be working with heavily, so even a simple user space tool that would let me adjust which tier of storage my files were sitting on would suffice.

Greg

Signature · 9 lines
Greg Freemyer
Litigation Triage Solutions Specialist
http://www.linkedin.com/in/gregfreemyer
First 99 Days Litigation White Paper -
http://www.norcrossgroup.com/forms/whitepapers/99%20Days%20whitepaper.pdf

The Norcross Group
The Intersection of Evidence & Technology
http://www.norcrossgroup.com
#13 lore raw
Quoted 2 lines · Greg Freemyer
Quoted 2 lines

Or just compare prices per byte of memory, flash and rotation disk. They haven't had changed too much during last several years.

I meant the ratio of prices here.

Quoted 8 lines
Quoted 3 lines

Secondary storage which is only slightly cheaper than the primary storage doesn't have much chance of flying high and far. tejun

Have you seen the new pricing Samsung has announced for their 3rd generation SSD. It is about 1/3 of the Intel' SSD price if I recall correctly and the performance is approaching Intel's from what I've seen.

I compare the prices from time to time (about once a year I think) and the difference has been usually much higher than 20 times if my memory serves me right. Intel SSDs are on pretty expensive side, even 1/3 of that price means > 20 times price difference per byte. If you compare that price with main memory, it's only ~3.5 times cheaper.

Quoted 12 lines

I've been talking to the OpenHSM (Hierachical Storage Manager) team about their project. They are working on getting the logic in place now to move data blocks from one class of storage to another while leaving the filesystem itself un-affected from the users perspective.

http://code.google.com/p/fscops/

They have a very long way to go with their code/project, but it is conceptually similar to the ext4_defrag patch that already exists. The big difference is the data block allocation algorithm will have to be totally different.

Quoted 6 lines

If and when that get their code done, I would love to have 500 GB of SSD teamed with several TB of rotational HDD and have the HSM move my files between fast SSD and slow rotational. I typically know which datasets I will be working with heavily, so even a simple user space tool that would let me adjust which tier of storage my files were sitting on would suffice.

I'd love that too. For areas where data size doesn't grow exponentially, it is and will continue to be great and be getting even better, but I'm just not sure whether it will rise as the mainstream secondary storage in foreseeable future given the price discrepancy but I'll be happy to be taken by surprise. :-)

Thanks.

Signature · 1 line
tejun
#14 lore raw
In reply to Greg Freemyer
Quoted 15 lines · Greg Freemyer
Quoted 14 lines · Tejun Heo

Hello,

Quoted 3 lines · James Bottomley

I'm afraid that's pretty much marketing coolaid. Rotational storage will dominate for the forseeable future: just do a simple back of the envelope calculation:

Or just compare prices per byte of memory, flash and rotation disk. They haven't had changed too much during last several years. Secondary storage which is only slightly cheaper than the primary storage doesn't have much chance of flying high and far.

Thanks.

Quoted 7 lines
Quoted 2 lines

--
tejun

Have you seen the new pricing Samsung has announced for their 3rd generation SSD. It is about 1/3 of the Intel' SSD price if I recall correctly and the performance is approaching Intel's from what I've seen.

I think the point Tejun and I are trying to make is that current SSD pricing is an artefact of the fact that there's currently a world surplus of flash components and that today SSD production is tiny. If SSD production rises, the demand pressure will force flash prices back to normal (or even above if manufacturers can charge a premium) and you'll see SSDs priced much higher than rotational storage.

That's not to say that no-one should be buying todays cheap flash storage ... just a warning that it can't last if SSDs become hugely popular.

Quoted 12 lines

I've been talking to the OpenHSM (Hierachical Storage Manager) team about their project. They are working on getting the logic in place now to move data blocks from one class of storage to another while leaving the filesystem itself un-affected from the users perspective.

http://code.google.com/p/fscops/

They have a very long way to go with their code/project, but it is conceptually similar to the ext4_defrag patch that already exists. The big difference is the data block allocation algorithm will have to be totally different.

Quoted 6 lines

If and when that get their code done, I would love to have 500 GB of SSD teamed with several TB of rotational HDD and have the HSM move my files between fast SSD and slow rotational. I typically know which datasets I will be working with heavily, so even a simple user space tool that would let me adjust which tier of storage my files were sitting on would suffice.

Right, this is the flash cache idea that's been floating around for a while. It's even been suggested as a way of avoiding the IDE barrier flush penalties. I think Seagate went as far as making hybrid drives that were a large flash cache backed by rotational storage.

James

#15 lore raw

On Thu, Jan 15, 2009 at 8:06 AM, James Bottomley
<[email protected]> wrote:
...

Quoted 4 lines

Right, this is the flash cache idea that's been floating around for a while. It's even been suggested as a way of avoiding the IDE barrier flush penalties. I think Seagate went as far as making hybrid drives that were a large flash cache backed by rotational storage.

"inline" RAM caches were implemented 10+ years ago for SCSI devices to avoid seek *and* rotational delay penalties. These were transperent SCSI devices that would cache and prefetch content from disks. For the given dataset size, the seek cost was effectively zero. This is mostly true today for high-end disk arrays which have large RAM front-end's (TB) and very smart data placement strategies (reduced seek).

Back to the bikeshed painting: I prefer two flags: "AVGREADCOST" and "AVGWRITECOST as the flag. This isn't just about seek. Rotational delay @7200 RPM is 8.3ms. Making both non-zero implies rotational media. Different devices have different read and write characteristics. Flash typically has a much higher write cost than read cost. Disks (because of WCE) can be the opposite.

Code can test for zero/nonzero or (preferably) more fine grained. e.g. "avgreadcost > 1ms" or "avgwritecost". I'm hoping this test can be abstracted into a macro.

I'm hoping longterm, the values could be "self tuning" but don't know how that might work - e.g. 1 minute avg? 10 minute avg? Cost of collecting/maintaining the stats? Feels like a CONFIG option.

hth,
grant

#16 lore raw
Quoted 8 lines · Grant Grundler

On Thu, Jan 15, 2009 at 8:06 AM, James Bottomley
<[email protected]> wrote:
...

Quoted 4 lines

Right, this is the flash cache idea that's been floating around for a while. It's even been suggested as a way of avoiding the IDE barrier flush penalties. I think Seagate went as far as making hybrid drives that were a large flash cache backed by rotational storage.

Quoted 6 lines

"inline" RAM caches were implemented 10+ years ago for SCSI devices to avoid seek *and* rotational delay penalties. These were transperent SCSI devices that would cache and prefetch content from disks. For the given dataset size, the seek cost was effectively zero. This is mostly true today for high-end disk arrays which have large RAM front-end's (TB) and very smart data placement strategies (reduced seek).

RAM caches are different from flash caches: they're volatile. Essentially they're the cause of our barrier flush issues. The point about flash caches is they're non volatile. You can pull power from the disk as soon as the data is in flash cache; the disc can commit it again as soon as it powers up.

Quoted 10 lines

Back to the bikeshed painting: I prefer two flags: "AVGREADCOST" and "AVGWRITECOST as the flag. This isn't just about seek. Rotational delay @7200 RPM is 8.3ms. Making both non-zero implies rotational media. Different devices have different read and write characteristics. Flash typically has a much higher write cost than read cost. Disks (because of WCE) can be the opposite.

Code can test for zero/nonzero or (preferably) more fine grained. e.g. "avgreadcost > 1ms" or "avgwritecost". I'm hoping this test can be abstracted into a macro.

Um these really have to be things we can get out of the device at boot time without effort (as in part of the data the device can give in a single command). I'll be shot for increasing boot time so we can work out these parameters ...

Quoted 3 lines

I'm hoping longterm, the values could be "self tuning" but don't know how that might work - e.g. 1 minute avg? 10 minute avg? Cost of collecting/maintaining the stats? Feels like a CONFIG option.

CONFIG_SLOW_YOUR_BOOT?

James

#17 lore raw

On Thu, Jan 15, 2009 at 11:00 AM, James Bottomley
<[email protected]> wrote:
...

Quoted 8 lines
Quoted 3 lines

Code can test for zero/nonzero or (preferably) more fine grained. e.g. "avgreadcost > 1ms" or "avgwritecost". I'm hoping this test can be abstracted into a macro.

Um these really have to be things we can get out of the device at boot time without effort (as in part of the data the device can give in a single command). I'll be shot for increasing boot time so we can work out these parameters ...

No. The whole point is we should not care what it is at boot time. It should be based on recent history of what is going on.
At boot time we read the partition table and we superblocks to mount file systems.
That's fine to start with. So I don't see any need to add some synthetic test to establish initial values.

The rest of the code should work regardless of what the values start out to be. This is true for the previous proposed patch too when user space has to decide what the right policy is.

Quoted 5 lines
Quoted 3 lines

I'm hoping longterm, the values could be "self tuning" but don't know how that might work - e.g. 1 minute avg? 10 minute avg? Cost of collecting/maintaining the stats? Feels like a CONFIG option.

CONFIG_SLOW_YOUR_BOOT?

maybe CONFIG_AUTOTUNE_RWCOST.

thanks,
grant

#18 lore raw
Quoted 19 lines · Grant Grundler

On Thu, Jan 15, 2009 at 11:00 AM, James Bottomley
<[email protected]> wrote:
...

Quoted 8 lines
Quoted 3 lines

Code can test for zero/nonzero or (preferably) more fine grained. e.g. "avgreadcost > 1ms" or "avgwritecost". I'm hoping this test can be abstracted into a macro.

Um these really have to be things we can get out of the device at boot time without effort (as in part of the data the device can give in a single command). I'll be shot for increasing boot time so we can work out these parameters ...

No. The whole point is we should not care what it is at boot time. It should be based on recent history of what is going on.
At boot time we read the partition table and we superblocks to mount file systems.
That's fine to start with. So I don't see any need to add some synthetic test to establish initial values.

Quoted 3 lines

The rest of the code should work regardless of what the values start out to be. This is true for the previous proposed patch too when user space has to decide what the right policy is.

OK, so they could be calculated on the fly in the elevators, I suppose. But what would the value be? Right now we use the nonrotational flag to basically not bother with plugging (no point if no seek penalty) on certain events where we'd previously have waited for other I/O to join. But that's really a seek penalty parameter rather than the idea of read or write costing (although the elevators usually track these dynamically anyway ... as part of the latency calculations but not explicitly).

James

#19 lore raw
Quoted 8 lines · James Bottomley

OK, so they could be calculated on the fly in the elevators, I suppose. But what would the value be? Right now we use the nonrotational flag to basically not bother with plugging (no point if no seek penalty) on certain events where we'd previously have waited for other I/O to join. But that's really a seek penalty parameter rather than the idea of read or write costing (although the elevators usually track these dynamically anyway ... as part of the latency calculations but not explicitly).

... not bother with plugging (no point if no seek penalty) ...

I thought there was considerable advantage to plugging writes (in case they turn out to be adjacent) on current and older generations of non-rotational storage?

Hugh

#20 lore raw
Quoted 9 lines · Hugh Dickins
Quoted 7 lines · James Bottomley

OK, so they could be calculated on the fly in the elevators, I suppose. But what would the value be? Right now we use the nonrotational flag to basically not bother with plugging (no point if no seek penalty) on certain events where we'd previously have waited for other I/O to join. But that's really a seek penalty parameter rather than the idea of read or write costing (although the elevators usually track these dynamically anyway ... as part of the latency calculations but not explicitly).

Quoted 5 lines

... not bother with plugging (no point if no seek penalty) ...

I thought there was considerable advantage to plugging writes (in case they turn out to be adjacent) on current and older generations of non-rotational storage?

I think it's about collecting the whole eraseblock if possible - speaking of NAND flashes for example.

But I also think that the percentage of whole eraseblocks during writes will be very low regardless of any plugging, UNLESS the filesystem layout is optimized especially for that. So such "plugging" is somewhat useless here - again, unless an application will perform a lot of singel-byte writes like f.e. "mscompress" version 0.3 does... (But we honor O_SYNC so this case is abusable anyway.)

/mjt

Quoted 7 lines

Hugh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#21 lore raw
In reply to Hugh Dickins
Quoted 10 lines · Hugh Dickins
Quoted 8 lines · James Bottomley

OK, so they could be calculated on the fly in the elevators, I suppose. But what would the value be? Right now we use the nonrotational flag to basically not bother with plugging (no point if no seek penalty) on certain events where we'd previously have waited for other I/O to join. But that's really a seek penalty parameter rather than the idea of read or write costing (although the elevators usually track these dynamically anyway ... as part of the latency calculations but not explicitly).

Quoted 5 lines

... not bother with plugging (no point if no seek penalty) ...

I thought there was considerable advantage to plugging writes (in case they turn out to be adjacent) on current and older generations of non-rotational storage?

Heh, you get as many answers to that one as their are SSD manufacturers. However, the consensus seems to be that all MLC and SLC flash has a RAID like architecture internally, thus it can actually be *faster* if you send multiple commands (each area of the RAID processes independently). Of course, you have to be *able* to send multiple commands, so the device must implement TCQ/NCQ, but if it does, it's actually beneficial *not* to wait even if the requests are adjacent.

However, the reason the nonrotational flag is set from user space is precisely so if we do find an SSD that has this property, we can just not set the nonrotational queue flag.

James

#22 lore raw
Quoted 26 lines · James Bottomley
Quoted 10 lines · Hugh Dickins
Quoted 8 lines · James Bottomley

OK, so they could be calculated on the fly in the elevators, I suppose. But what would the value be? Right now we use the nonrotational flag to basically not bother with plugging (no point if no seek penalty) on certain events where we'd previously have waited for other I/O to join. But that's really a seek penalty parameter rather than the idea of read or write costing (although the elevators usually track these dynamically anyway ... as part of the latency calculations but not explicitly).

Quoted 5 lines

... not bother with plugging (no point if no seek penalty) ...

I thought there was considerable advantage to plugging writes (in case they turn out to be adjacent) on current and older generations of non-rotational storage?

Heh, you get as many answers to that one as their are SSD manufacturers. However, the consensus seems to be that all MLC and SLC flash has a RAID like architecture internally, thus it can actually be *faster* if you send multiple commands (each area of the RAID processes independently). Of course, you have to be *able* to send multiple commands, so the device must implement TCQ/NCQ, but if it does, it's actually beneficial *not* to wait even if the requests are adjacent.

Quoted 4 lines

However, the reason the nonrotational flag is set from user space is precisely so if we do find an SSD that has this property, we can just not set the nonrotational queue flag.

Not all non-rotational SSDs are created equal (as Intel said).

Some SSD performs better as the I/O queue length increase, while others not. For SSD with scalable queueing performance, it might be better to allow multiple discrete I/Os.

I'm not sure if "non-rotational" is well suited for tuning the behavior of elevator merging.

--
Dongjun

#23 lore raw
Quoted 33 lines · Dongjun Shin
Quoted 26 lines · James Bottomley
Quoted 10 lines · Hugh Dickins
Quoted 8 lines · James Bottomley

OK, so they could be calculated on the fly in the elevators, I suppose. But what would the value be? Right now we use the nonrotational flag to basically not bother with plugging (no point if no seek penalty) on certain events where we'd previously have waited for other I/O to join. But that's really a seek penalty parameter rather than the idea of read or write costing (although the elevators usually track these dynamically anyway ... as part of the latency calculations but not explicitly).

Quoted 5 lines

... not bother with plugging (no point if no seek penalty) ...

I thought there was considerable advantage to plugging writes (in case they turn out to be adjacent) on current and older generations of non-rotational storage?

Heh, you get as many answers to that one as their are SSD manufacturers. However, the consensus seems to be that all MLC and SLC flash has a RAID like architecture internally, thus it can actually be *faster* if you send multiple commands (each area of the RAID processes independently). Of course, you have to be *able* to send multiple commands, so the device must implement TCQ/NCQ, but if it does, it's actually beneficial *not* to wait even if the requests are adjacent.

Quoted 4 lines

However, the reason the nonrotational flag is set from user space is precisely so if we do find an SSD that has this property, we can just not set the nonrotational queue flag.

Quoted 8 lines

Not all non-rotational SSDs are created equal (as Intel said).

Some SSD performs better as the I/O queue length increase, while others not. For SSD with scalable queueing performance, it might be better to allow multiple discrete I/Os.

I'm not sure if "non-rotational" is well suited for tuning the behavior of elevator merging.

It's not tuning merging, that's a seperate tuning knob if someone wishes to turn that off.

Signature · 1 line
Jens Axboe
#24 lore raw
In reply to Hugh Dickins
Quoted 10 lines · Hugh Dickins
Quoted 8 lines · James Bottomley

OK, so they could be calculated on the fly in the elevators, I suppose. But what would the value be? Right now we use the nonrotational flag to basically not bother with plugging (no point if no seek penalty) on certain events where we'd previously have waited for other I/O to join. But that's really a seek penalty parameter rather than the idea of read or write costing (although the elevators usually track these dynamically anyway ... as part of the latency calculations but not explicitly).

Quoted 5 lines

... not bother with plugging (no point if no seek penalty) ...

I thought there was considerable advantage to plugging writes (in case they turn out to be adjacent) on current and older generations of non-rotational storage?

Don't confuse plugging and merging, although one does help the other.

We can essentially divide the current SSD market into two categories - queuing and non-queuing. Which also happens to just about the same as saying Intel and non-Intel, at least that has been the case since Sep '08 and until present time. On the queuing devices, plugging does more harm than good. The IO access time is so fast, that delaying for merging hurts your performance.

For non-queuing devices, I think our current check is a bit too drastic. We probably want to change that to

int dont_plug(q)

{
        return blk_queue_nonrot(q) && blk_queue_tagged(q);
}

Which is identical to what CFQ tests for idling to avoid read/write overlaps which also completely kills performance on the current SSD drives (except for Intel, which again shines).

Signature · 1 line
Jens Axboe
#25 lore raw
Quoted 9 lines · On Fri, 16 Jan 2009 07:48:18 +0100 Jens Axboe <[email protected]> wrote:

For non-queuing devices, I think our current check is a bit too drastic. We probably want to change that to

int dont_plug(q)

{
        return blk_queue_nonrot(q) && blk_queue_tagged(q);
}

Please do. The MMC block driver sets nonrot as of late, but it is extremely dependent on merging. The command overhead is just silly, so to get anywhere near the speed numbers indicated in marketing you need large requests.

It seems that too many confuse "non-rotational" with "low latency", which isn't always the same. :)

Rgds

Signature · 9 lines
     -- Pierre Ossman

  Linux kernel, MMC maintainer        http://www.kernel.org
  rdesktop, core developer          http://www.rdesktop.org

  WARNING: This correspondence is being monitored by the
  Swedish government. Make sure your server uses encryption
  for SMTP traffic and consider using PGP for end-to-end
  encryption.
#26 lore raw
In reply to Grant Grundler
Quoted 18 lines · Grant Grundler

On Thu, Jan 15, 2009 at 11:00 AM, James Bottomley
<[email protected]> wrote:
...

Quoted 8 lines
Quoted 3 lines

Code can test for zero/nonzero or (preferably) more fine grained. e.g. "avgreadcost > 1ms" or "avgwritecost". I'm hoping this test can be abstracted into a macro.

Um these really have to be things we can get out of the device at boot time without effort (as in part of the data the device can give in a single command). I'll be shot for increasing boot time so we can work out these parameters ...

No. The whole point is we should not care what it is at boot time. It should be based on recent history of what is going on. At boot time we read the partition table and we superblocks to mount file systems. That's fine to start with. So I don't see any need to add some synthetic test to establish initial values.

Quoted 3 lines

The rest of the code should work regardless of what the values start out to be. This is true for the previous proposed patch too when user space has to decide what the right policy is.

I absolutely hate the idea of rw cost numbers. Why? Because it's a property that's impossible to present as a single number. It depends on so many different things, like cache settings and access pattern. If you just want to know the avg seek time of your device, look at the reported RPM value. Userspace can do that, because the kernel doesn't really care a whole lot about it to be honest.

Signature · 1 line
Jens Axboe
Acked-by on v1 1/1
#27 lore raw
In reply to Bartlomiej Zolnierkiewicz
Quoted 8 lines · On Mon, 5 Jan 2009 19:52:57 +0100 Bartlomiej Zolnierkiewicz…

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] block: export SSD/non-rotational queue flag through sysfs

For some devices (i.e. CFA ATA) we can't reliably detect whether the device is of rotational or non-rotational type so we need to leave the final decision about this setting to the user-space.

Nice - exactly what is needed