aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTao Ma <tao.ma@oracle.com>2008-11-11 19:26:59 -0500
committerMark Fasheh <mfasheh@suse.com>2009-01-05 11:34:19 -0500
commitc73f60f900ddf73ec4ea2a143829ab97242c4e8c (patch)
tree6216b45e3bbc2b105b8a54c3db4f5cdd796dcb02
parent2891d290aa6eee0821f7e4ad0b1c4ae4d964b0f1 (diff)
ocfs2/xattr: Move clusters free into dealloc.
Move clusters free process into dealloc context so that they can be freed after the transaction. Signed-off-by: Tao Ma <tao.ma@oracle.com> Signed-off-by: Mark Fasheh <mfasheh@suse.com>
-rw-r--r--fs/ocfs2/xattr.c14
1 files changed, 1 insertions, 13 deletions
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
index 4501c63193df..f1da381a44f6 100644
--- a/fs/ocfs2/xattr.c
+++ b/fs/ocfs2/xattr.c
@@ -457,7 +457,6 @@ static int __ocfs2_remove_xattr_range(struct inode *inode,
457 int ret; 457 int ret;
458 u64 phys_blkno = ocfs2_clusters_to_blocks(inode->i_sb, phys_cpos); 458 u64 phys_blkno = ocfs2_clusters_to_blocks(inode->i_sb, phys_cpos);
459 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); 459 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
460 struct inode *tl_inode = osb->osb_tl_inode;
461 handle_t *handle; 460 handle_t *handle;
462 struct ocfs2_alloc_context *meta_ac = NULL; 461 struct ocfs2_alloc_context *meta_ac = NULL;
463 struct ocfs2_extent_tree et; 462 struct ocfs2_extent_tree et;
@@ -470,16 +469,6 @@ static int __ocfs2_remove_xattr_range(struct inode *inode,
470 return ret; 469 return ret;
471 } 470 }
472 471
473 mutex_lock(&tl_inode->i_mutex);
474
475 if (ocfs2_truncate_log_needs_flush(osb)) {
476 ret = __ocfs2_flush_truncate_log(osb);
477 if (ret < 0) {
478 mlog_errno(ret);
479 goto out;
480 }
481 }
482
483 handle = ocfs2_start_trans(osb, OCFS2_REMOVE_EXTENT_CREDITS); 472 handle = ocfs2_start_trans(osb, OCFS2_REMOVE_EXTENT_CREDITS);
484 if (IS_ERR(handle)) { 473 if (IS_ERR(handle)) {
485 ret = PTR_ERR(handle); 474 ret = PTR_ERR(handle);
@@ -509,14 +498,13 @@ static int __ocfs2_remove_xattr_range(struct inode *inode,
509 goto out_commit; 498 goto out_commit;
510 } 499 }
511 500
512 ret = ocfs2_truncate_log_append(osb, handle, phys_blkno, len); 501 ret = ocfs2_cache_cluster_dealloc(dealloc, phys_blkno, len);
513 if (ret) 502 if (ret)
514 mlog_errno(ret); 503 mlog_errno(ret);
515 504
516out_commit: 505out_commit:
517 ocfs2_commit_trans(osb, handle); 506 ocfs2_commit_trans(osb, handle);
518out: 507out:
519 mutex_unlock(&tl_inode->i_mutex);
520 508
521 if (meta_ac) 509 if (meta_ac)
522 ocfs2_free_alloc_context(meta_ac); 510 ocfs2_free_alloc_context(meta_ac);