Whamcloud - gitweb
LU-4684 migrate: migrate striped directory
[fs/lustre-release.git] / lustre / lmv / lmv_internal.h
index c2dcfed..899007a 100644 (file)
@@ -122,14 +122,21 @@ static inline int lmv_stripe_md_size(int stripe_count)
        return sizeof(*lsm) + stripe_count * sizeof(lsm->lsm_md_oinfo[0]);
 }
 
+/* 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)
 {
+       __u32 hash_type = lsm->lsm_md_hash_type;
+       __u32 stripe_count = lsm->lsm_md_stripe_count;
        int stripe_index;
 
-       stripe_index = lmv_name_to_stripe_index(lsm->lsm_md_hash_type,
-                                               lsm->lsm_md_stripe_count,
+       if (hash_type & LMV_HASH_FLAG_MIGRATION) {
+               hash_type &= ~LMV_HASH_FLAG_MIGRATION;
+               stripe_count = lsm->lsm_md_migrate_offset;
+       }
+
+       stripe_index = lmv_name_to_stripe_index(hash_type, stripe_count,
                                                name, namelen);
        if (stripe_index < 0)
                return ERR_PTR(stripe_index);