Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b27b1535 authored by Xiaoguang Wang's avatar Xiaoguang Wang Committed by Theodore Ts'o
Browse files

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: default avatarXiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
Reviewed-by: default avatarLukas Czerner <lczerner@redhat.com>
parent 83447ccb
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -3076,7 +3076,8 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac,
		size = 8 * 1024 * 1024;
	} else {
		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;
	start = start_off >> bsbits;