提交 1d1bf92d 编写于 作者: D David Sterba

btrfs: scrub: clean up division in scrub_find_csum

Use proper helpers for 64bit division.
Signed-off-by: NDavid Sterba <dsterba@suse.com>
上级 7736b0a4
......@@ -2708,7 +2708,9 @@ static int scrub_find_csum(struct scrub_ctx *sctx, u64 logical, u8 *csum)
if (!sum)
return 0;
index = ((u32)(logical - sum->bytenr)) / sctx->fs_info->sectorsize;
index = div_u64(logical - sum->bytenr, sctx->fs_info->sectorsize);
ASSERT(index < UINT_MAX);
num_sectors = sum->len / sctx->fs_info->sectorsize;
memcpy(csum, sum->sums + index, sctx->csum_size);
if (index == num_sectors - 1) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册