btrfs-progs: convert: move struct initialization to the init function

The context is zeroed in convert_open_fs after and overwrites the rbtree
initialization, which accidentally is the same (NULL).

Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2017-01-30 13:41:36 +01:00
parent 663253415f
commit cf83a41a02
2 changed files with 2 additions and 2 deletions

View File

@ -1159,8 +1159,6 @@ static int convert_open_fs(const char *devname,
{
int i;
memset(cctx, 0, sizeof(*cctx));
for (i = 0; i < ARRAY_SIZE(convert_operations); i++) {
int ret = convert_operations[i]->open_fs(cctx, devname);

View File

@ -40,6 +40,8 @@ static int intersect_with_sb(u64 bytenr, u64 num_bytes)
void init_convert_context(struct btrfs_convert_context *cctx)
{
memset(cctx, 0, sizeof(*cctx));
cache_tree_init(&cctx->used);
cache_tree_init(&cctx->data_chunks);
cache_tree_init(&cctx->free);