On 10 May 2019, at 7:15, Johannes Thumshirn wrote:

> Like btrfs_crc32c() btrfs_name_hash() is only a shim wrapper over the
> crc32c() library function. So we can just use btrfs_crc32c() instead 
> of
> btrfs_name_hash().

Reading through the rest of the series, but I think using 
btrfs_name_hash() is more clear and less error prone:

> -     key.offset = btrfs_name_hash(name, name_len);
> +     key.offset = (u64) btrfs_crc32c((u32)~1, name, name_len);

It groups together everyone using crc32c as a directory name hash (or 
extref hash), so that if we ever want to add different hashes later down 
the line, it's really clear what needs to change for what purpose.  With 
everyone calling into btrfs_crc32c directly, you have to spend more time 
looking through history to figure out how to change it.

Also, sprinkling (u32)~1 makes the code less readable imho.

-chris

Reply via email to