aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2
diff options
context:
space:
mode:
authorTao Ma <tao.ma@oracle.com>2008-12-04 17:20:54 -0500
committerMark Fasheh <mfasheh@suse.com>2009-01-05 11:40:36 -0500
commit71d548a6af36fe98c95fbd0522147f842bd5f054 (patch)
tree196202d8fcc0ce03baa4c3d181cfbf0090392497 /fs/ocfs2
parent7b791d68562e4ce5ab57cbacb10a1ad4ee33956e (diff)
ocfs2/xattr: Remove extend_trans call and add its credits from the beginning
Actually, when setting a new xattr value, we know it from the very beginning, and it isn't like the extension of bucket in which case we can't figure it out. So remove ocfs2_extend_trans in that function and calculate it before the transaction. It also relieve acl operation from the worry about the side effect of ocfs2_extend_trans. Signed-off-by: Tao Ma <tao.ma@oracle.com> Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Diffstat (limited to 'fs/ocfs2')
-rw-r--r--fs/ocfs2/xattr.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
index 17028aa7bc26..93a1ab4fe1da 100644
--- a/fs/ocfs2/xattr.c
+++ b/fs/ocfs2/xattr.c
@@ -1169,7 +1169,7 @@ static int __ocfs2_xattr_set_value_outside(struct inode *inode,
1169 const void *value, 1169 const void *value,
1170 int value_len) 1170 int value_len)
1171{ 1171{
1172 int ret = 0, i, cp_len, credits; 1172 int ret = 0, i, cp_len;
1173 u16 blocksize = inode->i_sb->s_blocksize; 1173 u16 blocksize = inode->i_sb->s_blocksize;
1174 u32 p_cluster, num_clusters; 1174 u32 p_cluster, num_clusters;
1175 u32 cpos = 0, bpc = ocfs2_clusters_to_blocks(inode->i_sb, 1); 1175 u32 cpos = 0, bpc = ocfs2_clusters_to_blocks(inode->i_sb, 1);
@@ -1179,18 +1179,6 @@ static int __ocfs2_xattr_set_value_outside(struct inode *inode,
1179 1179
1180 BUG_ON(clusters > le32_to_cpu(xv->xr_clusters)); 1180 BUG_ON(clusters > le32_to_cpu(xv->xr_clusters));
1181 1181
1182 /*
1183 * In __ocfs2_xattr_set_value_outside has already been dirtied,
1184 * so we don't need to worry about whether ocfs2_extend_trans
1185 * will create a new transactio for us or not.
1186 */
1187 credits = clusters * bpc;
1188 ret = ocfs2_extend_trans(handle, credits);
1189 if (ret) {
1190 mlog_errno(ret);
1191 goto out;
1192 }
1193
1194 while (cpos < clusters) { 1182 while (cpos < clusters) {
1195 ret = ocfs2_xattr_get_clusters(inode, cpos, &p_cluster, 1183 ret = ocfs2_xattr_get_clusters(inode, cpos, &p_cluster,
1196 &num_clusters, &xv->xr_list); 1184 &num_clusters, &xv->xr_list);
@@ -2233,6 +2221,15 @@ static int ocfs2_calc_xattr_set_need(struct inode *inode,
2233 xi->value_len); 2221 xi->value_len);
2234 u64 value_size; 2222 u64 value_size;
2235 2223
2224 /*
2225 * Calculate the clusters we need to write.
2226 * No matter whether we replace an old one or add a new one,
2227 * we need this for writing.
2228 */
2229 if (xi->value_len > OCFS2_XATTR_INLINE_SIZE)
2230 credits += new_clusters *
2231 ocfs2_clusters_to_blocks(inode->i_sb, 1);
2232
2236 if (xis->not_found && xbs->not_found) { 2233 if (xis->not_found && xbs->not_found) {
2237 credits += ocfs2_blocks_per_xattr_bucket(inode->i_sb); 2234 credits += ocfs2_blocks_per_xattr_bucket(inode->i_sb);
2238 2235