ceph_str_hash() return -1 if set unknown hash type
but (unsiged)-1 = unsiged
4294967295
So we can't judge whether the
4294967295 is the normal value of hash, or the return value of the unknown hash type
use ceph_str_hash_valid() verify the hash type before generating the hash value
Signed-off-by: huanwen ren <ren.huanwen@zte.com.cn>
int which = dir_layout.dl_dir_hash;
if (!which)
which = CEPH_STR_HASH_LINUX;
+ assert(ceph_str_hash_valid(which));
return ceph_str_hash(which, dn.data(), dn.length());
}
int which = inode.dir_layout.dl_dir_hash;
if (!which)
which = CEPH_STR_HASH_LINUX;
+ assert(ceph_str_hash_valid(which));
return ceph_str_hash(which, dn.data(), dn.length());
}