- jfsCommitThread = kernel_thread(jfs_lazycommit, 0, CLONE_KERNEL);
- if (jfsCommitThread < 0) {
- jfs_err("init_jfs_fs: fork failed w/rc = %d", jfsCommitThread);
- goto kill_iotask;
+ if (commit_threads < 1)
+ commit_threads = num_online_cpus();
+ else if (commit_threads > MAX_COMMIT_THREADS)
+ commit_threads = MAX_COMMIT_THREADS;
+
+ for (i = 0; i < commit_threads; i++) {
+ jfsCommitThread[i] = kernel_thread(jfs_lazycommit, NULL,
+ CLONE_KERNEL);
+ if (jfsCommitThread[i] < 0) {
+ jfs_err("init_jfs_fs: fork failed w/rc = %d",
+ jfsCommitThread[i]);
+ commit_threads = i;
+ goto kill_committask;
+ }
+ /* Wait until thread starts */
+ wait_for_completion(&jfsIOwait);