Skip to content

Commit 54afaae

Browse files
committed
btrfs: zoned: fix types for u64 division in btrfs_reclaim_bgs_work
The types in calculation of the used percentage in the reclaiming messages are both u64, though bg->length is either 1GiB (non-zoned) or the zone size in the zoned mode. The upper limit on zone size is 8GiB so this could theoretically overflow in the future, right now the values fit. Fixes: 18bb8bb ("btrfs: zoned: automatically reclaim zones") CC: stable@vger.kernel.org # 5.13 Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent 629e33a commit 54afaae

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

fs/btrfs/block-group.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1540,7 +1540,7 @@ void btrfs_reclaim_bgs_work(struct work_struct *work)
15401540
goto next;
15411541

15421542
btrfs_info(fs_info, "reclaiming chunk %llu with %llu%% used",
1543-
bg->start, div_u64(bg->used * 100, bg->length));
1543+
bg->start, div64_u64(bg->used * 100, bg->length));
15441544
trace_btrfs_reclaim_block_group(bg);
15451545
ret = btrfs_relocate_chunk(fs_info, bg->start);
15461546
if (ret)

0 commit comments

Comments
 (0)