for the new layout.
.RS 1.2i
.TP
-.B crush
-CRUSH hash algorithm. This is a consistent hash
-algorithm, so minimum sub files need to relocate
-during directory restripe.
+.B all_char (type 1)
+Sum of ASCII characters modulo number of MDTs. This
+provides weak hashing of the filename, and is suitable
+for only testing or when the input is known to have
+perfectly uniform distribution (e.g. sequential numbers).
.TP
-.B fnv_1a_64
+.B fnv_1a_64 (type 2)
Fowler-Noll-Vo (FNV-1a) hash algorithm. This provides
reasonably uniform, but not cryptographically strong,
hashing of the filename. (default)
.TP
-.B all_char
-Sum of ASCII characters modulo number of MDTs. This
-provides weak hashing of the filename, and is suitable
-for only testing or when the input is known to have
-perfectly uniform distribution (e.g. sequential numbers).
+.B crush (type 3)
+CRUSH hash algorithm. This is a consistent hash
+algorithm, so minimum sub files need to relocate
+during directory restripe.
.RE
.P
Only the root user can migrate directories. Files that have been archived by
old_count=$((MDSCOUNT - old_index))
new_index=$((RANDOM % MDSCOUNT))
new_count=$((MDSCOUNT - new_index))
- new_hash="all_char"
+ new_hash=1 # for all_char
[ $old_count -gt 1 ] && old_count=$((old_count - RANDOM % old_count))
[ $new_count -gt 1 ] && new_count=$((new_count - RANDOM % new_count))
" it's the MDT index of first stripe\n"
"\tmdt_count: number of MDTs to stripe a directory over\n"
"\tmdt_hash: hash type of the striped directory. mdt types:\n"
- " crush CRUSH hash algorithm (default)\n"
- " fnv_1a_64 FNV-1a hash algorithm\n"
- " all_char sum of characters % MDT_COUNT\n"
+ " all_char (type 1)sum of characters % MDT_COUNT\n"
+ " fnv_1a_64 (type 2)FNV-1a hash algorithm (default)\n"
+ " crush (type 3)CRUSH hash algorithm\n"
"\n"
"migrate file objects from one OST "
"layout\nto another (may be not safe with concurent writes).\n"
static int check_hashtype(const char *hashtype)
{
+ int type_num = atoi(hashtype);
int i;
+ /* numeric hash type */
+ if (hashtype && strlen(hashtype) == 1 &&
+ (type_num > 0 && type_num < LMV_HASH_TYPE_MAX))
+ return type_num;
+ /* string hash type */
for (i = LMV_HASH_TYPE_ALL_CHARS; i < LMV_HASH_TYPE_MAX; i++)
if (strcmp(hashtype, mdt_hash_name[i]) == 0)
return i;