With the introduction of xxhash64 to btrfs-progs we created a crypto/
directory for all the hashes used in btrfs (although no
cryptographically secure hash is there yet).
Move the crc32c implementation from kernel-lib/ to crypto/ as well so we
have all hashes consolidated.
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: David Sterba <dsterba@suse.com>
Fix compiler warnings and errors in btrfs-sb-mod due to incorrect
conversion with the checksum updates.
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: David Sterba <dsterba@suse.com>
Update the checksumming API to be able to cope with more checksum types
than just CRC32C. The finalization call is merged into btrfs_csum_data.
There are some fixme's and asserts added that need to be resolved.
Co-developed-by: David Sterba <dsterba@suse.com>
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: David Sterba <dsterba@suse.com>
update_block_csum() in btrfs-sb-mod.c is always called with the 'is_sb'
argument set to 1.
Get rid of the special case for is_sb == 0.
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
In preparation to supporting new checksum algorithm pass the checksum type
to btrfs_csum_data/btrfs_csum_final, this allows us to encapsulate any
differences in processing into the respective functions
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: David Sterba <dsterba@suse.com>
Pass pointer to a generic buffer instead of fixed size that crc32c
currently uses.
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: David Sterba <dsterba@suse.com>
Add support for changing all integer items in the superblock. Sort them
in the order of defintion in the structure.
Signed-off-by: David Sterba <dsterba@suse.com>
The field type bit width is now only used to describe the members, but
let's add all of the integer ones.
Signed-off-by: David Sterba <dsterba@suse.com>
$ make btrfs-sb-mod
$ ./btrfs-sb-mod image field1 operation1 ...
Fields (only u64 supported for now):
* total_bytes
* root
* generation
* chunk_root
* chunk_root_generation
* cache_generation
* uuid_tree_generation
Operations:
* read value ?0
* set value =NUMBER
* add to +NUMBER
* subtract from value -NUMBER
* xor with value ^NUMBER
* byteswap (u64) @0
Use with care!
Signed-off-by: David Sterba <dsterba@suse.com>