Skip to content
Snippets Groups Projects
Commit a96e33a5 authored by Moe Jette's avatar Moe Jette
Browse files

Modify node hash index computation.

parent 9207fb50
No related branches found
No related tags found
No related merge requests found
...@@ -478,61 +478,15 @@ find_node_record (char *name) ...@@ -478,61 +478,15 @@ find_node_record (char *name)
*/ */
static int _hash_index (char *name) static int _hash_index (char *name)
{ {
int i, inx = 0, tmp; int i = 0;
if (node_record_count == 0) if (node_record_count == 0)
return 0; /* degenerate case */ return 0; /* degenerate case */
if ( slurmctld_conf.hash_base == 10 ) { while (*name)
for (i = 0;; i++) { i += (int) *name++;
tmp = (int) name[i]; i %= node_record_count;
if (tmp == 0) return i;
break; /* end if string */
if ((tmp >= (int) '0') && (tmp <= (int) '9'))
inx = (inx * slurmctld_conf.hash_base) +
(tmp - (int) '0');
}
}
else if ( slurmctld_conf.hash_base == 8 ) {
for (i = 0;; i++) {
tmp = (int) name[i];
if (tmp == 0)
break; /* end if string */
if ((tmp >= (int) '0') && (tmp <= (int) '7'))
inx = (inx * slurmctld_conf.hash_base) +
(tmp - (int) '0');
}
}
else {
for (i = 0; i < 5; i++) {
tmp = (int) name[i];
if (tmp == 0)
break; /* end if string */
if ((tmp >= (int) '0') && (tmp <= (int) '9')) {
/* value 0-9 */
tmp -= (int) '0';
}
else if ((tmp >= (int) 'a') && (tmp <= (int) 'z')) {
/* value 10-35 */
tmp -= (int) 'a';
tmp += 10;
}
else if ((tmp >= (int) 'a') && (tmp <= (int) 'z')) {
/* value 10-35 */
tmp -= (int) 'a';
tmp += 10;
}
else {
tmp = 36;
}
inx = (inx * 37) + tmp;
}
}
inx = inx % node_record_count;
return inx;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment