1 ext4: save goal group and offset in struct ext4_allocation_context.ac_g_ex
3 From: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
5 In ext4_mb_normalize_request(), if ac_g_ex.fe_logical is adjacent to
6 the closest logical allocated block to the left or if
7 (ac_g_ex.fe_logical+len) adjacent to the closest logical allocated
8 block to the right, we'll attach EXT4_MB_HINT_TRY_GOAL flag taking the
9 physical block (ext4_allocation_request.lleft+1) or
10 (ext4_allocation_request.pright-len) as a goal, and put this
11 information in ext4_allocation_context.ac_f_ex.
13 But look at the ext4_mb_find_by_goal(), indeed it use ac_g_ex to look
14 up, so this is wrong, we should save goal group and offset in struct
15 ext4_allocation_context.ac_g_ex.
17 Signed-off-by: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
18 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
20 fs/ext4/mballoc.c | 8 ++++----
21 1 file changed, 4 insertions(+), 4 deletions(-)
23 diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
24 index 2dcb936..6d939d79 100644
25 --- a/fs/ext4/mballoc.c
26 +++ b/fs/ext4/mballoc.c
27 @@ -3168,15 +3168,15 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac,
28 if (ar->pright && (ar->lright == (start + size))) {
29 /* merge to the right */
30 ext4_get_group_no_and_offset(ac->ac_sb, ar->pright - size,
31 - &ac->ac_f_ex.fe_group,
32 - &ac->ac_f_ex.fe_start);
33 + &ac->ac_g_ex.fe_group,
34 + &ac->ac_g_ex.fe_start);
35 ac->ac_flags |= EXT4_MB_HINT_TRY_GOAL;
37 if (ar->pleft && (ar->lleft + 1 == start)) {
38 /* merge to the left */
39 ext4_get_group_no_and_offset(ac->ac_sb, ar->pleft + 1,
40 - &ac->ac_f_ex.fe_group,
41 - &ac->ac_f_ex.fe_start);
42 + &ac->ac_g_ex.fe_group,
43 + &ac->ac_g_ex.fe_start);
44 ac->ac_flags |= EXT4_MB_HINT_TRY_GOAL;