[Ocfs2-tools-devel] [PATCH 2/6] libocfs2: extend xattr and xattr value tree

Tao Ma tao.ma at oracle.com
Wed Jul 29 02:23:06 PDT 2009



Tiger Yang wrote:
> Add ocfs2_tree_extend_allocation and ocfs2_tree_insert_extent
> for extending xattr record and xattr value tree.
> On the other hand, use ocfs2_extend_allocation and
> ocfs2_inode_insert_extent extend file data tree.
> 
> Signed-off-by: Tiger Yang <tiger.yang at oracle.com>
> ---
>  fswreck/extent.c                    |    4 +-
>  include/ocfs2/ocfs2.h               |    9 +-
>  libocfs2/extend_file.c              |  396 +++++++++++++++++++++++------------
>  libocfs2/xattr.c                    |    3 +-
>  tunefs.ocfs2/feature_sparse_files.c |    2 +-
>  5 files changed, 276 insertions(+), 138 deletions(-)
> 
> diff --git a/fswreck/extent.c b/fswreck/extent.c
> index e3fe020..2970cd9 100644
> --- a/fswreck/extent.c
> +++ b/fswreck/extent.c
> @@ -103,8 +103,8 @@ static void custom_extend_allocation(ocfs2_filesys *fs, uint64_t ino,
>  		 * we insert each cluster in reverse. */
>  		for(i = n_clusters; i; --i) {
>  			tmpblk = blkno + ocfs2_clusters_to_blocks(fs, i - 1);
> -		 	ret = ocfs2_insert_extent(fs, ino, offset++,
> -						  tmpblk, 1, 0);
> +			ret = ocfs2_inode_insert_extent(fs, ino, offset++,
> +							tmpblk, 1, 0);
>  			if (ret) 
>  				FSWRK_COM_FATAL(progname, ret);	
>  		}
> diff --git a/include/ocfs2/ocfs2.h b/include/ocfs2/ocfs2.h
> index 3c4195c..a171089 100644
> --- a/include/ocfs2/ocfs2.h
> +++ b/include/ocfs2/ocfs2.h
> @@ -507,9 +507,9 @@ void ocfs2_init_group_desc(ocfs2_filesys *fs,
>  errcode_t ocfs2_new_dir_block(ocfs2_filesys *fs, uint64_t dir_ino,
>  			      uint64_t parent_ino, char **block);
>  
> -errcode_t ocfs2_insert_extent(ocfs2_filesys *fs, uint64_t ino, uint32_t cpos,
> -			      uint64_t c_blkno, uint32_t clusters,
> -			      uint16_t flag);
> +errcode_t ocfs2_inode_insert_extent(ocfs2_filesys *fs, uint64_t ino,
> +				    uint32_t cpos, uint64_t c_blkno,
> +				    uint32_t clusters, uint16_t flag);
>  errcode_t ocfs2_cached_inode_insert_extent(ocfs2_cached_inode *ci,
>  					   uint32_t cpos, uint64_t c_blkno,
>  					   uint32_t clusters, uint16_t flag);
> @@ -1117,7 +1117,8 @@ errcode_t ocfs2_block_iterate_inode(ocfs2_filesys *fs,
>  uint32_t ocfs2_xattr_uuid_hash(unsigned char *uuid);
>  uint32_t ocfs2_xattr_name_hash(uint32_t uuid_hash, const char *name,
>  			       int name_len);
> -int ocfs2_xattr_find_leaf(ocfs2_filesys *fs, struct ocfs2_xattr_block *xb,
> +int ocfs2_xattr_find_leaf(ocfs2_filesys *fs, struct ocfs2_extent_list *el,
> +			  uint64_t el_blkno, char *el_blk,
Oh, I see you change the prototype and now it isn't xattr related. 
Perfect. But maybe we can rename it to ocfs2_find_leaf like we do in the 
kernel?
> +errcode_t ocfs2_tree_insert_extent(ocfs2_cached_inode *ci,
> +				   uint32_t cpos, uint64_t c_blkno,
> +				   uint32_t clusters, uint16_t flag,
> +				   struct ocfs2_extent_tree *et)
I guess this function is 90% similar to 
ocfs2_cached_inode_insert_extent. Any reason you want to copy it? In 
kernel, we only have one ocfs2_insert_extent.

Regards,
Tao



More information about the Ocfs2-tools-devel mailing list