[Ocfs2-test-devel] [PATCH 4/9] Ocfs2-test: Add utility funcs for both single-node and multi-nodes tests.

Tao Ma tao.ma at oracle.com
Mon Mar 23 19:51:45 PDT 2009


Hi Tristan,
	Just some minor comments.
	I see a large part of this patch isn't concerned with reflink 
operation. Just about read/write and mmap. So is there any possibility 
that we can create a lib for it. So that our future test can use it(just 
like some general functions we create in libocfs2 of ocfs2-tools).

Tristan Ye wrote:
> All common funcs shared by single-node and multi-nodes testing binaries
> gathered here.
> 
> Signed-off-by: Tristan Ye <tristan.ye at oracle.com>
<snip>
> +extern int open_ocfs2_volume(char *device_name)
> +{
> +	int open_flags = OCFS2_FLAG_HEARTBEAT_DEV_OK | OCFS2_FLAG_RO;
> +	int ret;
> +	uint64_t superblock = 0, block_size = 0;
> +
> +	ret = ocfs2_open(device_name, open_flags, superblock, block_size,
> +			 &fs);
> +	if (ret < 0) {
> +		fprintf(stderr, "Not a ocfs2 volume!\n");
ocfs2_open's return value give the right answer. So use it please 
because it may be caused other issues.
> +		return ret;
> +	}
> +
> +	ocfs2_sb = OCFS2_RAW_SB(fs->fs_super);
> +	if (!(ocfs2_sb->s_feature_incompat &
> +	      OCFS2_FEATURE_INCOMPAT_REFCOUNT_TREE)) {
> +		fprintf(stderr, "refcount is not supported"
> +			" on this ocfs2 volume\n");
> +		return -1;
> +	}
> +
> +	blocksize = 1 << ocfs2_sb->s_blocksize_bits;
> +	clustersize = 1 << ocfs2_sb->s_clustersize_bits;
> +	max_inline_size = ocfs2_max_inline_data(blocksize);
I never seen ocfs2_close in your patch. So it is in another file?
> +
> +	return 0;
> +}

Regards,
Tao



More information about the Ocfs2-test-devel mailing list