add patch fix-abs-usage-in-ext4_mb_check_group_pa
[ext4-patch-queue.git] / fix-abs-usage-in-ext4_mb_check_group_pa
blobf1a9c76feba6d8a33f1eaf09aa5b7c3f3a98784b
1 ext4: fix abs() usage in ext4_mb_check_group_pa
3 From: John Stultz <john.stultz@linaro.org>
5 The ext4_fsblk_t type is a long long, which should not be used
6 with abs(), as is done in ext4_mb_check_group_pa().
8 This patch modifies ext4_mb_check_group_pa() to use abs64()
9 instead.
11 Signed-off-by: John Stultz <john.stultz@linaro.org>
12 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
13 ---
14  fs/ext4/mballoc.c | 4 ++--
15  1 file changed, 2 insertions(+), 2 deletions(-)
17 diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
18 index 34b610e..4780ab1 100644
19 --- a/fs/ext4/mballoc.c
20 +++ b/fs/ext4/mballoc.c
21 @@ -3331,8 +3331,8 @@ ext4_mb_check_group_pa(ext4_fsblk_t goal_block,
22                 atomic_inc(&pa->pa_count);
23                 return pa;
24         }
25 -       cur_distance = abs(goal_block - cpa->pa_pstart);
26 -       new_distance = abs(goal_block - pa->pa_pstart);
27 +       cur_distance = abs64(goal_block - cpa->pa_pstart);
28 +       new_distance = abs64(goal_block - pa->pa_pstart);
30         if (cur_distance <= new_distance)
31                 return cpa;