Whamcloud - gitweb
LU-8465 e2fsck: add assert when copying context 15/40015/5
authorLi Xi <lixi@ddn.com>
Wed, 7 Aug 2019 07:34:00 +0000 (15:34 +0800)
committerAndreas Dilger <adilger@whamcloud.com>
Fri, 25 Sep 2020 03:30:19 +0000 (03:30 +0000)
Adding the assert would simplify the copying of context.

Signed-off-by: Li Xi <lixi@ddn.com>
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Change-Id: I5270884f5c5cb3c8c51ca34f7e37fed4fc0b30f1
Reviewed-on: https://review.whamcloud.com/40015
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Andreas Dilger <adilger@whamcloud.com>
e2fsck/pass1.c

index 4f9f64a..dceeecf 100644 (file)
@@ -47,6 +47,7 @@
 #ifdef HAVE_ERRNO_H
 #include <errno.h>
 #endif
+#include <assert.h>
 
 #include "e2fsck.h"
 #include <ext2fs/ext2_ext_attr.h>
@@ -2387,6 +2388,19 @@ static errcode_t e2fsck_pass1_thread_prepare(e2fsck_t global_ctx, e2fsck_t *thre
        ext2_filsys     thread_fs;
        ext2_filsys     global_fs = global_ctx->fs;
 
+       assert(global_ctx->inode_used_map == NULL);
+       assert(global_ctx->inode_dir_map == NULL);
+       assert(global_ctx->inode_bb_map == NULL);
+       assert(global_ctx->inode_imagic_map == NULL);
+       assert(global_ctx->inode_reg_map == NULL);
+       assert(global_ctx->inodes_to_rebuild == NULL);
+
+       assert(global_ctx->block_found_map == NULL);
+       assert(global_ctx->block_dup_map == NULL);
+       assert(global_ctx->block_ea_map == NULL);
+       assert(global_ctx->block_metadata_map == NULL);
+       assert(global_ctx->fs->dblist == NULL);
+
        retval = ext2fs_get_mem(sizeof(struct e2fsck_struct), &thread_context);
        if (retval) {
                com_err(global_ctx->program_name, retval, "while allocating memory");