Re: [PATCH V3 08/20] nvdimm/label: Include region label in slot validation

Neeraj Kumar
2025-10-06T04:53:10Z

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

On 22/09/25 03:17PM, Dave Jiang wrote:
>> static void region_label_calculate_checksum(struct nvdimm_drvdata *ndd,
>> struct cxl_region_label *region_label)
>> {
>> @@ -392,16 +404,30 @@ static void region_label_calculate_checksum(struct nvdimm_drvdata *ndd,
>> }
>>
>> static bool slot_valid(struct nvdimm_drvdata *ndd,
>> - struct nd_namespace_label *nd_label, u32 slot)
>> + union nd_lsa_label *lsa_label, u32 slot)
>> {
>> + struct cxl_region_label *region_label = &lsa_label->region_label;
>> + struct nd_namespace_label *nd_label = &lsa_label->ns_label;
>> + char *label_name;
>> bool valid;
>>
>> /* check that we are written where we expect to be written */
>> - if (slot != nsl_get_slot(ndd, nd_label))
>> - return false;
>> - valid = nsl_validate_checksum(ndd, nd_label);
>> + if (is_region_label(ndd, lsa_label)) {
>> + label_name = "rg";
>
>I suggest create a static string table enumerated by 'enum label_type'. That way you can directly address it by 'label_name[ltype]' when being used instead of assigning at run time. And maybe just use "region" and "namespace" since it's for debug output and we don't need to shorten it.
>
>DJ

Sure Dave, Thanks for your suggestion. I will fix it accordingly

Regards,
Neeraj

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