Baokun Li <[email protected]> writes:
> Let's say we want to allocate 2 blocks starting from 4294966386, after
> predicting the file size, start is aligned to 4294965248, len is changed
> to 2048, then end = start + size = 0x100000000. Since end is of
> type ext4_lblk_t, i.e. uint, end is truncated to 0.
>
> This causes (pa->pa_lstart >= end) to always hold when checking if the
> current extent to be allocated crosses already preallocated blocks, so the
> resulting ac_g_ex may cross already preallocated blocks. Hence we convert
> the end type to loff_t and use pa_logical_end() to avoid overflow.
>
> Signed-off-by: Baokun Li <[email protected]>
> ---
> fs/ext4/mballoc.c | 21 ++++++++++-----------
> 1 file changed, 10 insertions(+), 11 deletions(-)
Looks good to me. Feel free to add:
Reviewed-by: Ritesh Harjani (IBM) <[email protected]>
-ritesh