[Ocfs2-tools-devel] [PATCH 5/6] Resend: Add unwritten extent support in ocfs2-tools, take 3

Mark Fasheh mark.fasheh at oracle.com
Tue Oct 2 17:19:38 PDT 2007


On Thu, Sep 27, 2007 at 04:50:54PM +0800, tao.ma wrote:
> Modification from V2->V3:
> 1. Modify some comments which is not suitable in ocfs2-tools.
> 2. Add the backup extent block mechanism in ocfs2_mark_extent_written, so that
>    if any corruption happens during the operation, the inode will not
>    be corrupted. As for ocfs2_allocate_unwritten_extents, since it call
>    ocfs2_insert_extent to insert the unwritten extents and ocfs2_insert_extent
>    already has backup extent block enabled, any corruption will not affect
>    the modified inode.

Ok, though that wasn't exactly how I thought you'd solve the problem ;)

That approach looks fine - we're going to get to test your duplication code
now. Ultimately though, we have to make that stuff smarter in the number of
blocks that it changes. And since it's doing copy on write, we don't need to
go through the entire rotation path - just write out a new tree as we'd like
to see it on disk. Either that or we start journaling.


Only one small comment below - fix that and I'll sob.

> +errcode_t ocfs2_allocate_unwritten_extents(ocfs2_filesys *fs, uint64_t ino,
> +					   uint64_t offset, uint64_t len)
> +{
> +	errcode_t ret = 0;
> +	uint32_t n_clusters = 0, cpos;
> +	uint64_t p_blkno, v_blkno, v_end, contig_blocks, wanted_blocks;
> +	ocfs2_cached_inode *ci = NULL;
> +
> +	if (!(fs->fs_flags & OCFS2_FLAG_RW))
> +		return OCFS2_ET_RO_FILESYS;
> +
> +	if (!ocfs2_writes_unwritten_extents(OCFS2_RAW_SB(fs->fs_super)))
> +		return OCFS2_ET_RO_UNSUPP_FEATURE;
> +
> +	ret = ocfs2_read_cached_inode(fs, ino, &ci);
> +	if (ret)
> +		goto out;
> +
> +	if (!(ci->ci_inode->i_flags & OCFS2_VALID_FL))
> +		return OCFS2_ET_INODE_NOT_VALID;
> +
> +	if (ci->ci_inode->i_flags & (OCFS2_SUPER_BLOCK_FL |
> +	    OCFS2_LOCAL_ALLOC_FL | OCFS2_CHAIN_FL | OCFS2_DEALLOC_FL))
> +		return OCFS2_ET_INVALID_ARGUMENT;

You only have to check for OCFS2_SYSTEM_FL flag here.
	--Mark

--
Mark Fasheh
Senior Software Developer, Oracle
mark.fasheh at oracle.com



More information about the Ocfs2-tools-devel mailing list