btrfs-progs: btrfstune: fix build-time detection of experimental features
Qu noticed that the full checksums are still printed even if the
experimental build is not enabled. This is caused by wrong use of #ifdef
(as the macro is always defined), this must be "#if".
Fixes: 1bb6fb896d
("btrfs-progs: btrfstune: experimental, new option to switch csums")
Reported-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
50a5dfde6d
commit
f1178950d3
|
@ -794,7 +794,7 @@ static void print_usage(void)
|
||||||
printf(" general:\n");
|
printf(" general:\n");
|
||||||
printf("\t-f allow dangerous operations, make sure that you are aware of the dangers\n");
|
printf("\t-f allow dangerous operations, make sure that you are aware of the dangers\n");
|
||||||
printf("\t--help print this help\n");
|
printf("\t--help print this help\n");
|
||||||
#ifdef EXPERIMENTAL
|
#if EXPERIMENTAL
|
||||||
printf("\nEXPERIMENTAL FEATURES:\n");
|
printf("\nEXPERIMENTAL FEATURES:\n");
|
||||||
printf(" checksum changes:\n");
|
printf(" checksum changes:\n");
|
||||||
printf("\t--csum CSUM switch checksum for data and metadata to CSUM\n");
|
printf("\t--csum CSUM switch checksum for data and metadata to CSUM\n");
|
||||||
|
@ -821,7 +821,7 @@ int BOX_MAIN(btrfstune)(int argc, char *argv[])
|
||||||
enum { GETOPT_VAL_CSUM = 256 };
|
enum { GETOPT_VAL_CSUM = 256 };
|
||||||
static const struct option long_options[] = {
|
static const struct option long_options[] = {
|
||||||
{ "help", no_argument, NULL, GETOPT_VAL_HELP},
|
{ "help", no_argument, NULL, GETOPT_VAL_HELP},
|
||||||
#ifdef EXPERIMENTAL
|
#if EXPERIMENTAL
|
||||||
{ "csum", required_argument, NULL, GETOPT_VAL_CSUM },
|
{ "csum", required_argument, NULL, GETOPT_VAL_CSUM },
|
||||||
#endif
|
#endif
|
||||||
{ NULL, 0, NULL, 0 }
|
{ NULL, 0, NULL, 0 }
|
||||||
|
@ -864,7 +864,7 @@ int BOX_MAIN(btrfstune)(int argc, char *argv[])
|
||||||
ctree_flags |= OPEN_CTREE_IGNORE_FSID_MISMATCH;
|
ctree_flags |= OPEN_CTREE_IGNORE_FSID_MISMATCH;
|
||||||
change_metadata_uuid = 1;
|
change_metadata_uuid = 1;
|
||||||
break;
|
break;
|
||||||
#ifdef EXPERIMENTAL
|
#if EXPERIMENTAL
|
||||||
case GETOPT_VAL_CSUM:
|
case GETOPT_VAL_CSUM:
|
||||||
ctree_flags |= OPEN_CTREE_SKIP_CSUM_CHECK;
|
ctree_flags |= OPEN_CTREE_SKIP_CSUM_CHECK;
|
||||||
csum_type = parse_csum_type(optarg);
|
csum_type = parse_csum_type(optarg);
|
||||||
|
|
|
@ -1218,7 +1218,9 @@ static void print_header_info(struct extent_buffer *eb, unsigned int mode)
|
||||||
{
|
{
|
||||||
struct btrfs_fs_info *fs_info = eb->fs_info;
|
struct btrfs_fs_info *fs_info = eb->fs_info;
|
||||||
char flags_str[128];
|
char flags_str[128];
|
||||||
|
#if EXPERIMENTAL
|
||||||
u8 csum[BTRFS_CSUM_SIZE];
|
u8 csum[BTRFS_CSUM_SIZE];
|
||||||
|
#endif
|
||||||
u64 flags;
|
u64 flags;
|
||||||
u32 nr;
|
u32 nr;
|
||||||
u8 backref_rev;
|
u8 backref_rev;
|
||||||
|
@ -1265,7 +1267,7 @@ static void print_header_info(struct extent_buffer *eb, unsigned int mode)
|
||||||
btrfs_header_bytenr(eb), flags, flags_str, backref_rev,
|
btrfs_header_bytenr(eb), flags, flags_str, backref_rev,
|
||||||
csum_str);
|
csum_str);
|
||||||
|
|
||||||
#ifdef EXPERIMENTAL
|
#if EXPERIMENTAL
|
||||||
printf("checksum stored ");
|
printf("checksum stored ");
|
||||||
for (i = 0; i < csum_size; i++)
|
for (i = 0; i < csum_size; i++)
|
||||||
printf("%02hhx", (int)(eb->data[i]));
|
printf("%02hhx", (int)(eb->data[i]));
|
||||||
|
|
Loading…
Reference in New Issue