On 05/09/25 03:08PM, Ira Weiny wrote: >Neeraj Kumar wrote: >> On 19/08/25 01:56PM, Ira Weiny wrote: >> >Neeraj Kumar wrote: >> >> nd_mapping->labels maintains the list of labels present into LSA. >> >> init_labels() prepares this list while adding new label into LSA >> >> and updates nd_mapping->labels accordingly. During cxl region >> >> creation nd_mapping->labels list and LSA was updated with one >> >> region label. Therefore during new namespace label creation >> >> pre-include the previously created region label, so increase >> >> num_labels count by 1. >> > >> >Why does the count of the labels in the list not work? >> > >> >static int init_labels(struct nd_mapping *nd_mapping, int num_labels) >> >{ >> > int i, old_num_labels = 0; >> >... >> > mutex_lock(&nd_mapping->lock); >> > list_for_each_entry(label_ent, &nd_mapping->labels, list) >> > old_num_labels++; >> > mutex_unlock(&nd_mapping->lock); >> >... >> > >> >> Hi Ira, >> >> init_labels() allocates new label based on comparison with existing >> count of the labels in the list and passed num_labels. If num_labels >> is greater than count of the labels in the list then new label is >> allocated and stored in list for later usage > >I think I'm following better but shouldn't this hunk be included in the >code which creates the region label in the list? > Yes we can include this hunk in patch 5 where we are updating region label. I will drop this commit and include it in patch 5. >I'm concerned that this '+ 1' out of the blue and will be confusing in the >future. Why can't count be kept up to date when the region label was >created and added? Yes this '+1' is hardcoded and it creating confusion. I will fix this with available region labels in the list. > >What code (patch) added this region label? > >Ira Patch 5 add this region label using nd_pmem_region_label_update() Regards, Neeraj