[Ocfs2-tools-devel] [PATCH 1/1] Ocfs2-tools: Add new corruptions of inline-data for fswreck.

Tao Ma tao.ma at oracle.com
Mon Sep 8 02:04:36 PDT 2008


Hi Tristan,
	The patch looks great. Just some minor comments. ;)

Tristan Ye wrote:

> +void mess_up_inline_flag(ocfs2_filesys *fs, uint64_t blkno)
> +{
> +
> +	int i;
> +	errcode_t ret;
> +	char *buf = NULL;
> +	uint64_t inline_blkno;
> +	struct ocfs2_dinode *di;
> +
> +	for (i = 0; i < 2; i++) {
> +		if (i == 0)
> +			create_file(fs, blkno, &inline_blkno);
> +		else
> +			create_directory(fs, blkno, &inline_blkno);
> +
> +		ret = ocfs2_malloc_block(fs->fs_io, &buf);
> +		if (ret)
> +			FSWRK_COM_FATAL(progname, ret);
you can move this malloc out of "for" so that it will only be allocated 
once while current it will be alloced and freed "i" times. The same goes 
with mess_up_inline_count.
And as for mess_up_inline_flag, it should be used to test an 
old-formatted volume with a inlined file, so you'd better bail out if 
this volume is already formatted with inline-data supported.

btw, could you please add some output so that user can know what's 
happening. See how other corrupt code do as a reference.

Regards,
Tao



More information about the Ocfs2-tools-devel mailing list