btrfs-progs: make checksum type explicit in mkfs context structure

Add checksum type to the definition structure for a new filesystem, this
will be used in following patches.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Johannes Thumshirn 2019-09-24 15:21:36 +02:00 committed by David Sterba
parent 669f561775
commit 779ada6edd
4 changed files with 7 additions and 1 deletions

View File

@ -1158,6 +1158,7 @@ static int do_convert(const char *devname, u32 convert_flags, u32 nodesize,
printf("\tfeatures: %s\n", features_buf);
memset(&mkfs_cfg, 0, sizeof(mkfs_cfg));
mkfs_cfg.csum_type = BTRFS_CSUM_TYPE_CRC32;
mkfs_cfg.label = cctx.volume_name;
mkfs_cfg.num_bytes = total_bytes;
mkfs_cfg.nodesize = nodesize;

View File

@ -165,7 +165,9 @@ struct btrfs_free_space_ctl;
#define BTRFS_CSUM_SIZE 32
/* csum types */
#define BTRFS_CSUM_TYPE_CRC32 0
enum btrfs_csum_type {
BTRFS_CSUM_TYPE_CRC32 = 0,
};
/* four bytes for CRC32 */
static int btrfs_csum_sizes[] = { 4 };

View File

@ -53,6 +53,8 @@ struct btrfs_mkfs_config {
u64 features;
/* Size of the filesystem in bytes */
u64 num_bytes;
/* checksum algorithm to use */
enum btrfs_csum_type csum_type;
/* Output fields, set during creation */

View File

@ -1169,6 +1169,7 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
warning("metadata has lower redundancy than data!\n");
}
mkfs_cfg.csum_type = BTRFS_CSUM_TYPE_CRC32;
mkfs_cfg.label = label;
memcpy(mkfs_cfg.fs_uuid, fs_uuid, sizeof(mkfs_cfg.fs_uuid));
mkfs_cfg.num_bytes = dev_block_count;