All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Qu Wenruo <wqu@suse.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs-progs: print-tree: fix chunk/block group flags output
Date: Tue, 12 Oct 2021 12:17:28 +0200	[thread overview]
Message-ID: <20211012101728.GW9286@twin.jikos.cz> (raw)
In-Reply-To: <20211012021719.18496-1-wqu@suse.com>

On Tue, Oct 12, 2021 at 10:17:19AM +0800, Qu Wenruo wrote:
> [BUG]
> Commit ("btrfs-progs: use raid table for profile names in
> print-tree.c") introduced one bug in block group and chunk flags output
> and changed the behavior:
> 
> 	item 1 key (FIRST_CHUNK_TREE CHUNK_ITEM 13631488) itemoff 16105 itemsize 80
> 		length 8388608 owner 2 stripe_len 65536 type SINGLE
> 		...
> 	item 2 key (FIRST_CHUNK_TREE CHUNK_ITEM 22020096) itemoff 15993 itemsize 112
> 		length 8388608 owner 2 stripe_len 65536 type DUP
> 		...
> 	item 3 key (FIRST_CHUNK_TREE CHUNK_ITEM 30408704) itemoff 15881 itemsize 112
> 		length 268435456 owner 2 stripe_len 65536 type DUP
> 		...
> 
> Note that, the flag string only contains the profile (SINGLE/DUP/etc...)
> no type (DATA/METADATA/SYSTEM).
> 
> And we have new "SINGLE" string, even that profile has no extra bit to
> indicate that.
> 
> [CAUSE]
> The "SINGLE" part is caused by the raid array which has a name for
> SINGLE profile, even it doesn't have corresponding bit.
> 
> The missing type string is caused by a code bug:
> 
> 		strcpy(buf, name);
> 		while (*tmp) {
> 			*tmp = toupper(*tmp);
> 			tmp++;
> 		}
> 		strcpy(ret, buf);
> 
> The last strcpy() call overrides the existing string in @ret.
> 
> [FIX]
> - Enhance string handling using strn*()/snprintf()
> 
> - Add extra "UKNOWN.0x%llx" output for unknown profiles
> 
> - Call proper strncat() to merge type and profile
> 
> - Add extra handling for "SINGLE" to keep the old output
> 
> Signed-off-by: Qu Wenruo <wqu@suse.com>

Added to devel, thanks.

  reply	other threads:[~2021-10-12 10:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-12  2:17 [PATCH] btrfs-progs: print-tree: fix chunk/block group flags output Qu Wenruo
2021-10-12 10:17 ` David Sterba [this message]
2021-10-12 10:35 ` Nikolay Borisov
2021-10-12 10:38   ` Nikolay Borisov
2021-10-12 11:42     ` Qu Wenruo
2021-10-12 11:56       ` Nikolay Borisov
2021-10-12 12:24         ` Qu Wenruo
2021-10-12 13:59           ` Nikolay Borisov
2021-10-12 23:53             ` Qu Wenruo
2021-10-13 10:39               ` David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211012101728.GW9286@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=wqu@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.