[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <52955ad12afbc737db46adcbc1963706b2d002ff.1667822611.git.ritesh.list@gmail.com>
Date: Mon, 7 Nov 2022 17:51:45 +0530
From: "Ritesh Harjani (IBM)" <ritesh.list@...il.com>
To: Theodore Ts'o <tytso@....edu>
Cc: linux-ext4@...r.kernel.org,
Harshad Shirwadkar <harshadshirwadkar@...il.com>,
Wang Shilong <wshilong@....com>,
Andreas Dilger <adilger.kernel@...ger.ca>,
Li Xi <lixi@....com>, Ritesh Harjani <ritesh.list@...il.com>
Subject: [RFCv1 57/72] e2fsck: cleanup e2fsck_pass1_thread_join()
From: Wang Shilong <wshilong@....com>
Use e2fsck_reset_context() to free memory to simpify
codes.
Signed-off-by: Wang Shilong <wshilong@....com>
Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@...il.com>
---
e2fsck/pass1.c | 33 +++++++--------------------------
1 file changed, 7 insertions(+), 26 deletions(-)
diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c
index 29333acf..93cff80e 100644
--- a/e2fsck/pass1.c
+++ b/e2fsck/pass1.c
@@ -3008,39 +3008,20 @@ static int e2fsck_pass1_thread_join(e2fsck_t global_ctx, e2fsck_t thread_ctx)
errcode_t retval;
retval = e2fsck_pass1_merge_context(global_ctx, thread_ctx);
- e2fsck_pass1_free_bitmap(&thread_ctx->inode_used_map);
- e2fsck_pass1_free_bitmap(&thread_ctx->inode_bad_map);
- e2fsck_pass1_free_bitmap(&thread_ctx->inode_dir_map);
- e2fsck_pass1_free_bitmap(&thread_ctx->inode_bb_map);
- e2fsck_pass1_free_bitmap(&thread_ctx->inode_imagic_map);
- e2fsck_pass1_free_bitmap(&thread_ctx->inode_reg_map);
- e2fsck_pass1_free_bitmap(&thread_ctx->inodes_to_rebuild);
- e2fsck_pass1_free_bitmap(&thread_ctx->block_found_map);
- e2fsck_pass1_free_bitmap(&thread_ctx->block_ea_map);
- if (thread_ctx->refcount)
- ea_refcount_free(thread_ctx->refcount);
- if (thread_ctx->refcount_extra)
- ea_refcount_free(thread_ctx->refcount_extra);
- if (thread_ctx->ea_inode_refs)
- ea_refcount_free(thread_ctx->ea_inode_refs);
- if (thread_ctx->refcount_orig)
- ea_refcount_free(thread_ctx->refcount_orig);
- e2fsck_free_dir_info(thread_ctx);
- ext2fs_free_icount(thread_ctx->inode_count);
- ext2fs_free_icount(thread_ctx->inode_link_info);
- if (thread_ctx->dirs_to_hash)
- ext2fs_badblocks_list_free(thread_ctx->dirs_to_hash);
- quota_release_context(&thread_ctx->qctx);
- ext2fs_free_mem(&thread_ctx->invalid_block_bitmap_flag);
- ext2fs_free_mem(&thread_ctx->invalid_inode_bitmap_flag);
- ext2fs_free_mem(&thread_ctx->invalid_inode_table_flag);
+ /*
+ * @block_metadata_map and @block_dup_map are
+ * shared, so we don't free them.
+ */
+ thread_ctx->block_metadata_map = NULL;
+ thread_ctx->block_dup_map = NULL;
if (thread_ctx->logf)
fclose(thread_ctx->logf);
if (thread_ctx->problem_logf) {
fputs("</problem_log>\n", thread_ctx->problem_logf);
fclose(thread_ctx->problem_logf);
}
+ e2fsck_reset_context(thread_ctx);
ext2fs_free_mem(&thread_ctx);
return retval;
}
--
2.37.3
Powered by blists - more mailing lists