dgrp_t et_group_next;
/* Scanned inode number */
ext2_ino_t et_inode_number;
- char et_log_buf[2048];
char et_log_length;
+ char et_log_buf[2048];
};
#endif
ext2_ino_t stashed_ino;
struct ext2_inode *stashed_inode;
- /* if @global_ctx is null, this field is unused */
-#ifdef CONFIG_PFSCK
- struct e2fsck_thread thread_info;
-#endif
-
/*
* Directory information
*/
__u32 fs_fragmented_dir;
__u32 large_files;
__u32 extent_depth_count[MAX_EXTENT_DEPTH_COUNT];
+
#ifdef CONFIG_PFSCK
- __u32 fs_num_threads;
+ /* if @global_ctx is null, this field is unused */
+ struct e2fsck_thread thread_info;
+ __u32 pfs_num_threads;
__u32 mmp_update_thread;
int fs_need_locking;
/* serialize fix operation for multiple threads */
void check_resize_inode(e2fsck_t ctx);
/* util.c */
-#define E2FSCK_MAX_THREADS (65536)
+#define E2FSCK_MAX_THREADS (65535)
extern void *e2fsck_allocate_memory(e2fsck_t ctx, unsigned long size,
const char *description);
extern int ask(e2fsck_t ctx, const char * string, int def);
{
unsigned flexbg_size = 1;
ext2_filsys fs = ctx->fs;
- int num_threads = ctx->fs_num_threads;
+ int num_threads = ctx->pfs_num_threads;
int max_threads;
if (num_threads < 1) {
max_threads = fs->group_desc_count / flexbg_size;
if (max_threads == 0)
max_threads = 1;
+ if (max_threads > E2FSCK_MAX_THREADS)
+ max_threads = E2FSCK_MAX_THREADS;
if (num_threads > max_threads) {
fprintf(stderr, "Use max possible thread num: %d instead\n",
num_threads = max_threads;
}
out:
- ctx->fs_num_threads = num_threads;
+ ctx->pfs_num_threads = num_threads;
ctx->fs->fs_num_threads = num_threads;
}
#endif
#ifdef CONFIG_PFSCK
/* don't use more than 1/10 of memory for threads checking */
- readahead_kb = get_memory_size() / (10 * ctx->fs_num_threads);
+ readahead_kb = get_memory_size() / (10 * ctx->pfs_num_threads);
/* maybe better disable RA if this is too small? */
if (ctx->readahead_kb > readahead_kb)
ctx->readahead_kb = readahead_kb;
#ifdef CONFIG_PFSCK
pthread_rwlock_init(&ctx->fs_fix_rwlock, NULL);
pthread_rwlock_init(&ctx->fs_block_map_rwlock, NULL);
- if (ctx->fs_num_threads > 1)
+ if (ctx->pfs_num_threads > 1)
ctx->fs_need_locking = 1;
#endif
if (ctx->global_ctx) {
if (ctx->options & E2F_OPT_DEBUG &&
ctx->options & E2F_OPT_MULTITHREAD)
- fprintf(stderr, "thread %d jumping to group %d\n",
+ fprintf(stderr, "thread %d jumping to group %u\n",
ctx->thread_info.et_thread_index,
ctx->thread_info.et_group_start);
pctx.errcode = ext2fs_inode_scan_goto_blockgroup(scan,
static int e2fsck_pass1_threads_join(struct e2fsck_thread_info *infos,
e2fsck_t global_ctx)
{
- errcode_t rc;
- errcode_t ret = 0;
- int i;
- struct e2fsck_thread_info *pinfo;
- int num_threads = global_ctx->fs_num_threads;
+ errcode_t rc;
+ errcode_t ret = 0;
+ struct e2fsck_thread_info *pinfo;
+ int num_threads = global_ctx->pfs_num_threads;
+ int i;
/* merge invalid bitmaps will recalculate it */
global_ctx->invalid_bitmaps = 0;
out:
if (thread_ctx->options & E2F_OPT_MULTITHREAD)
log_out(thread_ctx,
- _("Scanned group range [%lu, %lu), inodes %lu\n"),
+ _("Scanned group range [%u, %u), inodes %u\n"),
thread_ctx->thread_info.et_group_start,
thread_ctx->thread_info.et_group_end,
thread_ctx->thread_info.et_inode_number);
int i;
e2fsck_t thread_ctx;
dgrp_t average_group;
- int num_threads = global_ctx->fs_num_threads;
+ int num_threads = global_ctx->pfs_num_threads;
#ifdef DEBUG_THREADS
struct e2fsck_thread_debug thread_debug =
{PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, 0};
if (retval)
return;
#ifdef CONFIG_PFSCK
- if (ctx->fs_num_threads > 1 ||
- ctx->options & E2F_OPT_MULTITHREAD) {
+ if (ctx->pfs_num_threads > 1 || ctx->options & E2F_OPT_MULTITHREAD) {
need_single = 0;
e2fsck_pass1_multithread(ctx);
}