From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C8ACC43334 for ; Tue, 19 Jul 2022 20:56:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237796AbiGSU4F (ORCPT ); Tue, 19 Jul 2022 16:56:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234727AbiGSU4E (ORCPT ); Tue, 19 Jul 2022 16:56:04 -0400 Received: from box.fidei.email (box.fidei.email [IPv6:2605:2700:0:2:a800:ff:feba:dc44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AECAC474D0 for ; Tue, 19 Jul 2022 13:56:03 -0700 (PDT) Received: from authenticated-user (box.fidei.email [71.19.144.250]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by box.fidei.email (Postfix) with ESMTPSA id 28AEF80411; Tue, 19 Jul 2022 16:56:01 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=dorminy.me; s=mail; t=1658264163; bh=z82U1/j5uE184J5LSD0GcBL9IxW68m+UXrDpCWGARxg=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=Us6YkVv0n4BXCNP0tZUhubfhTIFRqbfqUH1kGa06GHSwpXIabo601B8KYAVY7yu9Y pdGQtxeGvY8plBpWFuXohp66giKgURYZ0ntIb16/+UxIOuixqkm1oUq4j8rh1LWp/f tUlCPs2dLTaexqVpj0hf3DkEGCkte0PK35VIZ1Yevnd9whb8CDmJvg05u5qbG6pHHI el5ZRhTfID5a6+Uzbj8g8NVTWAF+Vow34xjKIhYxUIxmJvw4YMW/2fue0g5MyELLU3 X9o/jgfnb2D+ATkuu0imXOVeZivvSXgCj+qP+DIYRt2wLgX8zyqIe2YTauiihUmpTV ej114IeE8nk4Q== Message-ID: Date: Tue, 19 Jul 2022 16:56:00 -0400 MIME-Version: 1.0 Subject: Re: [PATCH v2 2/4] btrfs: make __btrfs_dump_space_info() output better formatted Content-Language: en-US To: Qu Wenruo , linux-btrfs@vger.kernel.org Cc: Johannes Thumshirn References: From: Sweet Tea Dorminy In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org On 7/19/22 01:11, Qu Wenruo wrote: > The format change includes: > > - Output each bytes_* in a separate line > > - All bytes_* output starts at the same vertical position > Do human a favor reading the numbers > > - Skip zone specific numbers if zone is not enabled > > Now one example of __btrfs_dump_space_info() looks like this for its > bytes_* members. > > BTRFS info (device dm-1: state A): space_info META has 251494400 free, is not full > BTRFS info (device dm-1: state A): total: 268435456 > BTRFS info (device dm-1: state A): used: 376832 > BTRFS info (device dm-1: state A): pinned: 229376 > BTRFS info (device dm-1: state A): reserved: 0 > BTRFS info (device dm-1: state A): may_use: 16269312 > BTRFS info (device dm-1: state A): read_only: 65536 > > Signed-off-by: Qu Wenruo > Reviewed-by: Johannes Thumshirn > --- > fs/btrfs/space-info.c | 14 +++++++++----- > 1 file changed, 9 insertions(+), 5 deletions(-) > > diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c > index 36b466525318..623fa0488545 100644 > --- a/fs/btrfs/space-info.c > +++ b/fs/btrfs/space-info.c > @@ -475,11 +475,15 @@ static void __btrfs_dump_space_info(struct btrfs_fs_info *fs_info, > flag_str, > (s64)(info->total_bytes - btrfs_space_info_used(info, true)), > info->full ? "" : "not "); > - btrfs_info(fs_info, > - "space_info total=%llu, used=%llu, pinned=%llu, reserved=%llu, may_use=%llu, readonly=%llu zone_unusable=%llu", > - info->total_bytes, info->bytes_used, info->bytes_pinned, > - info->bytes_reserved, info->bytes_may_use, > - info->bytes_readonly, info->bytes_zone_unusable); > + btrfs_info(fs_info, " total: %llu", info->total_bytes); > + btrfs_info(fs_info, " used: %llu", info->bytes_used); > + btrfs_info(fs_info, " pinned: %llu", info->bytes_pinned); > + btrfs_info(fs_info, " reserved: %llu", info->bytes_reserved); > + btrfs_info(fs_info, " may_use: %llu", info->bytes_may_use); > + btrfs_info(fs_info, " read_only: %llu", info->bytes_readonly); > + if (btrfs_is_zoned(fs_info)) > + btrfs_info(fs_info, > + " zone_unusable: %llu", info->bytes_zone_unusable); I'm (perhaps needlessly) worried about splitting this up into six/seven messages, because of the ratelimiting rolled into btrfs_printk. The ratelimit is 100 messages per 5 * HZ, and it seems like it would be unfortunate if it kicked in during the middle of this dump and prevented later info from being dumped. Maybe we should add a btrfs_dump_printk() helper that doesn't have a ratelimit built in, for exceptional cases like this where we really, really don't want anything ratelimited? > > DUMP_BLOCK_RSV(fs_info, global_block_rsv); > DUMP_BLOCK_RSV(fs_info, trans_block_rsv);