ext4: fix wrong size computation in ext4_mb_normalize_request()

As the member fe_len defined in struct ext4_free_extent is expressed as
number of clusters, the variable "size" computation is wrong, we need to
first translate fe_len to block number, then to bytes.

Signed-off-by: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Lukas Czerner <lczerner@redhat.com>
This commit is contained in:
Xiaoguang Wang 2014-07-27 22:26:36 -04:00 коммит произвёл Theodore Ts'o
Родитель 83447ccb4d
Коммит b27b1535ac
1 изменённых файлов: 3 добавлений и 2 удалений

Просмотреть файл

@ -3075,8 +3075,9 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac,
(23 - bsbits)) << 23; (23 - bsbits)) << 23;
size = 8 * 1024 * 1024; size = 8 * 1024 * 1024;
} else { } else {
start_off = (loff_t)ac->ac_o_ex.fe_logical << bsbits; start_off = (loff_t) ac->ac_o_ex.fe_logical << bsbits;
size = ac->ac_o_ex.fe_len << bsbits; size = (loff_t) EXT4_C2B(EXT4_SB(ac->ac_sb),
ac->ac_o_ex.fe_len) << bsbits;
} }
size = size >> bsbits; size = size >> bsbits;
start = start_off >> bsbits; start = start_off >> bsbits;