On 5/23/26 2:43 AM, Anisa Su wrote:
> Introduce a read-write 'uuid' sysfs entry at
> /sys/bus/dax/devices/daxX.Y/ with stubbed handlers: show returns "0"
> and store returns -EOPNOTSUPP. A follow-on patch wires both
> directions to dax_resource tracking.
>
> Document the attribute in the dax sysfs ABI.
>
> Signed-off-by: Anisa Su <[email protected]>
> ---
> Documentation/ABI/testing/sysfs-bus-dax | 18 ++++++++++++++++++
> drivers/dax/bus.c | 14 ++++++++++++++
> 2 files changed, 32 insertions(+)
>
> diff --git a/Documentation/ABI/testing/sysfs-bus-dax
> b/Documentation/ABI/testing/sysfs-bus-dax
> index b34266bfae49..23400824073b 100644
> --- a/Documentation/ABI/testing/sysfs-bus-dax
> +++ b/Documentation/ABI/testing/sysfs-bus-dax
> @@ -59,6 +59,24 @@ Description:
> backing device for this dax device, emit the CPU node
> affinity for this device.
>
> +What: /sys/bus/dax/devices/daxX.Y/uuid
> +Date: May, 2026
> +KernelVersion: v6.16
update
> +Contact: [email protected]
> +Description:
> + (RW) On read, reports the uuid identifying the capacity
> + backing this dax device. A value of "0" indicates that the
> + device has no associated uuid — either it is not backed by
> + DCD capacity, or the backing extents are untagged.
> +
> + Writes are accepted only on dax devices in sparse (DCD)
> + regions; writes to non-sparse devices return -EOPNOTSUPP.
> + Writing a non-null uuid claims every dax_resource in the
> + parent region whose tag matches the written uuid, consuming
> + any available capacity in each matching resource. Writing
> + "0" is shorthand for the null uuid and claims a single
> + untagged dax_resource.
> +
> What: /sys/bus/dax/devices/daxX.Y/target_node
> Date: February, 2019
> KernelVersion: v5.1
> diff --git a/drivers/dax/bus.c b/drivers/dax/bus.c
> index 5c1b93890d30..1d6f82920be6 100644
> --- a/drivers/dax/bus.c
> +++ b/drivers/dax/bus.c
> @@ -1526,6 +1526,19 @@ static ssize_t numa_node_show(struct device *dev,
> }
> static DEVICE_ATTR_RO(numa_node);
>
> +static ssize_t uuid_show(struct device *dev,
> + struct device_attribute *attr, char *buf)
> +{
> + return sysfs_emit(buf, "%d\n", 0);
Should it just emit null UUID instead of 0 to not screw up user apps?
return sysfs_emit(buf, "%pUb\n", &uuid_null);
> +}
> +
> +static ssize_t uuid_store(struct device *dev, struct device_attribute *attr,
> + const char *buf, size_t len)
> +{
> + return -EOPNOTSUPP;
> +}
> +static DEVICE_ATTR_RW(uuid);
> +
> static ssize_t memmap_on_memory_show(struct device *dev,
> struct device_attribute *attr, char *buf)
> {
> @@ -1597,6 +1610,7 @@ static struct attribute *dev_dax_attributes[] = {
> &dev_attr_resource.attr,
> &dev_attr_numa_node.attr,
> &dev_attr_memmap_on_memory.attr,
> + &dev_attr_uuid.attr,
> NULL,
> };
>