Re: [PATCH V3 06/20] nvdimm/region_label: Add region label update support

Neeraj Kumar
2025-10-06T04:58:15Z

[-- Attachment #1: Type: text/plain, Size: 985 bytes --]

On 22/09/25 04:11PM, Dave Jiang wrote:
>> +static inline bool is_region_label(struct nvdimm_drvdata *ndd,
>> + union nd_lsa_label *nd_label)
>> +{
>> + uuid_t region_type, *ns_type;
>> +
>> + if (!ndd->cxl || !nd_label)
>> + return false;
>> +
>> + uuid_parse(CXL_REGION_UUID, &region_type);
>> + ns_type = (uuid_t *) nd_label->ns_label.cxl.type;
>
>So in addition to Jonathan's comments, I think we should consider utilizing the common field (UUID) of all the labels. i.e. if you are to use a union, you can also include 'uuid_t label_type' as a member. Perhaps this function can just pass in a UUID rather than a label struct. And we can probably skip passing in 'ndd' and not bother with ndd->cxl check. This function can just rely on checking the UUID and see if it's the expected region label UUID. Just thinking of the places we can maybe avoid doing casting if possible.
>
>DJ

Thanks Dave for detailed suggestion. I will handle this in next
patch-set

Regards,
Neeraj

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]