|
@@ -2843,8 +2843,8 @@ out:
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
-static int ocfs2_rotate_rightmost_leaf_left(struct inode *inode,
|
|
|
- handle_t *handle,
|
|
|
+static int ocfs2_rotate_rightmost_leaf_left(handle_t *handle,
|
|
|
+ struct ocfs2_extent_tree *et,
|
|
|
struct ocfs2_path *path)
|
|
|
{
|
|
|
int ret;
|
|
@@ -2854,7 +2854,7 @@ static int ocfs2_rotate_rightmost_leaf_left(struct inode *inode,
|
|
|
if (!ocfs2_is_empty_extent(&el->l_recs[0]))
|
|
|
return 0;
|
|
|
|
|
|
- ret = ocfs2_path_bh_journal_access(handle, INODE_CACHE(inode), path,
|
|
|
+ ret = ocfs2_path_bh_journal_access(handle, et->et_ci, path,
|
|
|
path_num_items(path) - 1);
|
|
|
if (ret) {
|
|
|
mlog_errno(ret);
|
|
@@ -2988,10 +2988,10 @@ out:
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
-static int ocfs2_remove_rightmost_path(struct inode *inode, handle_t *handle,
|
|
|
+static int ocfs2_remove_rightmost_path(handle_t *handle,
|
|
|
+ struct ocfs2_extent_tree *et,
|
|
|
struct ocfs2_path *path,
|
|
|
- struct ocfs2_cached_dealloc_ctxt *dealloc,
|
|
|
- struct ocfs2_extent_tree *et)
|
|
|
+ struct ocfs2_cached_dealloc_ctxt *dealloc)
|
|
|
{
|
|
|
int ret, subtree_index;
|
|
|
u32 cpos;
|
|
@@ -3070,7 +3070,7 @@ static int ocfs2_remove_rightmost_path(struct inode *inode, handle_t *handle,
|
|
|
* 'path' is also the leftmost path which
|
|
|
* means it must be the only one. This gets
|
|
|
* handled differently because we want to
|
|
|
- * revert the inode back to having extents
|
|
|
+ * revert the root back to having extents
|
|
|
* in-line.
|
|
|
*/
|
|
|
ocfs2_unlink_path(handle, et, dealloc, path, 1);
|
|
@@ -3106,10 +3106,10 @@ out:
|
|
|
* the rightmost tree leaf record is removed so the caller is
|
|
|
* responsible for detecting and correcting that.
|
|
|
*/
|
|
|
-static int ocfs2_rotate_tree_left(struct inode *inode, handle_t *handle,
|
|
|
+static int ocfs2_rotate_tree_left(handle_t *handle,
|
|
|
+ struct ocfs2_extent_tree *et,
|
|
|
struct ocfs2_path *path,
|
|
|
- struct ocfs2_cached_dealloc_ctxt *dealloc,
|
|
|
- struct ocfs2_extent_tree *et)
|
|
|
+ struct ocfs2_cached_dealloc_ctxt *dealloc)
|
|
|
{
|
|
|
int ret, orig_credits = handle->h_buffer_credits;
|
|
|
struct ocfs2_path *tmp_path = NULL, *restart_path = NULL;
|
|
@@ -3126,8 +3126,7 @@ rightmost_no_delete:
|
|
|
* Inline extents. This is trivially handled, so do
|
|
|
* it up front.
|
|
|
*/
|
|
|
- ret = ocfs2_rotate_rightmost_leaf_left(inode, handle,
|
|
|
- path);
|
|
|
+ ret = ocfs2_rotate_rightmost_leaf_left(handle, et, path);
|
|
|
if (ret)
|
|
|
mlog_errno(ret);
|
|
|
goto out;
|
|
@@ -3143,7 +3142,7 @@ rightmost_no_delete:
|
|
|
*
|
|
|
* 1) is handled via ocfs2_rotate_rightmost_leaf_left()
|
|
|
* 2a) we need the left branch so that we can update it with the unlink
|
|
|
- * 2b) we need to bring the inode back to inline extents.
|
|
|
+ * 2b) we need to bring the root back to inline extents.
|
|
|
*/
|
|
|
|
|
|
eb = (struct ocfs2_extent_block *)path_leaf_bh(path)->b_data;
|
|
@@ -3159,9 +3158,9 @@ rightmost_no_delete:
|
|
|
|
|
|
if (le16_to_cpu(el->l_next_free_rec) == 0) {
|
|
|
ret = -EIO;
|
|
|
- ocfs2_error(inode->i_sb,
|
|
|
- "Inode %llu has empty extent block at %llu",
|
|
|
- (unsigned long long)OCFS2_I(inode)->ip_blkno,
|
|
|
+ ocfs2_error(ocfs2_metadata_cache_get_super(et->et_ci),
|
|
|
+ "Owner %llu has empty extent block at %llu",
|
|
|
+ (unsigned long long)ocfs2_metadata_cache_owner(et->et_ci),
|
|
|
(unsigned long long)le64_to_cpu(eb->h_blkno));
|
|
|
goto out;
|
|
|
}
|
|
@@ -3175,8 +3174,8 @@ rightmost_no_delete:
|
|
|
* nonempty list.
|
|
|
*/
|
|
|
|
|
|
- ret = ocfs2_remove_rightmost_path(inode, handle, path,
|
|
|
- dealloc, et);
|
|
|
+ ret = ocfs2_remove_rightmost_path(handle, et, path,
|
|
|
+ dealloc);
|
|
|
if (ret)
|
|
|
mlog_errno(ret);
|
|
|
goto out;
|
|
@@ -3602,9 +3601,9 @@ static int ocfs2_merge_rec_left(struct inode *inode,
|
|
|
if (le16_to_cpu(right_rec->e_leaf_clusters) == 0 &&
|
|
|
le16_to_cpu(el->l_next_free_rec) == 1) {
|
|
|
|
|
|
- ret = ocfs2_remove_rightmost_path(inode, handle,
|
|
|
+ ret = ocfs2_remove_rightmost_path(handle, et,
|
|
|
right_path,
|
|
|
- dealloc, et);
|
|
|
+ dealloc);
|
|
|
if (ret) {
|
|
|
mlog_errno(ret);
|
|
|
goto out;
|
|
@@ -3649,8 +3648,7 @@ static int ocfs2_try_to_merge_extent(struct inode *inode,
|
|
|
* extents - having more than one in a leaf is
|
|
|
* illegal.
|
|
|
*/
|
|
|
- ret = ocfs2_rotate_tree_left(inode, handle, path,
|
|
|
- dealloc, et);
|
|
|
+ ret = ocfs2_rotate_tree_left(handle, et, path, dealloc);
|
|
|
if (ret) {
|
|
|
mlog_errno(ret);
|
|
|
goto out;
|
|
@@ -3693,8 +3691,7 @@ static int ocfs2_try_to_merge_extent(struct inode *inode,
|
|
|
BUG_ON(!ocfs2_is_empty_extent(&el->l_recs[0]));
|
|
|
|
|
|
/* The merge left us with an empty extent, remove it. */
|
|
|
- ret = ocfs2_rotate_tree_left(inode, handle, path,
|
|
|
- dealloc, et);
|
|
|
+ ret = ocfs2_rotate_tree_left(handle, et, path, dealloc);
|
|
|
if (ret) {
|
|
|
mlog_errno(ret);
|
|
|
goto out;
|
|
@@ -3716,8 +3713,7 @@ static int ocfs2_try_to_merge_extent(struct inode *inode,
|
|
|
goto out;
|
|
|
}
|
|
|
|
|
|
- ret = ocfs2_rotate_tree_left(inode, handle, path,
|
|
|
- dealloc, et);
|
|
|
+ ret = ocfs2_rotate_tree_left(handle, et, path, dealloc);
|
|
|
/*
|
|
|
* Error from this last rotate is not critical, so
|
|
|
* print but don't bubble it up.
|
|
@@ -3758,8 +3754,8 @@ static int ocfs2_try_to_merge_extent(struct inode *inode,
|
|
|
* The merge may have left an empty extent in
|
|
|
* our leaf. Try to rotate it away.
|
|
|
*/
|
|
|
- ret = ocfs2_rotate_tree_left(inode, handle, path,
|
|
|
- dealloc, et);
|
|
|
+ ret = ocfs2_rotate_tree_left(handle, et, path,
|
|
|
+ dealloc);
|
|
|
if (ret)
|
|
|
mlog_errno(ret);
|
|
|
ret = 0;
|
|
@@ -5259,7 +5255,7 @@ static int ocfs2_truncate_rec(struct inode *inode, handle_t *handle,
|
|
|
struct ocfs2_extent_block *eb;
|
|
|
|
|
|
if (ocfs2_is_empty_extent(&el->l_recs[0]) && index > 0) {
|
|
|
- ret = ocfs2_rotate_tree_left(inode, handle, path, dealloc, et);
|
|
|
+ ret = ocfs2_rotate_tree_left(handle, et, path, dealloc);
|
|
|
if (ret) {
|
|
|
mlog_errno(ret);
|
|
|
goto out;
|
|
@@ -5390,7 +5386,7 @@ static int ocfs2_truncate_rec(struct inode *inode, handle_t *handle,
|
|
|
|
|
|
ocfs2_journal_dirty(handle, path_leaf_bh(path));
|
|
|
|
|
|
- ret = ocfs2_rotate_tree_left(inode, handle, path, dealloc, et);
|
|
|
+ ret = ocfs2_rotate_tree_left(handle, et, path, dealloc);
|
|
|
if (ret) {
|
|
|
mlog_errno(ret);
|
|
|
goto out;
|