return lsm && lsm->lsm_md_magic == LMV_MAGIC_FOREIGN;
}
-static inline bool lmv_dir_migrating(const struct lmv_stripe_md *lsm)
+static inline bool lmv_dir_layout_changing(const struct lmv_stripe_md *lsm)
{
return lmv_dir_striped(lsm) &&
- lsm->lsm_md_hash_type & LMV_HASH_FLAG_MIGRATION;
+ (lsm->lsm_md_hash_type & LMV_HASH_FLAG_LAYOUT_CHANGE);
}
static inline bool lmv_dir_bad_hash(const struct lmv_stripe_md *lsm)
if (!lmv_dir_striped(lsm))
return false;
- if (lmv_dir_migrating(lsm) &&
- lsm->lsm_md_stripe_count - lsm->lsm_md_migrate_offset <= 1)
- return false;
-
if (lsm->lsm_md_hash_type & LMV_HASH_FLAG_BAD_TYPE)
return true;
return idx;
}
-static inline int lmv_name_to_stripe_index(__u32 hash_type,
- unsigned int stripe_count,
- const char *name, int namelen)
+static inline int
+__lmv_name_to_stripe_index(__u32 hash_type, __u32 stripe_count,
+ __u32 migrate_hash, __u32 migrate_offset,
+ const char *name, int namelen, bool new_layout)
{
- unsigned int idx;
+ __u32 saved_hash = hash_type;
+ __u32 saved_count = stripe_count;
+ int stripe_index = 0;
LASSERT(namelen > 0);
LASSERT(stripe_count > 0);
- if (stripe_count == 1)
- return 0;
+ if (hash_type & LMV_HASH_FLAG_MIGRATION) {
+ if (new_layout) {
+ stripe_count = migrate_offset;
+ } else {
+ hash_type = migrate_hash;
+ stripe_count -= migrate_offset;
+ }
+ }
- switch (hash_type & LMV_HASH_TYPE_MASK) {
- case LMV_HASH_TYPE_ALL_CHARS:
- idx = lmv_hash_all_chars(stripe_count, name, namelen);
- break;
- case LMV_HASH_TYPE_FNV_1A_64:
- idx = lmv_hash_fnv1a(stripe_count, name, namelen);
- break;
- case LMV_HASH_TYPE_CRUSH:
- idx = lmv_hash_crush(stripe_count, name, namelen);
- break;
- default:
- return -EBADFD;
+ if (stripe_count > 1) {
+ switch (hash_type & LMV_HASH_TYPE_MASK) {
+ case LMV_HASH_TYPE_ALL_CHARS:
+ stripe_index = lmv_hash_all_chars(stripe_count, name,
+ namelen);
+ break;
+ case LMV_HASH_TYPE_FNV_1A_64:
+ stripe_index = lmv_hash_fnv1a(stripe_count, name,
+ namelen);
+ break;
+ case LMV_HASH_TYPE_CRUSH:
+ stripe_index = lmv_hash_crush(stripe_count, name,
+ namelen);
+ break;
+ default:
+ return -EBADFD;
+ }
}
- CDEBUG(D_INFO, "name %.*s hash_type %#x idx %d/%u\n", namelen, name,
- hash_type, idx, stripe_count);
+ LASSERT(stripe_index < stripe_count);
- return idx;
+ if ((saved_hash & LMV_HASH_FLAG_MIGRATION) && !new_layout)
+ stripe_index += migrate_offset;
+
+ LASSERT(stripe_index < saved_count);
+
+ CDEBUG(D_INFO, "name %.*s hash %#x/%#x idx %d/%u/%u under %s layout\n",
+ namelen, name, saved_hash, migrate_hash, stripe_index,
+ saved_count, migrate_offset, new_layout ? "new" : "old");
+
+ return stripe_index;
+}
+
+static inline int lmv_name_to_stripe_index(struct lmv_mds_md_v1 *lmv,
+ const char *name, int namelen)
+{
+ if (lmv->lmv_magic == LMV_MAGIC_V1)
+ return __lmv_name_to_stripe_index(lmv->lmv_hash_type,
+ lmv->lmv_stripe_count,
+ lmv->lmv_migrate_hash,
+ lmv->lmv_migrate_offset,
+ name, namelen, true);
+
+ if (lmv->lmv_magic == cpu_to_le32(LMV_MAGIC_V1))
+ return __lmv_name_to_stripe_index(
+ le32_to_cpu(lmv->lmv_hash_type),
+ le32_to_cpu(lmv->lmv_stripe_count),
+ le32_to_cpu(lmv->lmv_migrate_hash),
+ le32_to_cpu(lmv->lmv_migrate_offset),
+ name, namelen, true);
+
+ return -EINVAL;
+}
+
+static inline int lmv_name_to_stripe_index_old(struct lmv_mds_md_v1 *lmv,
+ const char *name, int namelen)
+{
+ if (lmv->lmv_magic == LMV_MAGIC_V1 ||
+ lmv->lmv_magic == LMV_MAGIC_STRIPE)
+ return __lmv_name_to_stripe_index(lmv->lmv_hash_type,
+ lmv->lmv_stripe_count,
+ lmv->lmv_migrate_hash,
+ lmv->lmv_migrate_offset,
+ name, namelen, false);
+
+ if (lmv->lmv_magic == cpu_to_le32(LMV_MAGIC_V1) ||
+ lmv->lmv_magic == cpu_to_le32(LMV_MAGIC_STRIPE))
+ return __lmv_name_to_stripe_index(
+ le32_to_cpu(lmv->lmv_hash_type),
+ le32_to_cpu(lmv->lmv_stripe_count),
+ le32_to_cpu(lmv->lmv_migrate_hash),
+ le32_to_cpu(lmv->lmv_migrate_offset),
+ name, namelen, false);
+
+ return -EINVAL;
}
static inline bool lmv_user_magic_supported(__u32 lum_magic)
static inline bool lmv_is_sane(const struct lmv_mds_md_v1 *lmv)
{
if (le32_to_cpu(lmv->lmv_magic) != LMV_MAGIC_V1)
- return false;
+ goto insane;
if (le32_to_cpu(lmv->lmv_stripe_count) == 0)
- return false;
+ goto insane;
if (!lmv_is_known_hash_type(lmv->lmv_hash_type))
- return false;
+ goto insane;
return true;
+insane:
+ LMV_DEBUG(D_ERROR, lmv, "insane");
+ return false;
}
#endif
__u16 op_mirror_id;
/*
- * used to access migrating dir: if it's set, assume migration is
- * finished, use the new layout to access dir, otherwise use old layout.
+ * used to access dir that is changing layout: if it's set, access
+ * dir by new layout, otherwise old layout.
* By default it's not set, because new files are created under new
* layout, if we can't find file with name under both old and new
* layout, we are sure file with name doesn't exist, but in reverse
* order there may be a race with creation by others.
*/
- bool op_post_migrate;
+ bool op_new_layout;
/* used to access dir with bash hash */
__u32 op_stripe_index;
/* Archive ID for PCC attach */
struct lu_fid lmv_stripe_fids[0]; /* FIDs for each stripe */
};
+#define LMV_DEBUG(mask, lmv, msg) \
+ CDEBUG(mask, "%s LMV: magic %#x count %u index %u hash %#x version %u migrate offset %u migrate hash %u.\n", \
+ msg, (lmv)->lmv_magic, (lmv)->lmv_stripe_count, \
+ (lmv)->lmv_master_mdt_index, (lmv)->lmv_hash_type, \
+ (lmv)->lmv_layout_version, (lmv)->lmv_migrate_offset, \
+ (lmv)->lmv_migrate_hash)
+
/* foreign LMV EA */
struct lmv_foreign_md {
__u32 lfm_magic; /* magic number = LMV_MAGIC_FOREIGN */
#define LMV_HASH_FLAG_BAD_TYPE 0x20000000
#define LMV_HASH_FLAG_MIGRATION 0x80000000
+#define LMV_HASH_FLAG_LAYOUT_CHANGE LMV_HASH_FLAG_MIGRATION
+
extern char *mdt_hash_name[LMV_HASH_TYPE_MAX];
struct lustre_foreign_type {
return idx;
}
+static inline bool lfsck_name_hash_match(struct lmv_mds_md_v1 *lmv,
+ const char *name, int namelen)
+{
+ int idx;
+
+ idx = lmv_name_to_stripe_index_old(lmv, name, namelen);
+ if (idx == lmv->lmv_master_mdt_index)
+ return true;
+
+ if (!(lmv->lmv_hash_type & LMV_HASH_FLAG_LAYOUT_CHANGE))
+ return false;
+
+ idx = lmv_name_to_stripe_index(lmv, name, namelen);
+ return (idx == lmv->lmv_master_mdt_index);
+}
+
bool lfsck_is_valid_slave_name_entry(const struct lu_env *env,
struct lfsck_lmv *llmv,
const char *name, int namelen)
{
- struct lmv_mds_md_v1 *lmv;
- int idx;
-
if (llmv == NULL || !llmv->ll_lmv_slave || !llmv->ll_lmv_verified)
return true;
- lmv = &llmv->ll_lmv;
- idx = lmv_name_to_stripe_index(lmv->lmv_hash_type,
- lmv->lmv_stripe_count,
- name, namelen);
- if (unlikely(idx != lmv->lmv_master_mdt_index))
- return false;
-
- return true;
+ return lfsck_name_hash_match(&llmv->ll_lmv, name, namelen);
}
/**
struct dt_object *child,
const struct lu_name *cname)
{
- struct lmv_mds_md_v1 *lmv = &lfsck_env_info(env)->lti_lmv;
- int idx;
- int rc;
+ struct lmv_mds_md_v1 *lmv = &lfsck_env_info(env)->lti_lmv;
+ int rc;
rc = lfsck_read_stripe_lmv(env, lfsck, parent, lmv);
if (rc != 0)
if (!lfsck_is_valid_slave_lmv(lmv))
return 0;
- idx = lmv_name_to_stripe_index(lmv->lmv_hash_type,
- lmv->lmv_stripe_count,
- cname->ln_name,
- cname->ln_namelen);
- if (unlikely(idx != lmv->lmv_master_mdt_index))
+ if (!lfsck_name_hash_match(lmv, cname->ln_name,
+ cname->ln_namelen))
return 1;
} else if (lfsck_shard_name_to_index(env, cname->ln_name,
cname->ln_namelen, lfsck_object_type(child),
if (lmv_dir_bad_hash(op_data->op_mea1))
RETURN(-EBADF);
- if (lmv_dir_migrating(op_data->op_mea1)) {
+ if (lmv_dir_layout_changing(op_data->op_mea1)) {
if (flags & O_EXCL) {
/*
* open(O_CREAT | O_EXCL) needs to check
* old and new layout, check old layout on
* client side.
*/
- rc = lmv_migrate_existence_check(lmv, op_data);
+ rc = lmv_old_layout_lookup(lmv, op_data);
if (rc != -ENOENT)
RETURN(rc);
- op_data->op_post_migrate = true;
+ op_data->op_new_layout = true;
} else {
/*
* open(O_CREAT) will be sent to MDT in old
/* for file under migrating directory, return the target stripe info */
static inline const struct lmv_oinfo *
lsm_name_to_stripe_info(const struct lmv_stripe_md *lsm, const char *name,
- int namelen, bool post_migrate)
+ int namelen, bool new_layout)
{
- __u32 hash_type = lsm->lsm_md_hash_type;
- __u32 stripe_count = lsm->lsm_md_stripe_count;
int stripe_index;
LASSERT(lmv_dir_striped(lsm));
- if (hash_type & LMV_HASH_FLAG_MIGRATION) {
- if (post_migrate) {
- hash_type &= ~LMV_HASH_FLAG_MIGRATION;
- stripe_count = lsm->lsm_md_migrate_offset;
- } else {
- hash_type = lsm->lsm_md_migrate_hash;
- stripe_count -= lsm->lsm_md_migrate_offset;
- }
- }
-
- stripe_index = lmv_name_to_stripe_index(hash_type, stripe_count,
- name, namelen);
+ stripe_index = __lmv_name_to_stripe_index(lsm->lsm_md_hash_type,
+ lsm->lsm_md_stripe_count,
+ lsm->lsm_md_migrate_hash,
+ lsm->lsm_md_migrate_offset,
+ name, namelen, new_layout);
if (stripe_index < 0)
return ERR_PTR(stripe_index);
- if ((lsm->lsm_md_hash_type & LMV_HASH_FLAG_MIGRATION) && !post_migrate)
- stripe_index += lsm->lsm_md_migrate_offset;
-
- if (stripe_index >= lsm->lsm_md_stripe_count) {
- CERROR("stripe_index %d stripe_count %d hash_type %#x "
- "migrate_offset %d migrate_hash %#x name %.*s\n",
- stripe_index, lsm->lsm_md_stripe_count,
- lsm->lsm_md_hash_type, lsm->lsm_md_migrate_offset,
- lsm->lsm_md_migrate_hash, namelen, name);
- return ERR_PTR(-EBADF);
- }
-
return &lsm->lsm_md_oinfo[stripe_index];
}
if (!lsm)
return false;
- if (lmv_dir_migrating(lsm) && !op_data->op_post_migrate) {
- op_data->op_post_migrate = true;
+ if (lmv_dir_layout_changing(lsm) && !op_data->op_new_layout) {
+ op_data->op_new_layout = true;
return true;
}
struct lmv_tgt_desc *lmv_locate_tgt(struct lmv_obd *lmv,
struct md_op_data *op_data);
-int lmv_migrate_existence_check(struct lmv_obd *lmv,
- struct md_op_data *op_data);
+int lmv_old_layout_lookup(struct lmv_obd *lmv, struct md_op_data *op_data);
/* lproc_lmv.c */
int lmv_tunables_init(struct obd_device *obd);
static struct lmv_tgt_desc *
lmv_locate_tgt_by_name(struct lmv_obd *lmv, struct lmv_stripe_md *lsm,
const char *name, int namelen, struct lu_fid *fid,
- __u32 *mds, bool post_migrate)
+ __u32 *mds, bool new_layout)
{
struct lmv_tgt_desc *tgt;
const struct lmv_oinfo *oinfo;
return ERR_PTR(-EBADF);
oinfo = &lsm->lsm_md_oinfo[cfs_fail_val];
} else {
- oinfo = lsm_name_to_stripe_info(lsm, name, namelen,
- post_migrate);
+ oinfo = lsm_name_to_stripe_info(lsm, name, namelen, new_layout);
if (IS_ERR(oinfo))
return ERR_CAST(oinfo);
}
*
* For striped directory, it will locate the stripe by name hash, if hash_type
* is unknown, it will return the stripe specified by 'op_data->op_stripe_index'
- * which is set outside, and if dir is migrating, 'op_data->op_post_migrate'
+ * which is set outside, and if dir is migrating, 'op_data->op_new_layout'
* indicates whether old or new layout is used to locate.
*
* For plain direcotry, it just locate the MDT of op_data->op_fid1.
tgt = lmv_locate_tgt_by_name(lmv, op_data->op_mea1,
op_data->op_name, op_data->op_namelen,
&op_data->op_fid1, &op_data->op_mds,
- op_data->op_post_migrate);
+ op_data->op_new_layout);
}
return tgt;
int rc;
LASSERT(op_data->op_name);
- if (lmv_dir_migrating(op_data->op_mea2)) {
+ if (lmv_dir_layout_changing(op_data->op_mea2)) {
struct lu_fid fid1 = op_data->op_fid1;
struct lmv_stripe_md *lsm1 = op_data->op_mea1;
struct ptlrpc_request *request = NULL;
&op_data->op_mds, true);
}
-int lmv_migrate_existence_check(struct lmv_obd *lmv, struct md_op_data *op_data)
+int lmv_old_layout_lookup(struct lmv_obd *lmv, struct md_op_data *op_data)
{
struct lu_tgt_desc *tgt;
struct ptlrpc_request *request;
int rc;
- LASSERT(lmv_dir_migrating(op_data->op_mea1));
+ LASSERT(lmv_dir_layout_changing(op_data->op_mea1));
+ LASSERT(!op_data->op_new_layout);
tgt = lmv_locate_tgt(lmv, op_data);
if (IS_ERR(tgt))
if (lmv_dir_bad_hash(op_data->op_mea1))
RETURN(-EBADF);
- if (lmv_dir_migrating(op_data->op_mea1)) {
+ if (lmv_dir_layout_changing(op_data->op_mea1)) {
/*
* if parent is migrating, create() needs to lookup existing
* name in both old and new layout, check old layout on client.
*/
- rc = lmv_migrate_existence_check(lmv, op_data);
+ rc = lmv_old_layout_lookup(lmv, op_data);
if (rc != -ENOENT)
RETURN(rc);
- op_data->op_post_migrate = true;
+ op_data->op_new_layout = true;
}
tgt = lmv_locate_tgt(lmv, op_data);
struct lmv_tgt_desc *tp_tgt = NULL;
struct lmv_tgt_desc *child_tgt;
struct lmv_tgt_desc *tgt;
- struct lu_fid target_fid;
+ struct lu_fid target_fid = { 0 };
int rc;
ENTRY;
RETURN(PTR_ERR(parent_tgt));
if (lmv_dir_striped(lsm)) {
- __u32 hash_type = lsm->lsm_md_hash_type;
- __u32 stripe_count = lsm->lsm_md_stripe_count;
+ const struct lmv_oinfo *oinfo;
- /*
- * old stripes are appended after new stripes for migrating
- * directory.
- */
- if (lmv_dir_migrating(lsm)) {
- hash_type = lsm->lsm_md_migrate_hash;
- stripe_count -= lsm->lsm_md_migrate_offset;
- }
-
- rc = lmv_name_to_stripe_index(hash_type, stripe_count, name,
- namelen);
- if (rc < 0)
- RETURN(rc);
-
- if (lmv_dir_migrating(lsm))
- rc += lsm->lsm_md_migrate_offset;
+ oinfo = lsm_name_to_stripe_info(lsm, name, namelen, false);
+ if (IS_ERR(oinfo))
+ RETURN(PTR_ERR(oinfo));
- /* save it in fid4 temporarily for early cancel */
- op_data->op_fid4 = lsm->lsm_md_oinfo[rc].lmo_fid;
- sp_tgt = lmv_tgt(lmv, lsm->lsm_md_oinfo[rc].lmo_mds);
+ /* save source stripe FID in fid4 temporarily for ELC */
+ op_data->op_fid4 = oinfo->lmo_fid;
+ sp_tgt = lmv_tgt(lmv, oinfo->lmo_mds);
if (!sp_tgt)
RETURN(-ENODEV);
* if parent is being migrated too, fill op_fid2 with target
* stripe fid, otherwise the target stripe is not created yet.
*/
- if (lmv_dir_migrating(lsm)) {
- hash_type = lsm->lsm_md_hash_type &
- ~LMV_HASH_FLAG_MIGRATION;
- stripe_count = lsm->lsm_md_migrate_offset;
-
- rc = lmv_name_to_stripe_index(hash_type, stripe_count,
- name, namelen);
- if (rc < 0)
- RETURN(rc);
-
- op_data->op_fid2 = lsm->lsm_md_oinfo[rc].lmo_fid;
- tp_tgt = lmv_tgt(lmv, lsm->lsm_md_oinfo[rc].lmo_mds);
+ if (lmv_dir_layout_changing(lsm)) {
+ oinfo = lsm_name_to_stripe_info(lsm, name, namelen,
+ true);
+ if (IS_ERR(oinfo))
+ RETURN(PTR_ERR(oinfo));
+
+ op_data->op_fid2 = oinfo->lmo_fid;
+ tp_tgt = lmv_tgt(lmv, oinfo->lmo_mds);
if (!tp_tgt)
RETURN(-ENODEV);
}
if (cplen >= sizeof(lsm->lsm_md_pool_name))
RETURN(-E2BIG);
- CDEBUG(D_INFO, "unpack lsm count %d, master %d hash_type %#x "
+ CDEBUG(D_INFO, "unpack lsm count %d/%d, master %d hash_type %#x/%#x "
"layout_version %d\n", lsm->lsm_md_stripe_count,
- lsm->lsm_md_master_mdt_index, lsm->lsm_md_hash_type,
+ lsm->lsm_md_migrate_offset, lsm->lsm_md_master_mdt_index,
+ lsm->lsm_md_hash_type, lsm->lsm_md_migrate_hash,
lsm->lsm_md_layout_version);
stripe_count = le32_to_cpu(lmm1->lmv_stripe_count);
lc->ldo_dir_stripe_count = 0;
}
- if (lc->ldo_dir_hash_type == LMV_HASH_TYPE_UNKNOWN)
- lc->ldo_dir_hash_type =
+ if (!(lc->ldo_dir_hash_type & LMV_HASH_TYPE_MASK))
+ lc->ldo_dir_hash_type |=
d->lod_mdt_descs.ltd_lmv_desc.ld_pattern;
CDEBUG(D_INFO, "final dir stripe [%hu %d %u]\n",
plmv = pbuf.lb_buf;
if (plmv) {
__u32 hash_type = le32_to_cpu(plmv->lmv_hash_type);
- __u32 count = le32_to_cpu(plmv->lmv_stripe_count);
int index;
- /* locate target parent stripe */
- if (hash_type & LMV_HASH_FLAG_MIGRATION) {
- /*
- * fail check here to make sure top dir migration
- * succeed.
- */
- if (OBD_FAIL_CHECK_RESET(OBD_FAIL_MIGRATE_ENTRIES, 0))
- GOTO(out, rc = -EIO);
- hash_type &= ~LMV_HASH_FLAG_MIGRATION;
- count = le32_to_cpu(plmv->lmv_migrate_offset);
- }
- index = lmv_name_to_stripe_index(hash_type, count,
- lname->ln_name,
+ /* fail check here to make sure top dir migration succeed. */
+ if ((hash_type & LMV_HASH_FLAG_MIGRATION) &&
+ OBD_FAIL_CHECK_RESET(OBD_FAIL_MIGRATE_ENTRIES, 0))
+ GOTO(out, rc = -EIO);
+
+ index = lmv_name_to_stripe_index(plmv, lname->ln_name,
lname->ln_namelen);
if (index < 0)
GOTO(out, rc = index);
/* locate source parent stripe */
if (le32_to_cpu(plmv->lmv_hash_type) &
- LMV_HASH_FLAG_MIGRATION) {
- hash_type = le32_to_cpu(plmv->lmv_migrate_hash);
- count = le32_to_cpu(plmv->lmv_stripe_count) -
- le32_to_cpu(plmv->lmv_migrate_offset);
-
- index = lmv_name_to_stripe_index(hash_type, count,
- lname->ln_name,
- lname->ln_namelen);
- if (index < 0) {
- mdd_object_put(env, tpobj);
+ LMV_HASH_FLAG_LAYOUT_CHANGE) {
+ index = lmv_name_to_stripe_index_old(plmv,
+ lname->ln_name,
+ lname->ln_namelen);
+ if (index < 0)
GOTO(out, rc = index);
- }
- index += le32_to_cpu(plmv->lmv_migrate_offset);
fid_le_to_cpu(fid, &plmv->lmv_stripe_fids[index]);
spobj = mdd_object_find(env, mdd, fid);
- if (IS_ERR(spobj)) {
- mdd_object_put(env, tpobj);
+ if (IS_ERR(spobj))
GOTO(out, rc = PTR_ERR(spobj));
- }
} else {
spobj = tpobj;
mdd_object_get(spobj);
if (ma->ma_valid & MA_LMV) {
/* if parent is striped, lookup on corresponding stripe */
struct lmv_mds_md_v1 *lmv = &ma->ma_lmv->lmv_md_v1;
- __u32 hash_type = le32_to_cpu(lmv->lmv_hash_type);
- __u32 stripe_count = le32_to_cpu(lmv->lmv_stripe_count);
- bool is_migrating = le32_to_cpu(lmv->lmv_hash_type) &
- LMV_HASH_FLAG_MIGRATION;
-
- if (is_migrating) {
- hash_type = le32_to_cpu(lmv->lmv_migrate_hash);
- stripe_count -= le32_to_cpu(lmv->lmv_migrate_offset);
- }
- rc = lmv_name_to_stripe_index(hash_type, stripe_count,
- lname->ln_name,
- lname->ln_namelen);
+ rc = lmv_name_to_stripe_index_old(lmv, lname->ln_name,
+ lname->ln_namelen);
if (rc < 0)
return rc;
- if (le32_to_cpu(lmv->lmv_hash_type) & LMV_HASH_FLAG_MIGRATION)
- rc += le32_to_cpu(lmv->lmv_migrate_offset);
-
fid_le_to_cpu(fid, &lmv->lmv_stripe_fids[rc]);
stripe = mdt_object_find(env, info->mti_mdt, fid);
fid_zero(fid);
rc = mdo_lookup(env, mdt_object_child(stripe), lname, fid,
&info->mti_spec);
- if (rc == -ENOENT && is_migrating) {
+ if (rc == -ENOENT &&
+ (cpu_to_le32(lmv->lmv_hash_type) &
+ LMV_HASH_FLAG_LAYOUT_CHANGE)) {
/*
* if parent is migrating, and lookup child failed on
* source stripe, lookup again on target stripe, if it
*/
mdt_object_put(env, stripe);
- hash_type = le32_to_cpu(lmv->lmv_hash_type);
- stripe_count = le32_to_cpu(lmv->lmv_migrate_offset);
-
- rc = lmv_name_to_stripe_index(hash_type, stripe_count,
- lname->ln_name,
+ rc = lmv_name_to_stripe_index(lmv, lname->ln_name,
lname->ln_namelen);
if (rc < 0)
return rc;
echo_md_build_name(&tmp_ln_name, info->eti_name, id);
}
- idx = lmv_name_to_stripe_index(LMV_HASH_TYPE_FNV_1A_64,
- le32_to_cpu(lmv->lmv_stripe_count),
- tmp_ln_name.ln_name, tmp_ln_name.ln_namelen);
+ idx = lmv_name_to_stripe_index(lmv, tmp_ln_name.ln_name,
+ tmp_ln_name.ln_namelen);
LASSERT(idx < le32_to_cpu(lmv->lmv_stripe_count));
fid_le_to_cpu(&stripe_fid, &lmv->lmv_stripe_fids[idx]);