btrfs-progs/kernel-shared
Qu Wenruo eacdd1606c btrfs-progs: print-tree: fix chunk/block group flags output
[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 the 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>
Signed-off-by: David Sterba <dsterba@suse.com>
2021-10-20 18:59:24 +02:00
..
backref.c btrfs-progs: move transaction.c to kernel-shared/ 2020-08-31 17:01:06 +02:00
backref.h btrfs-progs: move extent_io.c to kernel-shared/ 2020-08-31 17:01:04 +02:00
ctree.c btrfs-progs: remove direct calls to crc32c from ctree.h 2021-10-08 20:46:35 +02:00
ctree.h btrfs-progs: remove direct calls to crc32c from ctree.h 2021-10-08 20:46:35 +02:00
delayed-ref.c btrfs-progs: don't include btrfs-list.h unless necessary 2021-10-08 20:47:03 +02:00
delayed-ref.h btrfs-progs: unify GPL header comments 2021-09-07 13:58:44 +02:00
dir-item.c btrfs-progs: remove root argument from btrfs_truncate_item 2021-10-08 20:46:34 +02:00
disk-io.c btrfs-progs: use direct-io for zoned device 2021-10-20 18:59:23 +02:00
disk-io.h btrfs-progs: introduce OPEN_CTREE_ALLOW_TRANSID_MISMATCH flag 2021-09-20 12:17:29 +02:00
extent-tree.c btrfs-progs: rename data parameter to profile in extent allocation path 2021-10-20 18:59:24 +02:00
extent_io.c btrfs-progs: introduce btrfs_pread wrapper for pread 2021-10-20 18:59:23 +02:00
extent_io.h btrfs-progs: move extent_io.c to kernel-shared/ 2020-08-31 17:01:04 +02:00
file-item.c btrfs-progs: remove root argument from btrfs_truncate_item 2021-10-08 20:46:34 +02:00
file.c btrfs-progs: move transaction.c to kernel-shared/ 2020-08-31 17:01:06 +02:00
free-space-cache.c btrfs-progs: check: batch v1 space cache inodes when clearing 2021-07-22 16:26:05 +02:00
free-space-cache.h btrfs-progs: check: batch v1 space cache inodes when clearing 2021-07-22 16:26:05 +02:00
free-space-tree.c btrfs-progs: add add_block_group_free_space helper 2021-09-06 16:36:17 +02:00
free-space-tree.h btrfs-progs: add add_block_group_free_space helper 2021-09-06 16:36:17 +02:00
inode-item.c btrfs-progs: remove root argument from btrfs_truncate_item 2021-10-08 20:46:34 +02:00
inode.c btrfs-progs: make btrfs_lookup_dir_index in parity with kernel code 2020-08-31 17:09:49 +02:00
print-tree.c btrfs-progs: print-tree: fix chunk/block group flags output 2021-10-20 18:59:24 +02:00
print-tree.h btrfs-progs: dump-tree: add options to dump checksums 2021-06-19 22:07:49 +02:00
root-tree.c btrfs-progs: move transaction.c to kernel-shared/ 2020-08-31 17:01:06 +02:00
send.h btrfs-progs: libbtrfs: replace SZ_ constants and drop sizes.h 2021-10-08 20:46:35 +02:00
transaction.c btrfs-progs: zoned: redirty clean extent buffers 2021-05-06 16:41:45 +02:00
transaction.h btrfs-progs: move transaction.c to kernel-shared/ 2020-08-31 17:01:06 +02:00
ulist.c btrfs-progs: unify GPL header comments 2021-09-07 13:58:44 +02:00
ulist.h btrfs-progs: unify GPL header comments 2021-09-07 13:58:44 +02:00
uuid-tree.c btrfs-progs: add btrfs_uuid_tree_remove 2021-10-08 20:46:34 +02:00
volumes.c btrfs-progs: introduce helper for striped profiles 2021-10-20 18:59:24 +02:00
volumes.h btrfs-progs: introduce helper for striped profiles 2021-10-20 18:59:24 +02:00
zoned.c btrfs-progs: zoned: factor out supported profiles to a helper 2021-10-20 18:59:23 +02:00
zoned.h btrfs-progs: remove max_zone_append_size logic 2021-10-06 16:49:07 +02:00