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:
parent
663253415f
commit
cf83a41a02
|
@ -1159,8 +1159,6 @@ static int convert_open_fs(const char *devname,
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
memset(cctx, 0, sizeof(*cctx));
|
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(convert_operations); i++) {
|
for (i = 0; i < ARRAY_SIZE(convert_operations); i++) {
|
||||||
int ret = convert_operations[i]->open_fs(cctx, devname);
|
int ret = convert_operations[i]->open_fs(cctx, devname);
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,8 @@ static int intersect_with_sb(u64 bytenr, u64 num_bytes)
|
||||||
|
|
||||||
void init_convert_context(struct btrfs_convert_context *cctx)
|
void init_convert_context(struct btrfs_convert_context *cctx)
|
||||||
{
|
{
|
||||||
|
memset(cctx, 0, sizeof(*cctx));
|
||||||
|
|
||||||
cache_tree_init(&cctx->used);
|
cache_tree_init(&cctx->used);
|
||||||
cache_tree_init(&cctx->data_chunks);
|
cache_tree_init(&cctx->data_chunks);
|
||||||
cache_tree_init(&cctx->free);
|
cache_tree_init(&cctx->free);
|
||||||
|
|
Loading…
Reference in New Issue