Message ID | 3786140da052ad5067bc6d2990325519c4abd1e0.1624904192.git.johannes.thumshirn@wdc.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | btrfs: zoned: improve logging message for auto reclaim | expand |
On Tue, Jun 29, 2021 at 03:16:46AM +0900, Johannes Thumshirn wrote: > - btrfs_info(fs_info, "reclaiming chunk %llu with %llu%% used", > - bg->start, div_u64(bg->used * 100, bg->length)); > + btrfs_info(fs_info, > + "reclaiming chunk %llu with %llu%% used %llu%% unusable", > + bg->start, div_u64(bg->used * 100, bg->length), > + div64_u64(zone_unusable * 100, bg->length)); Btw, the bg->used also needs div64_u64, I had a patch somewhere but can't find it so please fix it as you're touching the code. Regarding the message, it would not show in non-zoned mode so it should be ok to print it unconditionally. Once the background reclaim is also done for regular fs the 'unusable' might be confusing but we can fix that if neccesary, printing int + string conditionally needs some magic. I'll add this patch to misc-next, switching the div helpers could happen in the reverse order but I'll fix that eventually. > trace_btrfs_reclaim_block_group(bg); > ret = btrfs_relocate_chunk(fs_info, bg->start); > if (ret) > -- > 2.31.1
On Tue, Jun 29, 2021 at 03:16:46AM +0900, Johannes Thumshirn wrote: > When we're automatically reclaiming a zone, because its zone_unusable > value is above the reclaim threshold, we're only logging how much percent > of the zone's capacity are used, but not how much of the capacity is unusable. > > Also print the percentage of the unusable space in the block group before > we're reclaiming it. > > Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Added to misc-next, thanks.
diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c index 38b127b9edfc..98296eef561e 100644 --- a/fs/btrfs/block-group.c +++ b/fs/btrfs/block-group.c @@ -1501,6 +1501,7 @@ void btrfs_reclaim_bgs_work(struct work_struct *work) mutex_lock(&fs_info->reclaim_bgs_lock); spin_lock(&fs_info->unused_bgs_lock); while (!list_empty(&fs_info->reclaim_bgs)) { + u64 zone_unusable; int ret = 0; bg = list_first_entry(&fs_info->reclaim_bgs, @@ -1534,13 +1535,22 @@ void btrfs_reclaim_bgs_work(struct work_struct *work) goto next; } + /* + * Cache the zone_unusable value before tunring the block group + * to read only. As soon as the blog group is read only it's + * zone_unusable value gets moved to the block group's read-only + * bytes and isn't available for calculations anymore. + */ + zone_unusable = bg->zone_unusable; ret = inc_block_group_ro(bg, 0); up_write(&space_info->groups_sem); if (ret < 0) goto next; - btrfs_info(fs_info, "reclaiming chunk %llu with %llu%% used", - bg->start, div_u64(bg->used * 100, bg->length)); + btrfs_info(fs_info, + "reclaiming chunk %llu with %llu%% used %llu%% unusable", + bg->start, div_u64(bg->used * 100, bg->length), + div64_u64(zone_unusable * 100, bg->length)); trace_btrfs_reclaim_block_group(bg); ret = btrfs_relocate_chunk(fs_info, bg->start); if (ret)
When we're automatically reclaiming a zone, because its zone_unusable value is above the reclaim threshold, we're only logging how much percent of the zone's capacity are used, but not how much of the capacity is unusable. Also print the percentage of the unusable space in the block group before we're reclaiming it. Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> --- fs/btrfs/block-group.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)