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 ... mutex_lock(&nd_mapping->lock); list_for_each_entry(label_ent, &nd_mapping->labels, list) old_num_labels++; mutex_unlock(&nd_mapping->lock); for (i = old_num_labels; i < num_labels; i++) { label_ent = kzalloc(sizeof(*label_ent), GFP_KERNEL); if (!label_ent) return -ENOMEM; mutex_lock(&nd_mapping->lock); list_add_tail(&label_ent->list, nd_mapping->labels); mutex_unlock(&nd_mapping->lock); } ... >> >> Also updated nsl_set_region_uuid with region uuid with which >> namespace is associated with. > >Whenever using a word like 'Also' in the commit message ask if this should be a >separate patch. I'm thinking this hunk should be somewhere else in the series. > >Ira Sure Ira, Yes both hunks are not associated, I just added both to avoid extra commit. I will create separate commit to update region_uuid and will remove 'Also' part from commit message. Regards, Neeraj