+#ifdef HAVE_PTHREAD
+ /* 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 */
+ pthread_rwlock_t fs_fix_rwlock;
+ /* protect block_found_map, block_dup_map */
+ pthread_rwlock_t fs_block_map_rwlock;
+ struct e2fsck_thread_info *infos;
+#endif
+};
+
+#ifdef HAVE_PTHREAD
+#ifdef DEBUG_THREADS
+/*
+ * Enabling DEBUG_THREADS would cause the parallel
+ * fsck threads run sequentially.
+ */
+struct e2fsck_thread_debug {
+ pthread_mutex_t etd_mutex;
+ pthread_cond_t etd_cond;
+ int etd_finished_threads;
+};
+#endif
+
+struct e2fsck_thread_info {
+ /* ID returned by pthread_create() */
+ pthread_t eti_thread_id;
+ /* Application-defined thread index */
+ int eti_thread_index;
+ /* Thread has been started */
+ int eti_started;
+ /* Context used for this thread */
+ e2fsck_t eti_thread_ctx;
+#ifdef DEBUG_THREADS
+ struct e2fsck_thread_debug *eti_debug;
+#endif