X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=fs%2Fjfs%2Fsuper.c;h=b71f6087e924dd85ae60f4abeca6e6a2339e6782;hb=987b0145d94eecf292d8b301228356f44611ab7c;hp=2d6c03d6dc7e20564a436b9180dc21ff452b6601;hpb=f7ed79d23a47594e7834d66a8f14449796d4f3e6;p=linux-2.6.git diff --git a/fs/jfs/super.c b/fs/jfs/super.c index 2d6c03d6d..b71f6087e 100644 --- a/fs/jfs/super.c +++ b/fs/jfs/super.c @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include @@ -55,9 +54,11 @@ static int commit_threads = 0; module_param(commit_threads, int, 0); MODULE_PARM_DESC(commit_threads, "Number of commit threads"); -static struct task_struct *jfsCommitThread[MAX_COMMIT_THREADS]; -struct task_struct *jfsIOthread; -struct task_struct *jfsSyncThread; +int jfs_stop_threads; +static pid_t jfsIOthread; +static pid_t jfsCommitThread[MAX_COMMIT_THREADS]; +static pid_t jfsSyncThread; +DECLARE_COMPLETION(jfsIOwait); #ifdef CONFIG_JFS_DEBUG int jfsloglevel = JFS_LOGLEVEL_WARN; @@ -194,8 +195,7 @@ static void jfs_put_super(struct super_block *sb) enum { Opt_integrity, Opt_nointegrity, Opt_iocharset, Opt_resize, Opt_resize_nosize, Opt_errors, Opt_ignore, Opt_err, Opt_quota, - Opt_usrquota, Opt_grpquota, Opt_uid, Opt_gid, Opt_umask, - Opt_tagxid + Opt_usrquota, Opt_grpquota, Opt_tagxid }; static match_table_t tokens = { @@ -210,9 +210,6 @@ static match_table_t tokens = { {Opt_ignore, "quota"}, {Opt_usrquota, "usrquota"}, {Opt_grpquota, "grpquota"}, - {Opt_uid, "uid=%u"}, - {Opt_gid, "gid=%u"}, - {Opt_umask, "umask=%u"}, {Opt_err, NULL} }; @@ -317,30 +314,7 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize, "JFS: quota operations not supported\n"); break; #endif - case Opt_uid: - { - char *uid = args[0].from; - sbi->uid = simple_strtoul(uid, &uid, 0); - break; - } - case Opt_gid: - { - char *gid = args[0].from; - sbi->gid = simple_strtoul(gid, &gid, 0); - break; - } - case Opt_umask: - { - char *umask = args[0].from; - sbi->umask = simple_strtoul(umask, &umask, 8); - if (sbi->umask & ~0777) { - printk(KERN_ERR - "JFS: Invalid value of umask\n"); - goto cleanup; - } - break; - } -#ifndef CONFIG_TAGGING_NONE +#ifndef CONFIG_INOXID_NONE case Opt_tagxid: *flag |= JFS_TAGXID; break; @@ -434,12 +408,12 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent) if (!new_valid_dev(sb->s_bdev->bd_dev)) return -EOVERFLOW; - sbi = kzalloc(sizeof (struct jfs_sb_info), GFP_KERNEL); + sbi = kmalloc(sizeof (struct jfs_sb_info), GFP_KERNEL); if (!sbi) return -ENOSPC; + memset(sbi, 0, sizeof (struct jfs_sb_info)); sb->s_fs_info = sbi; sbi->sb = sb; - sbi->uid = sbi->gid = sbi->umask = -1; /* initialize the mount flag and determine the default error handler */ flag = JFS_ERR_REMOUNT_RO; @@ -605,14 +579,10 @@ static int jfs_show_options(struct seq_file *seq, struct vfsmount *vfs) { struct jfs_sb_info *sbi = JFS_SBI(vfs->mnt_sb); - if (sbi->uid != -1) - seq_printf(seq, ",uid=%d", sbi->uid); - if (sbi->gid != -1) - seq_printf(seq, ",gid=%d", sbi->gid); - if (sbi->umask != -1) - seq_printf(seq, ",umask=%03o", sbi->umask); if (sbi->flag & JFS_NOINTEGRITY) seq_puts(seq, ",nointegrity"); + else + seq_puts(seq, ",integrity"); #if defined(CONFIG_QUOTA) if (sbi->flag & JFS_USRQUOTA) @@ -662,7 +632,7 @@ static void init_once(void *foo, kmem_cache_t * cachep, unsigned long flags) memset(jfs_ip, 0, sizeof(struct jfs_inode_info)); INIT_LIST_HEAD(&jfs_ip->anon_inode_list); init_rwsem(&jfs_ip->rdwrlock); - mutex_init(&jfs_ip->commit_mutex); + init_MUTEX(&jfs_ip->commit_sem); init_rwsem(&jfs_ip->xattr_sem); spin_lock_init(&jfs_ip->ag_lock); jfs_ip->active_ag = -1; @@ -681,8 +651,7 @@ static int __init init_jfs_fs(void) jfs_inode_cachep = kmem_cache_create("jfs_ip", sizeof(struct jfs_inode_info), 0, - SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD, - init_once, NULL); + SLAB_RECLAIM_ACCOUNT, init_once, NULL); if (jfs_inode_cachep == NULL) return -ENOMEM; @@ -707,12 +676,12 @@ static int __init init_jfs_fs(void) /* * I/O completion thread (endio) */ - jfsIOthread = kthread_run(jfsIOWait, NULL, "jfsIO"); - if (IS_ERR(jfsIOthread)) { - rc = PTR_ERR(jfsIOthread); - jfs_err("init_jfs_fs: fork failed w/rc = %d", rc); + jfsIOthread = kernel_thread(jfsIOWait, NULL, CLONE_KERNEL); + if (jfsIOthread < 0) { + jfs_err("init_jfs_fs: fork failed w/rc = %d", jfsIOthread); goto end_txmngr; } + wait_for_completion(&jfsIOwait); /* Wait until thread starts */ if (commit_threads < 1) commit_threads = num_online_cpus(); @@ -720,21 +689,24 @@ static int __init init_jfs_fs(void) commit_threads = MAX_COMMIT_THREADS; for (i = 0; i < commit_threads; i++) { - jfsCommitThread[i] = kthread_run(jfs_lazycommit, NULL, "jfsCommit"); - if (IS_ERR(jfsCommitThread[i])) { - rc = PTR_ERR(jfsCommitThread[i]); - jfs_err("init_jfs_fs: fork failed w/rc = %d", rc); + 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); } - jfsSyncThread = kthread_run(jfs_sync, NULL, "jfsSync"); - if (IS_ERR(jfsSyncThread)) { - rc = PTR_ERR(jfsSyncThread); - jfs_err("init_jfs_fs: fork failed w/rc = %d", rc); + jfsSyncThread = kernel_thread(jfs_sync, NULL, CLONE_KERNEL); + if (jfsSyncThread < 0) { + jfs_err("init_jfs_fs: fork failed w/rc = %d", jfsSyncThread); goto kill_committask; } + wait_for_completion(&jfsIOwait); /* Wait until thread starts */ #ifdef PROC_FS_JFS jfs_proc_init(); @@ -743,9 +715,13 @@ static int __init init_jfs_fs(void) return register_filesystem(&jfs_fs_type); kill_committask: + jfs_stop_threads = 1; + wake_up_all(&jfs_commit_thread_wait); for (i = 0; i < commit_threads; i++) - kthread_stop(jfsCommitThread[i]); - kthread_stop(jfsIOthread); + wait_for_completion(&jfsIOwait); + + wake_up(&jfs_IO_thread_wait); + wait_for_completion(&jfsIOwait); /* Wait for thread exit */ end_txmngr: txExit(); free_metapage: @@ -761,13 +737,16 @@ static void __exit exit_jfs_fs(void) jfs_info("exit_jfs_fs called"); + jfs_stop_threads = 1; txExit(); metapage_exit(); - - kthread_stop(jfsIOthread); + wake_up(&jfs_IO_thread_wait); + wait_for_completion(&jfsIOwait); /* Wait until IO thread exits */ + wake_up_all(&jfs_commit_thread_wait); for (i = 0; i < commit_threads; i++) - kthread_stop(jfsCommitThread[i]); - kthread_stop(jfsSyncThread); + wait_for_completion(&jfsIOwait); + wake_up(&jfs_sync_thread_wait); + wait_for_completion(&jfsIOwait); /* Wait until Sync thread exits */ #ifdef PROC_FS_JFS jfs_proc_clean(); #endif