[Ocfs2-devel] [PATCH 6/8] Add extent tree operation for xattr value.v1
Mark Fasheh
mfasheh at suse.com
Thu Jun 12 19:39:27 PDT 2008
> +static int ocfs2_xattr_shrink_size(struct inode *inode,
> + u32 old_clusters,
> + u32 new_clusters,
> + struct buffer_head *root_bh,
> + struct ocfs2_xattr_value_root *xv)
> +{
> + int ret = 0;
> + u32 trunc_len, cpos, phys_cpos, alloc_size;
> + struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
> + struct ocfs2_cached_dealloc_ctxt dealloc;
> +
> + ocfs2_init_dealloc_ctxt(&dealloc);
> +
> + if (old_clusters <= new_clusters)
> + return 0;
> +
> + cpos = new_clusters;
> + trunc_len = old_clusters - new_clusters;
> + while (trunc_len) {
> + ret = ocfs2_xattr_get_clusters(inode, cpos, &phys_cpos,
> + &alloc_size, &xv->xr_list);
> + if (ret) {
> + mlog_errno(ret);
> + goto out;
> + }
> +
> + if (alloc_size > trunc_len)
> + alloc_size = trunc_len;
> +
> + ret = __ocfs2_remove_xattr_range(inode, root_bh, xv, cpos,
> + phys_cpos, alloc_size,
> + &dealloc);
> + if (ret) {
> + mlog_errno(ret);
> + goto out;
> + }
> +
> + cpos += alloc_size;
> + trunc_len -= alloc_size;
> + }
> +
> +out:
> + ocfs2_schedule_truncate_log_flush(osb, 1);
> + ocfs2_run_deallocs(osb, &dealloc);
> +
> + return ret;
> + return 0;
> +}
You have two 'return' statements here.
--Mark
--
Mark Fasheh
More information about the Ocfs2-devel
mailing list