ocfs2: Return extent flags for xattr value tree.

With the new refcount tree, xattr value can also be refcounted
among multiple files. So return the appropriate extent flags
so that CoW can used it later.

Signed-off-by: Tao Ma <tao.ma@oracle.com>
This commit is contained in:
Tao Ma 2009-08-18 11:41:57 +08:00 committed by Joel Becker
parent a9063ab9a3
commit 1061f9c1c9
3 changed files with 11 additions and 5 deletions

View file

@ -541,7 +541,8 @@ static void ocfs2_relative_extent_offsets(struct super_block *sb,
int ocfs2_xattr_get_clusters(struct inode *inode, u32 v_cluster, int ocfs2_xattr_get_clusters(struct inode *inode, u32 v_cluster,
u32 *p_cluster, u32 *num_clusters, u32 *p_cluster, u32 *num_clusters,
struct ocfs2_extent_list *el) struct ocfs2_extent_list *el,
unsigned int *extent_flags)
{ {
int ret = 0, i; int ret = 0, i;
struct buffer_head *eb_bh = NULL; struct buffer_head *eb_bh = NULL;
@ -593,6 +594,9 @@ int ocfs2_xattr_get_clusters(struct inode *inode, u32 v_cluster,
*p_cluster = *p_cluster + coff; *p_cluster = *p_cluster + coff;
if (num_clusters) if (num_clusters)
*num_clusters = ocfs2_rec_clusters(el, rec) - coff; *num_clusters = ocfs2_rec_clusters(el, rec) - coff;
if (extent_flags)
*extent_flags = rec->e_flags;
} }
out: out:
if (eb_bh) if (eb_bh)

View file

@ -55,7 +55,8 @@ int ocfs2_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
int ocfs2_xattr_get_clusters(struct inode *inode, u32 v_cluster, int ocfs2_xattr_get_clusters(struct inode *inode, u32 v_cluster,
u32 *p_cluster, u32 *num_clusters, u32 *p_cluster, u32 *num_clusters,
struct ocfs2_extent_list *el); struct ocfs2_extent_list *el,
unsigned int *extent_flags);
int ocfs2_read_virt_blocks(struct inode *inode, u64 v_block, int nr, int ocfs2_read_virt_blocks(struct inode *inode, u64 v_block, int nr,
struct buffer_head *bhs[], int flags, struct buffer_head *bhs[], int flags,

View file

@ -704,7 +704,7 @@ static int ocfs2_xattr_shrink_size(struct inode *inode,
while (trunc_len) { while (trunc_len) {
ret = ocfs2_xattr_get_clusters(inode, cpos, &phys_cpos, ret = ocfs2_xattr_get_clusters(inode, cpos, &phys_cpos,
&alloc_size, &alloc_size,
&vb->vb_xv->xr_list); &vb->vb_xv->xr_list, NULL);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
goto out; goto out;
@ -959,7 +959,7 @@ static int ocfs2_xattr_get_value_outside(struct inode *inode,
cpos = 0; cpos = 0;
while (cpos < clusters) { while (cpos < clusters) {
ret = ocfs2_xattr_get_clusters(inode, cpos, &p_cluster, ret = ocfs2_xattr_get_clusters(inode, cpos, &p_cluster,
&num_clusters, el); &num_clusters, el, NULL);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
goto out; goto out;
@ -1198,7 +1198,8 @@ static int __ocfs2_xattr_set_value_outside(struct inode *inode,
while (cpos < clusters) { while (cpos < clusters) {
ret = ocfs2_xattr_get_clusters(inode, cpos, &p_cluster, ret = ocfs2_xattr_get_clusters(inode, cpos, &p_cluster,
&num_clusters, &xv->xr_list); &num_clusters, &xv->xr_list,
NULL);
if (ret) { if (ret) {
mlog_errno(ret); mlog_errno(ret);
goto out; goto out;