164
167
* dump_block_check
167
void dump_block_check(FILE *out, struct ocfs2_block_check *bc)
170
void dump_block_check(FILE *out, struct ocfs2_block_check *bc, void *block)
172
struct ocfs2_block_check tmp = *bc;
175
/* Re-compute based on what we got from disk */
176
ocfs2_compute_meta_ecc(gbls.fs, block, bc);
178
crc_fail = memcmp(bc, &tmp, sizeof(*bc));
169
180
fprintf(out, "\tCRC32: %.8"PRIx32" ECC: %.4"PRIx16"\n",
170
le32_to_cpu(bc->bc_crc32e), le16_to_cpu(bc->bc_ecc));
181
le32_to_cpu(tmp.bc_crc32e), le16_to_cpu(tmp.bc_ecc));
183
fprintf(out, "\t**FAILED CHECKSUM** Computed CRC32: %.8"
184
PRIx32" ECC: %.4"PRIx16"\n",
185
le32_to_cpu(bc->bc_crc32e), le16_to_cpu(bc->bc_ecc));
187
/* Leave the block as we found it. */
284
304
fprintf(out, "\tmtime_nsec: 0x%08"PRIx32" -- %u\n",
285
305
in->i_mtime_nsec, in->i_mtime_nsec);
307
fprintf(out, "\tRefcount Block: %"PRIu64"\n",
308
(uint64_t)in->i_refcount_loc);
287
310
fprintf(out, "\tLast Extblk: %"PRIu64" Orphan Slot: %d\n",
288
311
(uint64_t)in->i_last_eb_blk, in->i_orphaned_slot);
289
312
if (in->i_suballoc_slot == (uint16_t)OCFS2_INVALID_SLOT)
290
313
strcpy(tmp_str, "Global");
292
315
sprintf(tmp_str, "%d", in->i_suballoc_slot);
293
fprintf(out, "\tSub Alloc Slot: %s Sub Alloc Bit: %u\n",
316
fprintf(out, "\tSub Alloc Slot: %s Sub Alloc Bit: %u",
294
317
tmp_str, in->i_suballoc_bit);
319
if (in->i_suballoc_loc)
320
fprintf(out, " Sub Alloc Group %"PRIu64"\n",
296
325
if (in->i_flags & OCFS2_BITMAP_FL)
297
326
fprintf(out, "\tBitmap Total: %u Used: %u Free: %u\n",
298
327
in->id1.bitmap1.i_total, in->id1.bitmap1.i_used,
517
dump_dir_entry(dirent, offset, gbls.fs->fs_blocksize, NULL,
577
dump_dir_entry(dirent, 0, offset, gbls.fs->fs_blocksize, NULL,
519
579
offset += dirent->rec_len;
583
static void dump_dx_entry(FILE *out, int i, struct ocfs2_dx_entry *dx_entry)
585
fprintf(out, "\t %-2d (0x%08x 0x%08x) %-13"PRIu64"\n",
586
i, dx_entry->dx_major_hash, dx_entry->dx_minor_hash,
587
(uint64_t)dx_entry->dx_dirent_blk);
590
static void dump_dx_entry_list(FILE *out, struct ocfs2_dx_entry_list *dl_list,
595
fprintf(out, "\tCount: %u Num Used: %u\n",
596
dl_list->de_count, dl_list->de_num_used);
599
fprintf(out, "\t## %-11s %-13s\n", "Hash (Major Minor)",
602
for (i = 0; i < dl_list->de_num_used; i++)
603
dump_dx_entry(out, i, &dl_list->de_entries[i]);
607
void dump_dx_root(FILE *out, struct ocfs2_dx_root_block *dr)
610
GString *flags = NULL;
612
flags = g_string_new(NULL);
613
if (dr->dr_flags & OCFS2_DX_FLAG_INLINE)
614
g_string_append(flags, "Inline ");
616
fprintf(out, "\tDir Index Root: %"PRIu64" FS Generation: %u (0x%x)\n",
617
(uint64_t)dr->dr_blkno, dr->dr_fs_generation,
618
dr->dr_fs_generation);
620
fprintf(out, "\tClusters: %u Last Extblk: %"PRIu64" "
621
"Dir Inode: %"PRIu64"\n",
622
dr->dr_clusters, (uint64_t)dr->dr_last_eb_blk,
623
(uint64_t)dr->dr_dir_blkno);
625
if (dr->dr_suballoc_slot == (uint16_t)OCFS2_INVALID_SLOT)
626
strcpy(tmp_str, "Invalid Slot");
628
sprintf(tmp_str, "%d", dr->dr_suballoc_slot);
629
fprintf(out, "\tSub Alloc Slot: %s Sub Alloc Bit: %u",
630
tmp_str, dr->dr_suballoc_bit);
632
if (dr->dr_suballoc_loc)
633
fprintf(out, " SubAlloc Group: %"PRIu64"\n",
634
dr->dr_suballoc_loc);
638
fprintf(out, "Flags: (0x%x) %s\n", dr->dr_flags, flags->str);
640
fprintf(out, "\tTotal Entry Count: %d\n", dr->dr_num_entries);
642
dump_block_check(out, &dr->dr_check, dr);
644
if (dr->dr_flags & OCFS2_DX_FLAG_INLINE)
645
dump_dx_entry_list(out, &dr->dr_entries, 0);
648
g_string_free(flags, 1);
651
void dump_dx_leaf (FILE *out, struct ocfs2_dx_leaf *dx_leaf)
653
fprintf(out, "\tDir Index Leaf: %"PRIu64" FS Generation: %u (0x%x)\n",
654
(uint64_t)dx_leaf->dl_blkno, dx_leaf->dl_fs_generation,
655
dx_leaf->dl_fs_generation);
656
dump_block_check(out, &dx_leaf->dl_check, dx_leaf);
658
dump_dx_entry_list(out, &dx_leaf->dl_list, 1);
661
static int entries_iter(ocfs2_filesys *fs,
662
struct ocfs2_dx_entry_list *entry_list,
663
struct ocfs2_dx_root_block *dx_root,
664
struct ocfs2_dx_leaf *dx_leaf,
667
FILE *out = priv_data;
670
dump_dx_leaf(out, dx_leaf);
674
/* Inline entries. Dump the list directly. */
675
dump_dx_entry_list(out, entry_list, 1);
680
void dump_dx_entries(FILE *out, struct ocfs2_dinode *inode)
682
struct ocfs2_dx_root_block *dx_root;
687
if (ocfs2_malloc_block(gbls.fs->fs_io, &buf))
690
if (!(ocfs2_dir_indexed(inode)))
693
dx_blkno = (uint64_t) inode->i_dx_root;
695
ret = ocfs2_read_dx_root(gbls.fs, dx_blkno, buf);
699
dx_root = (struct ocfs2_dx_root_block *)buf;
700
dump_dx_root(out, dx_root);
702
ocfs2_dx_entries_iterate(gbls.fs, inode, 0, entries_iter, out);
706
static int dx_space_iter(ocfs2_filesys *fs,
708
struct ocfs2_dir_block_trailer *trailer,
712
FILE *out = priv_data;
714
dump_dir_trailer(out, trailer);
719
void dump_dx_space(FILE *out, struct ocfs2_dinode *inode,
720
struct ocfs2_dx_root_block *dx_root)
722
ocfs2_dx_frees_iterate(gbls.fs, inode, dx_root, 0, dx_space_iter, out);
524
726
* dump_jbd_header()
1028
1231
" %u\textents: %u\tscore: %.0f\n", ino,
1029
1232
frag_level, clusters, extents, frag_level * clusters_per_mb);
1235
void dump_refcount_block(FILE *out, struct ocfs2_refcount_block *rb)
1237
char flags[PATH_MAX];
1239
fprintf(out, "\tSubAlloc Bit: %u SubAlloc Slot: %u",
1240
rb->rf_suballoc_bit, rb->rf_suballoc_slot);
1242
if (rb->rf_suballoc_loc)
1243
fprintf(out, " SubAlloc Group: %"PRIu64"\n",
1244
rb->rf_suballoc_loc);
1248
fprintf(out, "\tFS Generation: %u (0x%x)\n", rb->rf_fs_generation,
1249
rb->rf_fs_generation);
1250
fprintf(out, "\tBlknum: %"PRIu64" Parent: %"PRIu64"\n",
1251
(uint64_t)rb->rf_blkno, (uint64_t)rb->rf_parent);
1252
fprintf(out, "\tCpos: %"PRIu64" Last Leaf block: %"PRIu64"\n",
1253
(uint64_t)rb->rf_cpos, (uint64_t)rb->rf_last_eb_blk);
1254
fprintf(out, "\tReftree Count: %u Ref clusters: %u\n",
1255
rb->rf_count, rb->rf_clusters);
1258
if (ocfs2_snprint_refcount_flags(flags, PATH_MAX, rb->rf_flags))
1260
fprintf(out, "\tFlags: 0x%x %s\n", rb->rf_flags, flags);
1261
dump_block_check(out, &rb->rf_check, rb);
1267
void dump_refcount_records(FILE *out, struct ocfs2_refcount_block *rb)
1270
struct ocfs2_refcount_list *rl = &rb->rf_records;
1272
fprintf(out, "\tRefcount records: %u Used: %u\n",
1273
rl->rl_count, rl->rl_used);
1274
fprintf(out, "\t### %-20s %-12s %-12s\n", "Physical cpos",
1275
"Clusters", "Reference count");
1277
for (i = 0; i < rl->rl_used; i++) {
1279
"\t%-3d %-20"PRIu64" %-12"PRIu32" %"PRIu32"\n",
1280
i, rl->rl_recs[i].r_cpos, rl->rl_recs[i].r_clusters,
1281
rl->rl_recs[i].r_refcount);