[Ocfs2-devel] [PATCH 08/15] ocfs2: Add extended attribute support v2

Mark Fasheh mfasheh at suse.com
Thu Jul 10 16:11:19 PDT 2008


On Fri, Jun 27, 2008 at 03:27:35PM +0800, Tiger Yang wrote:
> +static int ocfs2_xattr_has_space_inline(struct ocfs2_inode_info *oi,
> +					struct ocfs2_dinode *di,
> +					int xattrsize)
> +{
> +	int free;
> +
> +	if (xattrsize < OCFS2_MIN_XATTR_INLINE_SIZE)
> +		return 0;
> +
> +	if (oi->ip_dyn_features & OCFS2_INLINE_DATA_FL) {
> +		struct ocfs2_inline_data *idata = &di->id2.i_data;
> +		free = le16_to_cpu(idata->id_count) - le64_to_cpu(di->i_size);
> +	} else {
> +		struct ocfs2_extent_list *el = &di->id2.i_list;
> +		free = (le16_to_cpu(el->l_count) -
> +			le16_to_cpu(el->l_next_free_rec)) *
> +			sizeof(struct ocfs2_extent_rec);
> +	}
> +	if (free >= xattrsize)
> +		return 1;
> +
> +	return 0;
> +}

Btw, neither this, nor any of the other code seems to take symlinks into
account. As far as I can tell, it's valid to set xattrs on a symlink. Is
this correct? If so, we need to handle fast symlinks and also symlinks with
extents. Though I suppose symlinks using extents probably don't need any
extra work since they otherwise look like regular files.




--
Mark Fasheh



More information about the Ocfs2-devel mailing list