[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1983025922.01759726381745.JavaMail.epsvc@epcpadp2new>
Date: Mon, 29 Sep 2025 18:43:31 +0530
From: Neeraj Kumar <s.neeraj@...sung.com>
To: Dave Jiang <dave.jiang@...el.com>
Cc: linux-cxl@...r.kernel.org, nvdimm@...ts.linux.dev,
linux-kernel@...r.kernel.org, gost.dev@...sung.com,
a.manzanares@...sung.com, vishak.g@...sung.com, neeraj.kernel@...il.com,
cpgs@...sung.com
Subject: Re: [PATCH V3 07/20] nvdimm/region_label: Add region label delete
support
On 22/09/25 02:37PM, Dave Jiang wrote:
>
>> +int nd_pmem_region_label_delete(struct nd_region *nd_region)
>> +{
>> + struct nd_interleave_set *nd_set = nd_region->nd_set;
>> + struct nd_label_ent *label_ent;
>> + int ns_region_cnt = 0;
>> + int i, rc;
>> +
>> + for (i = 0; i < nd_region->ndr_mappings; i++) {
>> + struct nd_mapping *nd_mapping = &nd_region->mapping[i];
>> + struct nvdimm_drvdata *ndd = to_ndd(nd_mapping);
>> +
>> + /* Find non cxl format supported ndr_mappings */
>> + if (!ndd->cxl) {
>> + dev_info(&nd_region->dev, "Unsupported region label\n");
>> + return -EINVAL;
>> + }
>> +
>> + /* Find if any NS label using this region */
>> + guard(mutex)(&nd_mapping->lock);
>> + list_for_each_entry(label_ent, &nd_mapping->labels, list) {
>> + if (!label_ent->label)
>> + continue;
>> +
>> + /*
>> + * Check if any available NS labels has same
>> + * region_uuid in LSA
>> + */
>> + if (nsl_region_uuid_equal(label_ent->label,
>> + &nd_set->uuid))
>> + ns_region_cnt++;
>
>Why not just return -EBUSY here immediately? It seems the code returns -EBUSY as long as there's 1 or more below.
>
>> + }
>> + }
>> +
>> + if (ns_region_cnt) {
>> + dev_dbg(&nd_region->dev, "Region/Namespace label in use\n");
>> + return -EBUSY;
>> + }
>> +
>> + for (i = 0; i < nd_region->ndr_mappings; i++) {
>> + struct nd_mapping *nd_mapping = &nd_region->mapping[i];
>> +
>> + rc = del_labels(nd_mapping, &nd_set->uuid, RG_LABEL_TYPE);
>> + if (rc)
>> + return rc;
>> + }
>
>Can this be folded into the for loop above or does it a full pass to check before starting the label deletion process?
>
>DJ
Yes, if we use "return -EBUSY" in first loop itself then we can call del_labels()
I will fix this in next patch-set
Regards,
Neeraj
Powered by blists - more mailing lists