]> git.karo-electronics.de Git - linux-beck.git/commitdiff
blk-sysfs: Add 'chunk_sectors' to sysfs attributes
authorHannes Reinecke <hare@suse.de>
Tue, 18 Oct 2016 06:40:30 +0000 (15:40 +0900)
committerJens Axboe <axboe@fb.com>
Tue, 18 Oct 2016 16:02:02 +0000 (10:02 -0600)
The queue limits already have a 'chunk_sectors' setting, so
we should be presenting it via sysfs.

Signed-off-by: Hannes Reinecke <hare@suse.de>
[Damien: Updated Documentation/ABI/testing/sysfs-block]

Signed-off-by: Damien Le Moal <damien.lemoal@hgst.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Shaun Tancheff <shaun.tancheff@seagate.com>
Tested-by: Shaun Tancheff <shaun.tancheff@seagate.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Documentation/ABI/testing/sysfs-block
block/blk-sysfs.c

index 75a5055a722b7214ae1fe82ed63d497799355bd7..ee2d5cd26bfe2d3b3ee49350361ea3b4a00c8b61 100644 (file)
@@ -251,3 +251,16 @@ Description:
                since drive-managed zoned block devices do not support
                zone commands, they will be treated as regular block
                devices and zoned will report "none".
+
+What:          /sys/block/<disk>/queue/chunk_sectors
+Date:          September 2016
+Contact:       Hannes Reinecke <hare@suse.com>
+Description:
+               chunk_sectors has different meaning depending on the type
+               of the disk. For a RAID device (dm-raid), chunk_sectors
+               indicates the size in 512B sectors of the RAID volume
+               stripe segment. For a zoned block device, either
+               host-aware or host-managed, chunk_sectors indicates the
+               size of 512B sectors of the zones of the device, with
+               the eventual exception of the last zone of the device
+               which may be smaller.
index ff9cd9cd35a35143d43e0ed95ea8c5b5bead19ba..488c2e28feb823a84a252ba553649008c06de7fc 100644 (file)
@@ -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);
@@ -455,6 +460,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,
@@ -555,6 +565,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,