diff --git a/convert/main.c b/convert/main.c index 9711874b..e2fbd3cd 100644 --- a/convert/main.c +++ b/convert/main.c @@ -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; diff --git a/ctree.h b/ctree.h index 0d12563b..8c8d7e88 100644 --- a/ctree.h +++ b/ctree.h @@ -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 }; diff --git a/mkfs/common.h b/mkfs/common.h index 28912906..1ca71a4f 100644 --- a/mkfs/common.h +++ b/mkfs/common.h @@ -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 */ diff --git a/mkfs/main.c b/mkfs/main.c index b752da13..aa13adea 100644 --- a/mkfs/main.c +++ b/mkfs/main.c @@ -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;