Whamcloud - gitweb
LU-14798 lustre: Support RDMA only pages
[fs/lustre-release.git] / lustre / include / lustre_lmv.h
index 811da36..abb89a3 100644 (file)
@@ -116,16 +116,20 @@ lsm_md_eq(const struct lmv_stripe_md *lsm1, const struct lmv_stripe_md *lsm2)
 
 static inline void lsm_md_dump(int mask, const struct lmv_stripe_md *lsm)
 {
+       bool valid_hash = lmv_dir_bad_hash(lsm);
        int i;
 
        /* If lsm_md_magic == LMV_MAGIC_FOREIGN pool_name may not be a null
         * terminated string so only print LOV_MAXPOOLNAME bytes.
         */
        CDEBUG(mask,
-              "magic %#x stripe count %d master mdt %d hash type %#x max inherit %hhu version %d migrate offset %d migrate hash %#x pool %.*s\n",
+              "magic %#x stripe count %d master mdt %d hash type %s:%#x max inherit %hhu version %d migrate offset %d migrate hash %#x pool %.*s\n",
               lsm->lsm_md_magic, lsm->lsm_md_stripe_count,
-              lsm->lsm_md_master_mdt_index, lsm->lsm_md_hash_type,
-              lsm->lsm_md_max_inherit, lsm->lsm_md_layout_version,
+              lsm->lsm_md_master_mdt_index,
+              valid_hash ? "invalid hash" :
+                           mdt_hash_name[lsm->lsm_md_hash_type & (LMV_HASH_TYPE_MAX - 1)],
+              lsm->lsm_md_hash_type, lsm->lsm_md_max_inherit,
+              lsm->lsm_md_layout_version,
               lsm->lsm_md_migrate_offset, lsm->lsm_md_migrate_hash,
               LOV_MAXPOOLNAME, lsm->lsm_md_pool_name);
 
@@ -403,6 +407,17 @@ static inline bool lmv_user_magic_supported(__u32 lum_magic)
               lum_magic == LMV_MAGIC_FOREIGN;
 }
 
+#define LMV_DEBUG(mask, lmv, msg)                                      \
+       CDEBUG(mask,                                                    \
+              "%s LMV: magic=%#x count=%u index=%u hash=%s:%#x version=%u migrate offset=%u migrate hash=%s:%u.\n",\
+              msg, (lmv)->lmv_magic, (lmv)->lmv_stripe_count,          \
+              (lmv)->lmv_master_mdt_index,                             \
+              mdt_hash_name[(lmv)->lmv_hash_type & (LMV_HASH_TYPE_MAX - 1)],\
+              (lmv)->lmv_hash_type, (lmv)->lmv_layout_version,         \
+              (lmv)->lmv_migrate_offset,                               \
+              mdt_hash_name[(lmv)->lmv_migrate_hash & (LMV_HASH_TYPE_MAX - 1)],\
+              (lmv)->lmv_migrate_hash)
+
 /* master LMV is sane */
 static inline bool lmv_is_sane(const struct lmv_mds_md_v1 *lmv)
 {
@@ -489,4 +504,9 @@ static inline bool lmv_is_layout_changing(const struct lmv_mds_md_v1 *lmv)
               lmv_hash_is_migrating(cpu_to_le32(lmv->lmv_hash_type));
 }
 
+static inline bool lmv_is_fixed(const struct lmv_mds_md_v1 *lmv)
+{
+       return cpu_to_le32(lmv->lmv_hash_type) & LMV_HASH_FLAG_FIXED;
+}
+
 #endif