Skip to content

Commit 87caf97

Browse files
hreineckeaxboe
authored andcommitted
blk-sysfs: Add 'chunk_sectors' to sysfs attributes
The queue limits already have a 'chunk_sectors' setting, so we should be presenting it via sysfs. Signed-off-by: Hannes Reinecke <[email protected]> [Damien: Updated Documentation/ABI/testing/sysfs-block] Signed-off-by: Damien Le Moal <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Martin K. Petersen <[email protected]> Reviewed-by: Shaun Tancheff <[email protected]> Tested-by: Shaun Tancheff <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 797476b commit 87caf97

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

Documentation/ABI/testing/sysfs-block

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,3 +251,16 @@ Description:
251251
since drive-managed zoned block devices do not support
252252
zone commands, they will be treated as regular block
253253
devices and zoned will report "none".
254+
255+
What: /sys/block/<disk>/queue/chunk_sectors
256+
Date: September 2016
257+
Contact: Hannes Reinecke <[email protected]>
258+
Description:
259+
chunk_sectors has different meaning depending on the type
260+
of the disk. For a RAID device (dm-raid), chunk_sectors
261+
indicates the size in 512B sectors of the RAID volume
262+
stripe segment. For a zoned block device, either
263+
host-aware or host-managed, chunk_sectors indicates the
264+
size of 512B sectors of the zones of the device, with
265+
the eventual exception of the last zone of the device
266+
which may be smaller.

block/blk-sysfs.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,11 @@ static ssize_t queue_physical_block_size_show(struct request_queue *q, char *pag
130130
return queue_var_show(queue_physical_block_size(q), page);
131131
}
132132

133+
static ssize_t queue_chunk_sectors_show(struct request_queue *q, char *page)
134+
{
135+
return queue_var_show(q->limits.chunk_sectors, page);
136+
}
137+
133138
static ssize_t queue_io_min_show(struct request_queue *q, char *page)
134139
{
135140
return queue_var_show(queue_io_min(q), page);
@@ -455,6 +460,11 @@ static struct queue_sysfs_entry queue_physical_block_size_entry = {
455460
.show = queue_physical_block_size_show,
456461
};
457462

463+
static struct queue_sysfs_entry queue_chunk_sectors_entry = {
464+
.attr = {.name = "chunk_sectors", .mode = S_IRUGO },
465+
.show = queue_chunk_sectors_show,
466+
};
467+
458468
static struct queue_sysfs_entry queue_io_min_entry = {
459469
.attr = {.name = "minimum_io_size", .mode = S_IRUGO },
460470
.show = queue_io_min_show,
@@ -555,6 +565,7 @@ static struct attribute *default_attrs[] = {
555565
&queue_hw_sector_size_entry.attr,
556566
&queue_logical_block_size_entry.attr,
557567
&queue_physical_block_size_entry.attr,
568+
&queue_chunk_sectors_entry.attr,
558569
&queue_io_min_entry.attr,
559570
&queue_io_opt_entry.attr,
560571
&queue_discard_granularity_entry.attr,

0 commit comments

Comments
 (0)