From: Johannes Thumshirn <jthumshirn@suse.de>
To: Nikolay Borisov <nborisov@suse.com>, David Sterba <dsterba@suse.com>
Cc: Linux BTRFS Mailinglist <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH v2 10/11] btrfs-progs: add xxhash64 as checksum algorithm
Date: Fri, 30 Aug 2019 11:33:29 +0200 [thread overview]
Message-ID: <b3f0272f-f432-ed09-353c-9be25bb0bc9e@suse.de> (raw)
In-Reply-To: <8fcda19d-bb77-5ad4-da05-723995c3a039@suse.com>
On 27/08/2019 16:16, Nikolay Borisov wrote:
[...]
>> static void dump_superblock(struct btrfs_super_block *sb, int full)
>> {
>> int i;
>> @@ -326,15 +337,11 @@ static void dump_superblock(struct btrfs_super_block *sb, int full)
>> csum_type = btrfs_super_csum_type(sb);
>> csum_size = BTRFS_CSUM_SIZE;
>> printf("csum_type\t\t%hu (", csum_type);
>> - if (csum_type >= ARRAY_SIZE(btrfs_csum_sizes)) {
>> + if (csum_type >= ARRAY_SIZE(btrfs_csums)) {
> Why not is_valid_csum_type ?
Fixed.
>> printf("INVALID");
>> } else {
>> - if (csum_type == BTRFS_CSUM_TYPE_CRC32) {
>> - printf("crc32c");
>> - csum_size = btrfs_csum_sizes[csum_type];
>> - } else {
>> - printf("unknown");
>> - }
>> + printf("%s", btrfs_csums[csum_type].name);
>> + csum_size = btrfs_csums[csum_type].size;
>> }
>> printf(")\n");
>> printf("csum_size\t\t%llu\n", (unsigned long long)csum_size);
>> @@ -342,8 +349,8 @@ static void dump_superblock(struct btrfs_super_block *sb, int full)
>> printf("csum\t\t\t0x");
>> for (i = 0, p = sb->csum; i < csum_size; i++)
>> printf("%02x", p[i]);
>> - if (csum_type != BTRFS_CSUM_TYPE_CRC32 ||
>> - csum_size != btrfs_csum_sizes[BTRFS_CSUM_TYPE_CRC32])
>> + if (!is_valid_csum_type(csum_type) ||
>> + csum_size != btrfs_csums[csum_type].size)
>
> That second check - can it ever trigger? If the csum_type >= ARRAY_SIZE
> goes into the else branch then csum_size == btrfs_csums[csum_type].size
> so this check is guaranteed to never fail. OTOH, if we print invalid
> above then csum_type is guaranteed to be above ARRAY_SIZE(btrfs_csums)
> and I thin this guarantees that !is_valid_csum_type(csum_type) is going
> to be true e.g. we will print UNKNOWN CSUM type. So I guess a simple
>
> 'if (!is_valid_csum_type(csum_type)' will suffice here?
Right, fixed as well.
[...]
>> -#include "xxh3.h"
>> +/* #include "xxh3.h" */
>
> Does that mean progs compilation is broken by the previous patch since
> it includes a file which cannot be found?
It broke bisectability, fix it now.
[...]
>> if (strcasecmp(s, "crc32c") == 0) {
>> return BTRFS_CSUM_TYPE_CRC32;
>> + } else if (strcasecmp(s, "xxhash64") == 0 ||
>> + strcasecmp(s, "xxhash") == 0) {
>
> Don't we want to be very explicit about only supporting xxhash64, and
> not aliasing xxhash to mean xxhash64? I.e remove the xxhash comparison
> and consider it invalid.
I'll keep that alias as per Dave's comment.
Thanks,
Johannes
--
Johannes Thumshirn SUSE Labs Filesystems
jthumshirn@suse.de +49 911 74053 689
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5
90409 Nürnberg
Germany
(HRB 247165, AG München)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
next prev parent reply other threads:[~2019-08-30 9:33 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-26 11:48 [PATCH v2 00/11] btrfs-progs: support xxhash64 checksums Johannes Thumshirn
2019-08-26 11:48 ` [PATCH v2 01/11] btrfs-progs: don't blindly assume crc32c in csum_tree_block_size() Johannes Thumshirn
2019-08-27 16:33 ` David Sterba
2019-08-27 16:36 ` David Sterba
2019-08-28 7:48 ` Johannes Thumshirn
2019-08-26 11:48 ` [PATCH v2 02/11] btrfs-progs: cache csum_type in recover_control Johannes Thumshirn
2019-08-26 11:48 ` [PATCH v2 03/11] btrfs-progs: add checksum type to checksumming functions Johannes Thumshirn
2019-08-27 12:51 ` Nikolay Borisov
2019-08-26 11:48 ` [PATCH v2 04/11] btrfs-progs: don't assume checksums are always 4 bytes Johannes Thumshirn
2019-08-27 12:52 ` Nikolay Borisov
2019-08-26 11:48 ` [PATCH v2 05/11] btrfs-progs: pass checksum type to btrfs_csum_data()/btrfs_csum_final() Johannes Thumshirn
2019-08-27 12:53 ` Nikolay Borisov
2019-08-26 11:48 ` [PATCH v2 06/11] btrfs-progs: simplify update_block_csum() in btrfs-sb-mod.c Johannes Thumshirn
2019-08-26 11:48 ` [PATCH v2 07/11] btrfs-progs: update checksumming api Johannes Thumshirn
2019-08-26 11:48 ` [PATCH v2 08/11] btrfs-progs: add option for checksum type to mkfs Johannes Thumshirn
2019-08-27 13:03 ` Nikolay Borisov
2019-08-26 11:48 ` [PATCH v2 09/11] btrfs-progs: add xxhash sources Johannes Thumshirn
2019-08-27 13:05 ` Nikolay Borisov
2019-08-27 16:20 ` David Sterba
2019-08-26 11:48 ` [PATCH v2 10/11] btrfs-progs: add xxhash64 as checksum algorithm Johannes Thumshirn
2019-08-27 14:16 ` Nikolay Borisov
2019-08-27 16:12 ` David Sterba
2019-08-30 9:33 ` Johannes Thumshirn [this message]
2019-08-26 11:48 ` [PATCH v2 11/11] btrfs-progs: add test-case for mkfs with xxhash64 Johannes Thumshirn
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=b3f0272f-f432-ed09-353c-9be25bb0bc9e@suse.de \
--to=jthumshirn@suse.de \
--cc=dsterba@suse.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=nborisov@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox