]> www.infradead.org Git - users/hch/xfs.git/commitdiff
block: export placement hint feature
authorKeith Busch <kbusch@kernel.org>
Tue, 29 Oct 2024 15:19:20 +0000 (08:19 -0700)
committerChristoph Hellwig <hch@lst.de>
Tue, 5 Nov 2024 15:35:38 +0000 (16:35 +0100)
Add a feature flag for devices that support generic placement hints in
write commands. This is in contrast to data lifetime hints.

Signed-off-by: Keith Busch <kbusch@kernel.org>
block/blk-settings.c
block/blk-sysfs.c
include/linux/blkdev.h

index 230b7043fc86fda81accfad2e56d5069f6ab5e43..11dde863d4dad26ef2b3dfcdce6972b18e5f7032 100644 (file)
@@ -518,6 +518,8 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
                t->features &= ~BLK_FEAT_NOWAIT;
        if (!(b->features & BLK_FEAT_POLL))
                t->features &= ~BLK_FEAT_POLL;
+       if (!(b->features & BLK_FEAT_PLACEMENT_HINTS))
+               t->features &= ~BLK_FEAT_PLACEMENT_HINTS;
 
        t->flags |= (b->flags & BLK_FLAG_MISALIGNED);
 
index 8d014161dde0fd2c45eb6062702307aa371ab152..52dedda517ee396ee0a3dda77a21814bdf77c962 100644 (file)
@@ -260,6 +260,7 @@ static ssize_t queue_##_name##_show(struct gendisk *disk, char *page)       \
 QUEUE_SYSFS_FEATURE_SHOW(poll, BLK_FEAT_POLL);
 QUEUE_SYSFS_FEATURE_SHOW(fua, BLK_FEAT_FUA);
 QUEUE_SYSFS_FEATURE_SHOW(dax, BLK_FEAT_DAX);
+QUEUE_SYSFS_FEATURE_SHOW(placement_hints, BLK_FEAT_PLACEMENT_HINTS);
 
 static ssize_t queue_zoned_show(struct gendisk *disk, char *page)
 {
@@ -468,6 +469,7 @@ QUEUE_RW_ENTRY(queue_poll_delay, "io_poll_delay");
 QUEUE_RW_ENTRY(queue_wc, "write_cache");
 QUEUE_RO_ENTRY(queue_fua, "fua");
 QUEUE_RO_ENTRY(queue_dax, "dax");
+QUEUE_RO_ENTRY(queue_placement_hints, "placement_hints");
 QUEUE_RW_ENTRY(queue_io_timeout, "io_timeout");
 QUEUE_RO_ENTRY(queue_virt_boundary_mask, "virt_boundary_mask");
 QUEUE_RO_ENTRY(queue_dma_alignment, "dma_alignment");
@@ -596,6 +598,7 @@ static struct attribute *queue_attrs[] = {
        &queue_wc_entry.attr,
        &queue_fua_entry.attr,
        &queue_dax_entry.attr,
+       &queue_placement_hints_entry.attr,
        &queue_poll_delay_entry.attr,
        &queue_virt_boundary_mask_entry.attr,
        &queue_dma_alignment_entry.attr,
index 746b99b1a71d649f907257e3cac30d27ead6f9d9..06a6725eb5db177f9659eceeb10623e094d0945a 100644 (file)
@@ -332,6 +332,9 @@ typedef unsigned int __bitwise blk_features_t;
 #define BLK_FEAT_RAID_PARTIAL_STRIPES_EXPENSIVE \
        ((__force blk_features_t)(1u << 15))
 
+/* supports generic write placement hints */
+#define BLK_FEAT_PLACEMENT_HINTS       ((__force blk_features_t)(1u << 16))
+
 /*
  * Flags automatically inherited when stacking limits.
  */