diff options
author | Tao Ma <tao.ma@oracle.com> | 2008-12-10 19:54:11 -0500 |
---|---|---|
committer | Mark Fasheh <mfasheh@suse.com> | 2009-01-05 11:40:26 -0500 |
commit | 88c3b0622acf82c7c86fbc066e81e15edc7c1685 (patch) | |
tree | 100cf2f28cd2601b64db7c6a917dfcbcc72b4019 /fs/ocfs2 | |
parent | 548b0f22bb7497ba76f91627b99f9fed53a91704 (diff) |
ocfs2: Narrow the transaction for deleting xattrs from a bucket.
We move the transaction into the loop because in
ocfs2_remove_extent, we will double the credits in function
ocfs2_extend_rotate_transaction. So if we have a large loop
number, we will soon waste much the journal space.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Diffstat (limited to 'fs/ocfs2')
-rw-r--r-- | fs/ocfs2/xattr.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c index 6db68a23a296..df53a2ce2de5 100644 --- a/fs/ocfs2/xattr.c +++ b/fs/ocfs2/xattr.c | |||
@@ -5094,30 +5094,30 @@ static int ocfs2_delete_xattr_in_bucket(struct inode *inode, | |||
5094 | 5094 | ||
5095 | ocfs2_init_dealloc_ctxt(&ctxt.dealloc); | 5095 | ocfs2_init_dealloc_ctxt(&ctxt.dealloc); |
5096 | 5096 | ||
5097 | ctxt.handle = ocfs2_start_trans(osb, credits); | ||
5098 | if (IS_ERR(ctxt.handle)) { | ||
5099 | ret = PTR_ERR(ctxt.handle); | ||
5100 | mlog_errno(ret); | ||
5101 | goto out; | ||
5102 | } | ||
5103 | |||
5104 | for (i = 0; i < le16_to_cpu(xh->xh_count); i++) { | 5097 | for (i = 0; i < le16_to_cpu(xh->xh_count); i++) { |
5105 | xe = &xh->xh_entries[i]; | 5098 | xe = &xh->xh_entries[i]; |
5106 | if (ocfs2_xattr_is_local(xe)) | 5099 | if (ocfs2_xattr_is_local(xe)) |
5107 | continue; | 5100 | continue; |
5108 | 5101 | ||
5102 | ctxt.handle = ocfs2_start_trans(osb, credits); | ||
5103 | if (IS_ERR(ctxt.handle)) { | ||
5104 | ret = PTR_ERR(ctxt.handle); | ||
5105 | mlog_errno(ret); | ||
5106 | break; | ||
5107 | } | ||
5108 | |||
5109 | ret = ocfs2_xattr_bucket_value_truncate(inode, bucket, | 5109 | ret = ocfs2_xattr_bucket_value_truncate(inode, bucket, |
5110 | i, 0, &ctxt); | 5110 | i, 0, &ctxt); |
5111 | |||
5112 | ocfs2_commit_trans(osb, ctxt.handle); | ||
5111 | if (ret) { | 5113 | if (ret) { |
5112 | mlog_errno(ret); | 5114 | mlog_errno(ret); |
5113 | break; | 5115 | break; |
5114 | } | 5116 | } |
5115 | } | 5117 | } |
5116 | 5118 | ||
5117 | ret = ocfs2_commit_trans(osb, ctxt.handle); | ||
5118 | ocfs2_schedule_truncate_log_flush(osb, 1); | 5119 | ocfs2_schedule_truncate_log_flush(osb, 1); |
5119 | ocfs2_run_deallocs(osb, &ctxt.dealloc); | 5120 | ocfs2_run_deallocs(osb, &ctxt.dealloc); |
5120 | out: | ||
5121 | return ret; | 5121 | return ret; |
5122 | } | 5122 | } |
5123 | 5123 | ||