[Ocfs2-tools-devel] [PATCH 12/19] Ocfs2-tools: Add running codes for '--space-usage' in operation.c

Sunil Mushran sunil.mushran at oracle.com
Fri Apr 16 16:16:51 PDT 2010


nak for now

Tristan Ye wrote:
> Signed-off-by: Tristan Ye <tristan.ye at oracle.com>
> ---
>  o2info/operations.c |   29 +++++++++++++++++++++++++++++
>  1 files changed, 29 insertions(+), 0 deletions(-)
>
> diff --git a/o2info/operations.c b/o2info/operations.c
> index 68e8cdd..c4fa7fc 100644
> --- a/o2info/operations.c
> +++ b/o2info/operations.c
> @@ -524,3 +524,32 @@ static int get_fiemap_stats(struct o2info_operation *op,
>  	return ret;
>  }
>  
> +static int usage_run(struct o2info_operation *op,
> +		     struct o2info_method *om,
> +		     void *arg)
> +{
> +	int rc = 0;
> +	struct stat st;
> +	static struct o2info_fiemap_stats ofs;
> +
> +	rc = lstat(om->om_path, &st);
> +	if (rc < 0) {
> +		rc = errno;
> +		o2i_error(op, "stat error: %s\n", strerror(rc));
> +		return -1;
> +	}
> +
> +	rc = get_fiemap_stats(op, om, &ofs);
> +	if (rc)
> +		return rc;
> +
> +	fprintf(stdout, "Blocks: %-10u Shared: %-10u\tUnwritten: %-7u "
> +		"Holes: %-6u\n", st.st_blocks, ofs.shared, ofs.unwrittens,
> +		ofs.holes);
> +
> +	return rc;
> +}
> +
> +DEFINE_O2INFO_OP(usage,
> +		 usage_run,
> +		 NULL);
>   




More information about the Ocfs2-tools-devel mailing list