diff options
author | Tao Ma <tao.ma@oracle.com> | 2009-09-21 01:04:19 -0400 |
---|---|---|
committer | Joel Becker <joel.becker@oracle.com> | 2009-09-22 23:09:43 -0400 |
commit | 0129241e2b3b90ff83a8c774353e5612d84bd493 (patch) | |
tree | eec03f874cbdbc4c9eab4900f2de89fd1747a5ee /fs/ocfs2/refcounttree.c | |
parent | 47bca4950bc40fb54e9d41cbbc8b06cd653d2ae2 (diff) |
ocfs2: Attach xattr clusters to refcount tree.
In ocfs2, when xattr's value is larger than OCFS2_XATTR_INLINE_SIZE,
it will be kept outside of the blocks we store xattr entry. And they
are stored in a b-tree also. So this patch try to attach all these
clusters to refcount tree also.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Diffstat (limited to 'fs/ocfs2/refcounttree.c')
-rw-r--r-- | fs/ocfs2/refcounttree.c | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c index a5b5bef054a7..a85c01c6629d 100644 --- a/fs/ocfs2/refcounttree.c +++ b/fs/ocfs2/refcounttree.c | |||
@@ -3547,7 +3547,8 @@ int ocfs2_add_refcount_flag(struct inode *inode, | |||
3547 | struct ocfs2_caching_info *ref_ci, | 3547 | struct ocfs2_caching_info *ref_ci, |
3548 | struct buffer_head *ref_root_bh, | 3548 | struct buffer_head *ref_root_bh, |
3549 | u32 cpos, u32 p_cluster, u32 num_clusters, | 3549 | u32 cpos, u32 p_cluster, u32 num_clusters, |
3550 | struct ocfs2_cached_dealloc_ctxt *dealloc) | 3550 | struct ocfs2_cached_dealloc_ctxt *dealloc, |
3551 | struct ocfs2_post_refcount *post) | ||
3551 | { | 3552 | { |
3552 | int ret; | 3553 | int ret; |
3553 | handle_t *handle; | 3554 | handle_t *handle; |
@@ -3576,6 +3577,9 @@ int ocfs2_add_refcount_flag(struct inode *inode, | |||
3576 | } | 3577 | } |
3577 | } | 3578 | } |
3578 | 3579 | ||
3580 | if (post) | ||
3581 | credits += post->credits; | ||
3582 | |||
3579 | handle = ocfs2_start_trans(osb, credits); | 3583 | handle = ocfs2_start_trans(osb, credits); |
3580 | if (IS_ERR(handle)) { | 3584 | if (IS_ERR(handle)) { |
3581 | ret = PTR_ERR(handle); | 3585 | ret = PTR_ERR(handle); |
@@ -3594,8 +3598,16 @@ int ocfs2_add_refcount_flag(struct inode *inode, | |||
3594 | ret = __ocfs2_increase_refcount(handle, ref_ci, ref_root_bh, | 3598 | ret = __ocfs2_increase_refcount(handle, ref_ci, ref_root_bh, |
3595 | p_cluster, num_clusters, | 3599 | p_cluster, num_clusters, |
3596 | meta_ac, dealloc); | 3600 | meta_ac, dealloc); |
3597 | if (ret) | 3601 | if (ret) { |
3598 | mlog_errno(ret); | 3602 | mlog_errno(ret); |
3603 | goto out_commit; | ||
3604 | } | ||
3605 | |||
3606 | if (post && post->func) { | ||
3607 | ret = post->func(inode, handle, post->para); | ||
3608 | if (ret) | ||
3609 | mlog_errno(ret); | ||
3610 | } | ||
3599 | 3611 | ||
3600 | out_commit: | 3612 | out_commit: |
3601 | ocfs2_commit_trans(osb, handle); | 3613 | ocfs2_commit_trans(osb, handle); |
@@ -3688,7 +3700,7 @@ static int ocfs2_attach_refcount_tree(struct inode *inode, | |||
3688 | &ref_tree->rf_ci, | 3700 | &ref_tree->rf_ci, |
3689 | ref_root_bh, cpos, | 3701 | ref_root_bh, cpos, |
3690 | p_cluster, num_clusters, | 3702 | p_cluster, num_clusters, |
3691 | &dealloc); | 3703 | &dealloc, NULL); |
3692 | if (ret) { | 3704 | if (ret) { |
3693 | mlog_errno(ret); | 3705 | mlog_errno(ret); |
3694 | goto unlock; | 3706 | goto unlock; |
@@ -3699,6 +3711,17 @@ static int ocfs2_attach_refcount_tree(struct inode *inode, | |||
3699 | cpos += num_clusters; | 3711 | cpos += num_clusters; |
3700 | } | 3712 | } |
3701 | 3713 | ||
3714 | if (oi->ip_dyn_features & OCFS2_HAS_XATTR_FL) { | ||
3715 | ret = ocfs2_xattr_attach_refcount_tree(inode, di_bh, | ||
3716 | &ref_tree->rf_ci, | ||
3717 | ref_root_bh, | ||
3718 | &dealloc); | ||
3719 | if (ret) { | ||
3720 | mlog_errno(ret); | ||
3721 | goto unlock; | ||
3722 | } | ||
3723 | } | ||
3724 | |||
3702 | if (data_changed) { | 3725 | if (data_changed) { |
3703 | ret = ocfs2_change_ctime(inode, di_bh); | 3726 | ret = ocfs2_change_ctime(inode, di_bh); |
3704 | if (ret) | 3727 | if (ret) |