- const struct lov_ost_data_v1 *lod;
- int i;
- __u16 count;
-
- count = le16_to_cpu(((struct lov_user_md*)lmm)->lmm_stripe_count);
-
- CDEBUG(level, "objid "LPX64", magic 0x%08X, pattern %#X\n",
- le64_to_cpu(lmm->lmm_object_id), le32_to_cpu(lmm->lmm_magic),
- le32_to_cpu(lmm->lmm_pattern));
- CDEBUG(level,"stripe_size=0x%x, stripe_count=0x%x\n",
- le32_to_cpu(lmm->lmm_stripe_size), count);
- if (count == LOV_ALL_STRIPES)
- return;
- LASSERT(count <= LOV_MAX_STRIPE_COUNT);
- for (i = 0, lod = lmm->lmm_objects; i < count; i++, lod++)
- CDEBUG(level, "stripe %u idx %u subobj "LPX64"/"LPX64"\n",
- i, le32_to_cpu(lod->l_ost_idx),
- le64_to_cpu(lod->l_object_seq),
- le64_to_cpu(lod->l_object_id));
+ const struct lov_ost_data_v1 *lod;
+ int i;
+ __u16 count;
+
+ if (likely(!cfs_cdebug_show(level, DEBUG_SUBSYSTEM)))
+ return;
+
+ count = le16_to_cpu(((struct lov_user_md *)lmm)->lmm_stripe_count);
+
+ CDEBUG(level, "objid "DOSTID", magic 0x%08X, pattern %#X\n",
+ POSTID(&lmm->lmm_oi), le32_to_cpu(lmm->lmm_magic),
+ le32_to_cpu(lmm->lmm_pattern));
+ CDEBUG(level, "stripe_size=0x%x, stripe_count=0x%x\n",
+ le32_to_cpu(lmm->lmm_stripe_size), count);
+
+ /* If it's a directory or a released file, then there are
+ * no actual objects to print, so bail out. */
+ if (valid & OBD_MD_FLDIREA ||
+ le32_to_cpu(lmm->lmm_pattern) & LOV_PATTERN_F_RELEASED)
+ return;
+
+ LASSERT(count <= LOV_MAX_STRIPE_COUNT);
+ for (i = 0, lod = lmm->lmm_objects; i < count; i++, lod++) {
+ struct ost_id oi;
+
+ ostid_le_to_cpu(&lod->l_ost_oi, &oi);
+ CDEBUG(level, "stripe %u idx %u subobj "DOSTID"\n",
+ i, le32_to_cpu(lod->l_ost_idx), POSTID(&oi));
+ }
+}
+
+void mdt_dump_lmv(unsigned int level, const union lmv_mds_md *lmv)
+{
+ const struct lmv_mds_md_v1 *lmm1;
+ int i;
+
+ if (likely(!cfs_cdebug_show(level, DEBUG_SUBSYSTEM)))
+ return;
+
+ lmm1 = &lmv->lmv_md_v1;
+ CDEBUG(level, "magic 0x%08X, master %#X stripe_count %#x\n",
+ le32_to_cpu(lmm1->lmv_magic),
+ le32_to_cpu(lmm1->lmv_master_mdt_index),
+ le32_to_cpu(lmm1->lmv_stripe_count));
+
+ if (le32_to_cpu(lmm1->lmv_magic) == LMV_MAGIC_STRIPE)
+ return;
+
+ for (i = 0; i < le32_to_cpu(lmm1->lmv_stripe_count); i++) {
+ struct lu_fid fid;
+
+ fid_le_to_cpu(&fid, &lmm1->lmv_stripe_fids[i]);
+ CDEBUG(level, "idx %u subobj "DFID"\n", i, PFID(&fid));
+ }