]> git.baikalelectronics.ru Git - kernel.git/commitdiff
block: export dma_alignment attribute
authorKeith Busch <kbusch@kernel.org>
Fri, 10 Jun 2022 19:58:22 +0000 (12:58 -0700)
committerJens Axboe <axboe@kernel.dk>
Mon, 27 Jun 2022 12:29:11 +0000 (06:29 -0600)
User space may want to know how to align their buffers to avoid
bouncing. Export the queue attribute.

Signed-off-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20220610195830.3574005-4-kbusch@fb.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Documentation/ABI/stable/sysfs-block
block/blk-sysfs.c

index e8797cd09aff974dfbb35e948ab2e626076b8f9c..cd14ecb3c9a5af03845de206a53b88f6a6c78153 100644 (file)
@@ -260,6 +260,15 @@ Description:
                for discards, and don't read this file.
 
 
+What:          /sys/block/<disk>/queue/dma_alignment
+Date:          May 2022
+Contact:       linux-block@vger.kernel.org
+Description:
+               Reports the alignment that user space addresses must have to be
+               used for raw block device access with O_DIRECT and other driver
+               specific passthrough mechanisms.
+
+
 What:          /sys/block/<disk>/queue/fua
 Date:          May 2018
 Contact:       linux-block@vger.kernel.org
index 9b905e9443e49606e09311757985eddeebc6cbef..ec716ea26b920017dd1c6677b381f83ea3a6fbee 100644 (file)
@@ -274,6 +274,11 @@ static ssize_t queue_virt_boundary_mask_show(struct request_queue *q, char *page
        return queue_var_show(q->limits.virt_boundary_mask, page);
 }
 
+static ssize_t queue_dma_alignment_show(struct request_queue *q, char *page)
+{
+       return queue_var_show(queue_dma_alignment(q), page);
+}
+
 #define QUEUE_SYSFS_BIT_FNS(name, flag, neg)                           \
 static ssize_t                                                         \
 queue_##name##_show(struct request_queue *q, char *page)               \
@@ -606,6 +611,7 @@ QUEUE_RO_ENTRY(queue_dax, "dax");
 QUEUE_RW_ENTRY(queue_io_timeout, "io_timeout");
 QUEUE_RW_ENTRY(queue_wb_lat, "wbt_lat_usec");
 QUEUE_RO_ENTRY(queue_virt_boundary_mask, "virt_boundary_mask");
+QUEUE_RO_ENTRY(queue_dma_alignment, "dma_alignment");
 
 #ifdef CONFIG_BLK_DEV_THROTTLING_LOW
 QUEUE_RW_ENTRY(blk_throtl_sample_time, "throttle_sample_time");
@@ -667,6 +673,7 @@ static struct attribute *queue_attrs[] = {
        &blk_throtl_sample_time_entry.attr,
 #endif
        &queue_virt_boundary_mask_entry.attr,
+       &queue_dma_alignment_entry.attr,
        NULL,
 };