- struct uuid_nid_data *data, *entry;
- int found = 0;
-
- LASSERT(nid != 0); /* valid newconfig NID is never zero */
-
- if (strlen(uuid) > UUID_MAX - 1)
- return -EOVERFLOW;
-
- OBD_ALLOC_PTR(data);
- if (data == NULL)
- return -ENOMEM;
-
- obd_str2uuid(&data->un_uuid, uuid);
- data->un_nids[0] = nid;
- data->un_nid_count = 1;
-
- cfs_spin_lock(&g_uuid_lock);
- cfs_list_for_each_entry(entry, &g_uuid_list, un_list) {
- if (obd_uuid_equals(&entry->un_uuid, &data->un_uuid)) {
- int i;
-
- found = 1;
- for (i = 0; i < entry->un_nid_count; i++)
- if (nid == entry->un_nids[i])
- break;
-
- if (i == entry->un_nid_count) {
- LASSERT(entry->un_nid_count < NIDS_MAX);
- entry->un_nids[entry->un_nid_count++] = nid;
- }
- break;
- }
- }
- if (!found)
- cfs_list_add(&data->un_list, &g_uuid_list);
- cfs_spin_unlock(&g_uuid_lock);
-
- if (found) {
- CDEBUG(D_INFO, "found uuid %s %s cnt=%d\n", uuid,
- libcfs_nid2str(nid), entry->un_nid_count);
- OBD_FREE(data, sizeof(*data));
- } else {
- CDEBUG(D_INFO, "add uuid %s %s\n", uuid, libcfs_nid2str(nid));
- }
- return 0;
+ struct uuid_nid_data *data, *entry;
+ int found = 0;
+
+ LASSERT(nid != 0); /* valid newconfig NID is never zero */
+
+ if (strlen(uuid) > UUID_MAX - 1)
+ return -EOVERFLOW;
+
+ OBD_ALLOC_PTR(data);
+ if (data == NULL)
+ return -ENOMEM;
+
+ obd_str2uuid(&data->un_uuid, uuid);
+ data->un_nids[0] = nid;
+ data->un_nid_count = 1;
+
+ spin_lock(&g_uuid_lock);
+ list_for_each_entry(entry, &g_uuid_list, un_list) {
+ if (obd_uuid_equals(&entry->un_uuid, &data->un_uuid)) {
+ int i;
+
+ found = 1;
+ for (i = 0; i < entry->un_nid_count; i++)
+ if (nid == entry->un_nids[i])
+ break;
+
+ if (i == entry->un_nid_count) {
+ LASSERT(entry->un_nid_count < NIDS_MAX);
+ entry->un_nids[entry->un_nid_count++] = nid;
+ }
+ break;
+ }
+ }
+ if (!found)
+ list_add(&data->un_list, &g_uuid_list);
+ spin_unlock(&g_uuid_lock);
+
+ if (found) {
+ CDEBUG(D_INFO, "found uuid %s %s cnt=%d\n", uuid,
+ libcfs_nid2str(nid), entry->un_nid_count);
+ OBD_FREE(data, sizeof(*data));
+ } else {
+ CDEBUG(D_INFO, "add uuid %s %s\n", uuid, libcfs_nid2str(nid));
+ }
+ return 0;