aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/ocfs2/alloc.c40
-rw-r--r--fs/ocfs2/alloc.h5
-rw-r--r--fs/ocfs2/xattr.c4
3 files changed, 25 insertions, 24 deletions
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
index 29095e155949..bfead609f76c 100644
--- a/fs/ocfs2/alloc.c
+++ b/fs/ocfs2/alloc.c
@@ -5198,8 +5198,8 @@ out:
5198 return ret; 5198 return ret;
5199} 5199}
5200 5200
5201static int ocfs2_split_tree(struct inode *inode, struct ocfs2_extent_tree *et, 5201static int ocfs2_split_tree(handle_t *handle, struct ocfs2_extent_tree *et,
5202 handle_t *handle, struct ocfs2_path *path, 5202 struct ocfs2_path *path,
5203 int index, u32 new_range, 5203 int index, u32 new_range,
5204 struct ocfs2_alloc_context *meta_ac) 5204 struct ocfs2_alloc_context *meta_ac)
5205{ 5205{
@@ -5216,7 +5216,8 @@ static int ocfs2_split_tree(struct inode *inode, struct ocfs2_extent_tree *et,
5216 */ 5216 */
5217 el = path_leaf_el(path); 5217 el = path_leaf_el(path);
5218 rec = &el->l_recs[index]; 5218 rec = &el->l_recs[index];
5219 ocfs2_make_right_split_rec(inode->i_sb, &split_rec, new_range, rec); 5219 ocfs2_make_right_split_rec(ocfs2_metadata_cache_get_super(et->et_ci),
5220 &split_rec, new_range, rec);
5220 5221
5221 depth = path->p_tree_depth; 5222 depth = path->p_tree_depth;
5222 if (depth > 0) { 5223 if (depth > 0) {
@@ -5424,9 +5425,9 @@ out:
5424 return ret; 5425 return ret;
5425} 5426}
5426 5427
5427int ocfs2_remove_extent(struct inode *inode, 5428int ocfs2_remove_extent(handle_t *handle,
5428 struct ocfs2_extent_tree *et, 5429 struct ocfs2_extent_tree *et,
5429 u32 cpos, u32 len, handle_t *handle, 5430 u32 cpos, u32 len,
5430 struct ocfs2_alloc_context *meta_ac, 5431 struct ocfs2_alloc_context *meta_ac,
5431 struct ocfs2_cached_dealloc_ctxt *dealloc) 5432 struct ocfs2_cached_dealloc_ctxt *dealloc)
5432{ 5433{
@@ -5458,10 +5459,11 @@ int ocfs2_remove_extent(struct inode *inode,
5458 el = path_leaf_el(path); 5459 el = path_leaf_el(path);
5459 index = ocfs2_search_extent_list(el, cpos); 5460 index = ocfs2_search_extent_list(el, cpos);
5460 if (index == -1 || index >= le16_to_cpu(el->l_next_free_rec)) { 5461 if (index == -1 || index >= le16_to_cpu(el->l_next_free_rec)) {
5461 ocfs2_error(inode->i_sb, 5462 ocfs2_error(ocfs2_metadata_cache_get_super(et->et_ci),
5462 "Inode %llu has an extent at cpos %u which can no " 5463 "Owner %llu has an extent at cpos %u which can no "
5463 "longer be found.\n", 5464 "longer be found.\n",
5464 (unsigned long long)OCFS2_I(inode)->ip_blkno, cpos); 5465 (unsigned long long)ocfs2_metadata_cache_owner(et->et_ci),
5466 cpos);
5465 ret = -EROFS; 5467 ret = -EROFS;
5466 goto out; 5468 goto out;
5467 } 5469 }
@@ -5488,9 +5490,10 @@ int ocfs2_remove_extent(struct inode *inode,
5488 5490
5489 BUG_ON(cpos < le32_to_cpu(rec->e_cpos) || trunc_range > rec_range); 5491 BUG_ON(cpos < le32_to_cpu(rec->e_cpos) || trunc_range > rec_range);
5490 5492
5491 mlog(0, "Inode %llu, remove (cpos %u, len %u). Existing index %d " 5493 mlog(0, "Owner %llu, remove (cpos %u, len %u). Existing index %d "
5492 "(cpos %u, len %u)\n", 5494 "(cpos %u, len %u)\n",
5493 (unsigned long long)OCFS2_I(inode)->ip_blkno, cpos, len, index, 5495 (unsigned long long)ocfs2_metadata_cache_owner(et->et_ci),
5496 cpos, len, index,
5494 le32_to_cpu(rec->e_cpos), ocfs2_rec_clusters(el, rec)); 5497 le32_to_cpu(rec->e_cpos), ocfs2_rec_clusters(el, rec));
5495 5498
5496 if (le32_to_cpu(rec->e_cpos) == cpos || rec_range == trunc_range) { 5499 if (le32_to_cpu(rec->e_cpos) == cpos || rec_range == trunc_range) {
@@ -5501,7 +5504,7 @@ int ocfs2_remove_extent(struct inode *inode,
5501 goto out; 5504 goto out;
5502 } 5505 }
5503 } else { 5506 } else {
5504 ret = ocfs2_split_tree(inode, et, handle, path, index, 5507 ret = ocfs2_split_tree(handle, et, path, index,
5505 trunc_range, meta_ac); 5508 trunc_range, meta_ac);
5506 if (ret) { 5509 if (ret) {
5507 mlog_errno(ret); 5510 mlog_errno(ret);
@@ -5523,9 +5526,9 @@ int ocfs2_remove_extent(struct inode *inode,
5523 el = path_leaf_el(path); 5526 el = path_leaf_el(path);
5524 index = ocfs2_search_extent_list(el, cpos); 5527 index = ocfs2_search_extent_list(el, cpos);
5525 if (index == -1 || index >= le16_to_cpu(el->l_next_free_rec)) { 5528 if (index == -1 || index >= le16_to_cpu(el->l_next_free_rec)) {
5526 ocfs2_error(inode->i_sb, 5529 ocfs2_error(ocfs2_metadata_cache_get_super(et->et_ci),
5527 "Inode %llu: split at cpos %u lost record.", 5530 "Owner %llu: split at cpos %u lost record.",
5528 (unsigned long long)OCFS2_I(inode)->ip_blkno, 5531 (unsigned long long)ocfs2_metadata_cache_owner(et->et_ci),
5529 cpos); 5532 cpos);
5530 ret = -EROFS; 5533 ret = -EROFS;
5531 goto out; 5534 goto out;
@@ -5539,10 +5542,10 @@ int ocfs2_remove_extent(struct inode *inode,
5539 rec_range = le32_to_cpu(rec->e_cpos) + 5542 rec_range = le32_to_cpu(rec->e_cpos) +
5540 ocfs2_rec_clusters(el, rec); 5543 ocfs2_rec_clusters(el, rec);
5541 if (rec_range != trunc_range) { 5544 if (rec_range != trunc_range) {
5542 ocfs2_error(inode->i_sb, 5545 ocfs2_error(ocfs2_metadata_cache_get_super(et->et_ci),
5543 "Inode %llu: error after split at cpos %u" 5546 "Owner %llu: error after split at cpos %u"
5544 "trunc len %u, existing record is (%u,%u)", 5547 "trunc len %u, existing record is (%u,%u)",
5545 (unsigned long long)OCFS2_I(inode)->ip_blkno, 5548 (unsigned long long)ocfs2_metadata_cache_owner(et->et_ci),
5546 cpos, len, le32_to_cpu(rec->e_cpos), 5549 cpos, len, le32_to_cpu(rec->e_cpos),
5547 ocfs2_rec_clusters(el, rec)); 5550 ocfs2_rec_clusters(el, rec));
5548 ret = -EROFS; 5551 ret = -EROFS;
@@ -5607,8 +5610,7 @@ int ocfs2_remove_btree_range(struct inode *inode,
5607 vfs_dq_free_space_nodirty(inode, 5610 vfs_dq_free_space_nodirty(inode,
5608 ocfs2_clusters_to_bytes(inode->i_sb, len)); 5611 ocfs2_clusters_to_bytes(inode->i_sb, len));
5609 5612
5610 ret = ocfs2_remove_extent(inode, et, cpos, len, handle, meta_ac, 5613 ret = ocfs2_remove_extent(handle, et, cpos, len, meta_ac, dealloc);
5611 dealloc);
5612 if (ret) { 5614 if (ret) {
5613 mlog_errno(ret); 5615 mlog_errno(ret);
5614 goto out_commit; 5616 goto out_commit;
diff --git a/fs/ocfs2/alloc.h b/fs/ocfs2/alloc.h
index d1d196eada8f..abc66ce9d418 100644
--- a/fs/ocfs2/alloc.h
+++ b/fs/ocfs2/alloc.h
@@ -117,9 +117,8 @@ int ocfs2_mark_extent_written(struct inode *inode,
117 handle_t *handle, u32 cpos, u32 len, u32 phys, 117 handle_t *handle, u32 cpos, u32 len, u32 phys,
118 struct ocfs2_alloc_context *meta_ac, 118 struct ocfs2_alloc_context *meta_ac,
119 struct ocfs2_cached_dealloc_ctxt *dealloc); 119 struct ocfs2_cached_dealloc_ctxt *dealloc);
120int ocfs2_remove_extent(struct inode *inode, 120int ocfs2_remove_extent(handle_t *handle, struct ocfs2_extent_tree *et,
121 struct ocfs2_extent_tree *et, 121 u32 cpos, u32 len,
122 u32 cpos, u32 len, handle_t *handle,
123 struct ocfs2_alloc_context *meta_ac, 122 struct ocfs2_alloc_context *meta_ac,
124 struct ocfs2_cached_dealloc_ctxt *dealloc); 123 struct ocfs2_cached_dealloc_ctxt *dealloc);
125int ocfs2_remove_btree_range(struct inode *inode, 124int ocfs2_remove_btree_range(struct inode *inode,
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
index fdd02c43fa14..96f973a302fa 100644
--- a/fs/ocfs2/xattr.c
+++ b/fs/ocfs2/xattr.c
@@ -663,7 +663,7 @@ static int __ocfs2_remove_xattr_range(struct inode *inode,
663 goto out; 663 goto out;
664 } 664 }
665 665
666 ret = ocfs2_remove_extent(inode, &et, cpos, len, handle, ctxt->meta_ac, 666 ret = ocfs2_remove_extent(handle, &et, cpos, len, ctxt->meta_ac,
667 &ctxt->dealloc); 667 &ctxt->dealloc);
668 if (ret) { 668 if (ret) {
669 mlog_errno(ret); 669 mlog_errno(ret);
@@ -4881,7 +4881,7 @@ static int ocfs2_rm_xattr_cluster(struct inode *inode,
4881 goto out_commit; 4881 goto out_commit;
4882 } 4882 }
4883 4883
4884 ret = ocfs2_remove_extent(inode, &et, cpos, len, handle, meta_ac, 4884 ret = ocfs2_remove_extent(handle, &et, cpos, len, meta_ac,
4885 &dealloc); 4885 &dealloc);
4886 if (ret) { 4886 if (ret) {
4887 mlog_errno(ret); 4887 mlog_errno(ret);