From cf83a41a02e2f1f86f6b3c10abe0bf051a151c62 Mon Sep 17 00:00:00 2001 From: David Sterba Date: Mon, 30 Jan 2017 13:41:36 +0100 Subject: [PATCH] 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 --- convert/main.c | 2 -- convert/source-fs.c | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/convert/main.c b/convert/main.c index 5a2da31..b0d72d3 100644 --- a/convert/main.c +++ b/convert/main.c @@ -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); diff --git a/convert/source-fs.c b/convert/source-fs.c index f295277..e87b861 100644 --- a/convert/source-fs.c +++ b/convert/source-fs.c @@ -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); -- 2.7.4