Skip to content

Commit

Permalink
btrfs: zoned: fix types for u64 division in btrfs_reclaim_bgs_work
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
David Sterba committed Jul 7, 2021
1 parent 629e33a commit 54afaae
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/btrfs/block-group.c
Original file line number Diff line number Diff line change
Expand Up @@ -1540,7 +1540,7 @@ void btrfs_reclaim_bgs_work(struct work_struct *work)
goto next;

btrfs_info(fs_info, "reclaiming chunk %llu with %llu%% used",
bg->start, div_u64(bg->used * 100, bg->length));
bg->start, div64_u64(bg->used * 100, bg->length));
trace_btrfs_reclaim_block_group(bg);
ret = btrfs_relocate_chunk(fs_info, bg->start);
if (ret)
Expand Down

0 comments on commit 54afaae

Please sign in to comment.