Re: [PATCH v11 24/31] dax/bus: Add uuid sysfs attribute to dax devices
Dave Jiang <[email protected]>
| Newsgroups | dev.linux.lists.nvdimm,org.kernel.vger.linux-cxl,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
On 6/25/26 4:05 AM, Anisa Su wrote: > Introduce a read-write 'uuid' sysfs entry at > /sys/bus/dax/devices/daxX.Y/ with stubbed handlers: show returns the > null uuid 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]> Reviewed-by: Dave Jiang <[email protected]> > > --- > Changes: > - uuid_show() emits the null uuid ("%pUb" of uuid_null) instead of "0". > - ABI: describe the no-uuid read value as a null uuid instead of "0"; > bump Date to June, 2026 and KernelVersion to v7.3. > --- > 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..3219c09dea01 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: June, 2026 > +KernelVersion: v7.3 > +Contact: [email protected] > +Description: > + (RW) On read, reports the uuid identifying the capacity > + backing this dax device. A null uuid (all-zeroes) 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 ffa6b303fc9b..f61309a6f934 100644 > --- a/drivers/dax/bus.c > +++ b/drivers/dax/bus.c > @@ -1573,6 +1573,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, "%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) > { > @@ -1644,6 +1657,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, > }; >