]> git.ipfire.org Git - ipfire-2.x.git/blob - src/patches/suse-2.6.27.39/patches.fixes/ocfs2-add-extra-credits-and-access-the-modified-bh.patch
Imported linux-2.6.27.39 suse/xen patches.
[ipfire-2.x.git] / src / patches / suse-2.6.27.39 / patches.fixes / ocfs2-add-extra-credits-and-access-the-modified-bh.patch
1 From 3c5e10683e684ef45614c9071847e48f633d9806 Mon Sep 17 00:00:00 2001
2 From: Tao Ma <tao.ma@oracle.com>
3 Date: Tue, 21 Jul 2009 15:42:05 +0800
4 Subject: [PATCH] ocfs2: Add extra credits and access the modified bh in update_edge_lengths.
5 References: bnc#528427
6
7 In normal tree rotation left process, we will never touch the tree
8 branch above subtree_index and ocfs2_extend_rotate_transaction doesn't
9 reserve the credits for them either.
10
11 But when we want to delete the rightmost extent block, we have to update
12 the rightmost records for all the rightmost branch(See
13 ocfs2_update_edge_lengths), so we have to allocate extra credits for them.
14 What's more, we have to access them also.
15
16 Signed-off-by: Tao Ma <tao.ma@oracle.com>
17 Signed-off-by: Joel Becker <joel.becker@oracle.com>
18 Signed-off-by: Mark Fasheh <mfasheh@suse.com>
19 ---
20 fs/ocfs2/alloc.c | 44 +++++++++++++++++++++++++++++++++++++++-----
21 1 files changed, 39 insertions(+), 5 deletions(-)
22
23 Index: linux-2.6.27-SLE11_BRANCH/fs/ocfs2/alloc.c
24 ===================================================================
25 --- linux-2.6.27-SLE11_BRANCH.orig/fs/ocfs2/alloc.c
26 +++ linux-2.6.27-SLE11_BRANCH/fs/ocfs2/alloc.c
27 @@ -2334,15 +2334,37 @@ out_ret_path:
28 return ret;
29 }
30
31 -static void ocfs2_update_edge_lengths(struct inode *inode, handle_t *handle,
32 - struct ocfs2_path *path)
33 +static int ocfs2_update_edge_lengths(struct inode *inode, handle_t *handle,
34 + int subtree_index, struct ocfs2_path *path)
35 {
36 - int i, idx;
37 + int i, idx, ret;
38 struct ocfs2_extent_rec *rec;
39 struct ocfs2_extent_list *el;
40 struct ocfs2_extent_block *eb;
41 u32 range;
42
43 + /*
44 + * In normal tree rotation process, we will never touch the
45 + * tree branch above subtree_index and ocfs2_extend_rotate_transaction
46 + * doesn't reserve the credits for them either.
47 + *
48 + * But we do have a special case here which will update the rightmost
49 + * records for all the bh in the path.
50 + * So we have to allocate extra credits and access them.
51 + */
52 + ret = ocfs2_extend_trans(handle,
53 + handle->h_buffer_credits + subtree_index);
54 + if (ret) {
55 + mlog_errno(ret);
56 + goto out;
57 + }
58 +
59 + ret = ocfs2_journal_access_path(inode, handle, path);
60 + if (ret) {
61 + mlog_errno(ret);
62 + goto out;
63 + }
64 +
65 /* Path should always be rightmost. */
66 eb = (struct ocfs2_extent_block *)path_leaf_bh(path)->b_data;
67 BUG_ON(eb->h_next_leaf_blk != 0ULL);
68 @@ -2363,6 +2385,8 @@ static void ocfs2_update_edge_lengths(st
69
70 ocfs2_journal_dirty(handle, path->p_node[i].bh);
71 }
72 +out:
73 + return ret;
74 }
75
76 static void ocfs2_unlink_path(struct inode *inode, handle_t *handle,
77 @@ -2577,7 +2601,12 @@ static int ocfs2_rotate_subtree_left(str
78 if (del_right_subtree) {
79 ocfs2_unlink_subtree(inode, handle, left_path, right_path,
80 subtree_index, dealloc);
81 - ocfs2_update_edge_lengths(inode, handle, left_path);
82 + ret = ocfs2_update_edge_lengths(inode, handle, subtree_index,
83 + left_path);
84 + if (ret) {
85 + mlog_errno(ret);
86 + goto out;
87 + }
88
89 eb = (struct ocfs2_extent_block *)path_leaf_bh(left_path)->b_data;
90 ocfs2_et_set_last_eb_blk(et, le64_to_cpu(eb->h_blkno));
91 @@ -2897,7 +2926,12 @@ static int ocfs2_remove_rightmost_path(s
92
93 ocfs2_unlink_subtree(inode, handle, left_path, path,
94 subtree_index, dealloc);
95 - ocfs2_update_edge_lengths(inode, handle, left_path);
96 + ret = ocfs2_update_edge_lengths(inode, handle, subtree_index,
97 + left_path);
98 + if (ret) {
99 + mlog_errno(ret);
100 + goto out;
101 + }
102
103 eb = (struct ocfs2_extent_block *)path_leaf_bh(left_path)->b_data;
104 ocfs2_et_set_last_eb_blk(et, le64_to_cpu(eb->h_blkno));