[Ocfs2-tools-devel] [PATCH 1/1] ocfs2-tools: add testi command support for debugfs.ocfs2

Tao Ma tao.ma at oracle.com
Thu Mar 19 02:15:46 PDT 2009


Hi Jeff,
	thanks for your work. A few comments below.

1. you need to run checkpatch.pl to check whether your patch has some 
style problem.
WARNING: line over 80 characters
#54: FILE: debugfs.ocfs2/commands.c:1795:
+		com_err(args[0], ret, "Inode %"PRIu64" is marked in use", blkno);

2. You need to add this command to "do_help" so that it show up in 
"help". debugfs.ocfs2.8.in may also need to be updated.

Jeff Liu wrote:
> This patch add testi command for debugfs.ocfs2, it used for testing
> if the inode filespec is marked as allocated in the inode bitmap.
> 
> Signed-off-by: Jeff Liu <jeff.liu at oracle.com>
> ---
>  debugfs.ocfs2/commands.c |   29 +++++++++++++++++++++++++++++
>  1 files changed, 29 insertions(+), 0 deletions(-)
> 
> diff --git a/debugfs.ocfs2/commands.c b/debugfs.ocfs2/commands.c
> index 0dea23f..b78bceb 100644
> --- a/debugfs.ocfs2/commands.c
> +++ b/debugfs.ocfs2/commands.c
> @@ -74,6 +74,7 @@ static void do_icheck (char **args);
>  static void do_dlm_locks (char **args);
>  static void do_controld(char **args);
>  static void do_dirblocks(char **args);
> +static void do_testi(char **args);
>  
>  dbgfs_gbls gbls;
>  
> @@ -110,6 +111,7 @@ static Command commands[] = {
>  	{ "encode",	do_encode_lockres },
>  	{ "decode",	do_decode_lockres },
>  	{ "dirblocks",	do_dirblocks },
> +	{ "testi",	do_testi },
>  };
>  
>  /*
> @@ -1769,3 +1771,30 @@ static void do_icheck(char **args)
>  
>  	return;
>  }
> +
> +/*
> + * do_testi()
> + *
> + */
> +static void do_testi(char **args)
> +{
> +	errcode_t ret = 0;
> +	uint64_t blkno;
> +	int set;
> +
> +	if (process_inode_args(args, &blkno) != 0)
> +		return ;
> +
> +	ret = ocfs2_test_inode_allocated(gbls.fs, blkno, &set);
> +	if (ret) {
> +		com_err(args[0], ret, "while reading inode %"PRIu64"", blkno);
> +		return ;
> +	}
> +
> +	if (set)
> +		com_err(args[0], ret, "Inode %"PRIu64" is marked in use", blkno);
> +	else
> +		com_err(args[0], ret, "Inode %"PRIu64" is not in use", blkno);
This should be print out like result, not in com_err. Take dump* as an 
example.

Regards,
Tao



More information about the Ocfs2-tools-devel mailing list