[Ocfs2-tools-devel] [PATCH 02/15] dx_dirs v11: debugfs.ocfs2 support

Tao Ma tao.ma at oracle.com
Fri Apr 23 00:34:17 PDT 2010


Hi Coly,

Coly Li wrote:
> This adds a full set of functionality to debugfs.ocfs2 so that we can
> visualize and debug indexed directories. Aside
> from updates to other commands to dump newly added/used fields in old
> structures, we get the following debugfs.ocfs2 commands:
> 
> dx_space - Show all entries in the free list
> dx_dump  - Show the directory index (including root block)
> dx_leaf  - Show a single directory index leaf block
> dx_root  - Show directory index root block, as well as any extent blocks
>            for non-inline dx_roots.
> 
> [modified the patch for code rebase and cleanup -- Coly Li]
> 
> Signed-off-by: Mark Fasheh <mfasheh at suse.com>
<snip>
> +void dump_dx_root(FILE *out, struct ocfs2_dx_root_block *dr)
> +{
> +	char tmp_str[30];
> +	GString *flags = NULL;
> +
> +	flags = g_string_new(NULL);
> +	if (dr->dr_flags & OCFS2_DX_FLAG_INLINE)
> +		g_string_append(flags, "Inline ");
> +
> +	fprintf(out, "\tDir Index Root: %"PRIu64"   FS Generation: %u (0x%x)\n",
> +		(uint64_t)dr->dr_blkno, dr->dr_fs_generation,
> +		dr->dr_fs_generation);
> +
> +	fprintf(out, "\tClusters: %u   Last Extblk: %"PRIu64"   "
> +		"Dir Inode: %"PRIu64"\n",
> +		dr->dr_clusters, (uint64_t)dr->dr_last_eb_blk,
> +		(uint64_t)dr->dr_dir_blkno);
> +
> +	if (dr->dr_suballoc_slot == (uint16_t)OCFS2_INVALID_SLOT)
> +		strcpy(tmp_str, "Global");
Can we have a dx_root from "Global"? I am afraid not. ;)
> +	else
> +		sprintf(tmp_str, "%d", dr->dr_suballoc_slot);

Regards,
Tao



More information about the Ocfs2-tools-devel mailing list