vserver 1.9.3
[linux-2.6.git] / fs / jfs / super.c
1 /*
2  *   Copyright (C) International Business Machines Corp., 2000-2004
3  *   Portions Copyright (C) Christoph Hellwig, 2001-2002
4  *
5  *   This program is free software;  you can redistribute it and/or modify
6  *   it under the terms of the GNU General Public License as published by
7  *   the Free Software Foundation; either version 2 of the License, or 
8  *   (at your option) any later version.
9  * 
10  *   This program is distributed in the hope that it will be useful,
11  *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
12  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
13  *   the GNU General Public License for more details.
14  *
15  *   You should have received a copy of the GNU General Public License
16  *   along with this program;  if not, write to the Free Software 
17  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  */
19
20 #include <linux/fs.h>
21 #include <linux/config.h>
22 #include <linux/module.h>
23 #include <linux/parser.h>
24 #include <linux/completion.h>
25 #include <linux/vfs.h>
26 #include <linux/moduleparam.h>
27 #include <asm/uaccess.h>
28
29 #include "jfs_incore.h"
30 #include "jfs_filsys.h"
31 #include "jfs_metapage.h"
32 #include "jfs_superblock.h"
33 #include "jfs_dmap.h"
34 #include "jfs_imap.h"
35 #include "jfs_acl.h"
36 #include "jfs_debug.h"
37
38 MODULE_DESCRIPTION("The Journaled Filesystem (JFS)");
39 MODULE_AUTHOR("Steve Best/Dave Kleikamp/Barry Arndt, IBM");
40 MODULE_LICENSE("GPL");
41
42 static kmem_cache_t * jfs_inode_cachep;
43
44 static struct super_operations jfs_super_operations;
45 static struct export_operations jfs_export_operations;
46 static struct file_system_type jfs_fs_type;
47
48 #define MAX_COMMIT_THREADS 64
49 static int commit_threads = 0;
50 module_param(commit_threads, int, 0);
51 MODULE_PARM_DESC(commit_threads, "Number of commit threads");
52
53 int jfs_stop_threads;
54 static pid_t jfsIOthread;
55 static pid_t jfsCommitThread[MAX_COMMIT_THREADS];
56 static pid_t jfsSyncThread;
57 DECLARE_COMPLETION(jfsIOwait);
58
59 #ifdef CONFIG_JFS_DEBUG
60 int jfsloglevel = JFS_LOGLEVEL_WARN;
61 module_param(jfsloglevel, int, 0644);
62 MODULE_PARM_DESC(jfsloglevel, "Specify JFS loglevel (0, 1 or 2)");
63 #endif
64
65 /*
66  * External declarations
67  */
68 extern int jfs_mount(struct super_block *);
69 extern int jfs_mount_rw(struct super_block *, int);
70 extern int jfs_umount(struct super_block *);
71 extern int jfs_umount_rw(struct super_block *);
72
73 extern int jfsIOWait(void *);
74 extern int jfs_lazycommit(void *);
75 extern int jfs_sync(void *);
76
77 extern void jfs_read_inode(struct inode *inode);
78 extern void jfs_dirty_inode(struct inode *inode);
79 extern void jfs_delete_inode(struct inode *inode);
80 extern int jfs_write_inode(struct inode *inode, int wait);
81
82 extern struct dentry *jfs_get_parent(struct dentry *dentry);
83 extern int jfs_extendfs(struct super_block *, s64, int);
84
85 extern struct dentry_operations jfs_ci_dentry_operations;
86
87 #ifdef PROC_FS_JFS              /* see jfs_debug.h */
88 extern void jfs_proc_init(void);
89 extern void jfs_proc_clean(void);
90 #endif
91
92 extern wait_queue_head_t jfs_IO_thread_wait;
93 extern wait_queue_head_t jfs_commit_thread_wait;
94 extern wait_queue_head_t jfs_sync_thread_wait;
95
96 static void jfs_handle_error(struct super_block *sb)
97 {
98         struct jfs_sb_info *sbi = JFS_SBI(sb);
99
100         if (sb->s_flags & MS_RDONLY)
101                 return;
102
103         updateSuper(sb, FM_DIRTY);
104
105         if (sbi->flag & JFS_ERR_PANIC)
106                 panic("JFS (device %s): panic forced after error\n",
107                         sb->s_id);
108         else if (sbi->flag & JFS_ERR_REMOUNT_RO) {
109                 jfs_err("ERROR: (device %s): remounting filesystem "
110                         "as read-only\n",
111                         sb->s_id);
112                 sb->s_flags |= MS_RDONLY;
113         } 
114
115         /* nothing is done for continue beyond marking the superblock dirty */
116 }
117
118 void jfs_error(struct super_block *sb, const char * function, ...)
119 {
120         static char error_buf[256];
121         va_list args;
122
123         va_start(args, function);
124         vsprintf(error_buf, function, args);
125         va_end(args);
126
127         printk(KERN_ERR "ERROR: (device %s): %s\n", sb->s_id, error_buf);
128
129         jfs_handle_error(sb);
130 }
131
132 static struct inode *jfs_alloc_inode(struct super_block *sb)
133 {
134         struct jfs_inode_info *jfs_inode;
135
136         jfs_inode = kmem_cache_alloc(jfs_inode_cachep, GFP_NOFS);
137         if (!jfs_inode)
138                 return NULL;
139         return &jfs_inode->vfs_inode;
140 }
141
142 static void jfs_destroy_inode(struct inode *inode)
143 {
144         struct jfs_inode_info *ji = JFS_IP(inode);
145
146         spin_lock_irq(&ji->ag_lock);
147         if (ji->active_ag != -1) {
148                 struct bmap *bmap = JFS_SBI(inode->i_sb)->bmap;
149                 atomic_dec(&bmap->db_active[ji->active_ag]);
150                 ji->active_ag = -1;
151         }
152         spin_unlock_irq(&ji->ag_lock);
153
154 #ifdef CONFIG_JFS_POSIX_ACL
155         if (ji->i_acl != JFS_ACL_NOT_CACHED) {
156                 posix_acl_release(ji->i_acl);
157                 ji->i_acl = JFS_ACL_NOT_CACHED;
158         }
159         if (ji->i_default_acl != JFS_ACL_NOT_CACHED) {
160                 posix_acl_release(ji->i_default_acl);
161                 ji->i_default_acl = JFS_ACL_NOT_CACHED;
162         }
163 #endif
164
165         kmem_cache_free(jfs_inode_cachep, ji);
166 }
167
168 static int jfs_statfs(struct super_block *sb, struct kstatfs *buf)
169 {
170         struct jfs_sb_info *sbi = JFS_SBI(sb);
171         s64 maxinodes;
172         struct inomap *imap = JFS_IP(sbi->ipimap)->i_imap;
173
174         jfs_info("In jfs_statfs");
175         buf->f_type = JFS_SUPER_MAGIC;
176         buf->f_bsize = sbi->bsize;
177         buf->f_blocks = sbi->bmap->db_mapsize;
178         buf->f_bfree = sbi->bmap->db_nfree;
179         buf->f_bavail = sbi->bmap->db_nfree;
180         /*
181          * If we really return the number of allocated & free inodes, some
182          * applications will fail because they won't see enough free inodes.
183          * We'll try to calculate some guess as to how may inodes we can
184          * really allocate
185          *
186          * buf->f_files = atomic_read(&imap->im_numinos);
187          * buf->f_ffree = atomic_read(&imap->im_numfree);
188          */
189         maxinodes = min((s64) atomic_read(&imap->im_numinos) +
190                         ((sbi->bmap->db_nfree >> imap->im_l2nbperiext)
191                          << L2INOSPEREXT), (s64) 0xffffffffLL);
192         buf->f_files = maxinodes;
193         buf->f_ffree = maxinodes - (atomic_read(&imap->im_numinos) -
194                                     atomic_read(&imap->im_numfree));
195
196         buf->f_namelen = JFS_NAME_MAX;
197         return 0;
198 }
199
200 static void jfs_put_super(struct super_block *sb)
201 {
202         struct jfs_sb_info *sbi = JFS_SBI(sb);
203         int rc;
204
205         jfs_info("In jfs_put_super");
206         rc = jfs_umount(sb);
207         if (rc)
208                 jfs_err("jfs_umount failed with return code %d", rc);
209         if (sbi->nls_tab)
210                 unload_nls(sbi->nls_tab);
211         sbi->nls_tab = NULL;
212
213         kfree(sbi);
214 }
215
216 enum {
217         Opt_integrity, Opt_nointegrity, Opt_iocharset, Opt_resize,
218         Opt_resize_nosize, Opt_errors, Opt_ignore, Opt_err,
219 };
220
221 static match_table_t tokens = {
222         {Opt_integrity, "integrity"},
223         {Opt_nointegrity, "nointegrity"},
224         {Opt_iocharset, "iocharset=%s"},
225         {Opt_resize, "resize=%u"},
226         {Opt_resize_nosize, "resize"},
227         {Opt_errors, "errors=%s"},
228         {Opt_ignore, "noquota"},
229         {Opt_ignore, "quota"},
230         {Opt_ignore, "usrquota"},
231         {Opt_ignore, "grpquota"},
232         {Opt_err, NULL}
233 };
234
235 static int parse_options(char *options, struct super_block *sb, s64 *newLVSize,
236                          int *flag)
237 {
238         void *nls_map = NULL;
239         char *p;
240         struct jfs_sb_info *sbi = JFS_SBI(sb);
241
242         *newLVSize = 0;
243
244         if (!options)
245                 return 1;
246
247         while ((p = strsep(&options, ",")) != NULL) {
248                 substring_t args[MAX_OPT_ARGS];
249                 int token;
250                 if (!*p)
251                         continue;
252
253                 token = match_token(p, tokens, args);
254                 switch (token) {
255                 case Opt_integrity:
256                         *flag &= ~JFS_NOINTEGRITY;
257                         break;
258                 case Opt_nointegrity:
259                         *flag |= JFS_NOINTEGRITY;
260                         break;
261                 case Opt_ignore:
262                         /* Silently ignore the quota options */
263                         /* Don't do anything ;-) */
264                         break;
265                 case Opt_iocharset:
266                         if (nls_map)    /* specified iocharset twice! */
267                                 unload_nls(nls_map);
268                         nls_map = load_nls(args[0].from);
269                         if (!nls_map) {
270                                 printk(KERN_ERR "JFS: charset not found\n");
271                                 goto cleanup;
272                         }
273                         break;
274                 case Opt_resize:
275                 {
276                         char *resize = args[0].from;
277                         *newLVSize = simple_strtoull(resize, &resize, 0);
278                         break;
279                 }
280                 case Opt_resize_nosize:
281                 {
282                         *newLVSize = sb->s_bdev->bd_inode->i_size >>
283                                 sb->s_blocksize_bits;
284                         if (*newLVSize == 0)
285                                 printk(KERN_ERR
286                                        "JFS: Cannot determine volume size\n");
287                         break;
288                 }
289                 case Opt_errors:
290                 {
291                         char *errors = args[0].from;
292                         if (!errors || !*errors)
293                                 goto cleanup;
294                         if (!strcmp(errors, "continue")) {
295                                 *flag &= ~JFS_ERR_REMOUNT_RO;
296                                 *flag &= ~JFS_ERR_PANIC;
297                                 *flag |= JFS_ERR_CONTINUE;
298                         } else if (!strcmp(errors, "remount-ro")) {
299                                 *flag &= ~JFS_ERR_CONTINUE;
300                                 *flag &= ~JFS_ERR_PANIC;
301                                 *flag |= JFS_ERR_REMOUNT_RO;
302                         } else if (!strcmp(errors, "panic")) {
303                                 *flag &= ~JFS_ERR_CONTINUE;
304                                 *flag &= ~JFS_ERR_REMOUNT_RO;
305                                 *flag |= JFS_ERR_PANIC;
306                         } else {
307                                 printk(KERN_ERR
308                                        "JFS: %s is an invalid error handler\n",
309                                        errors);
310                                 goto cleanup;
311                         }
312                         break;
313                 }
314                 default:
315                         printk("jfs: Unrecognized mount option \"%s\" "
316                                         " or missing value\n", p);
317                         goto cleanup;
318                 }
319         }
320
321         if (nls_map) {
322                 /* Discard old (if remount) */
323                 if (sbi->nls_tab)
324                         unload_nls(sbi->nls_tab);
325                 sbi->nls_tab = nls_map;
326         }
327         return 1;
328
329 cleanup:
330         if (nls_map)
331                 unload_nls(nls_map);
332         return 0;
333 }
334
335 static int jfs_remount(struct super_block *sb, int *flags, char *data)
336 {
337         s64 newLVSize = 0;
338         int rc = 0;
339         int flag = JFS_SBI(sb)->flag;
340
341         if (!parse_options(data, sb, &newLVSize, &flag)) {
342                 return -EINVAL;
343         }
344         if (newLVSize) {
345                 if (sb->s_flags & MS_RDONLY) {
346                         printk(KERN_ERR
347                   "JFS: resize requires volume to be mounted read-write\n");
348                         return -EROFS;
349                 }
350                 rc = jfs_extendfs(sb, newLVSize, 0);
351                 if (rc)
352                         return rc;
353         }
354
355         if ((sb->s_flags & MS_RDONLY) && !(*flags & MS_RDONLY)) {
356                 JFS_SBI(sb)->flag = flag;
357                 return jfs_mount_rw(sb, 1);
358         }
359         if ((!(sb->s_flags & MS_RDONLY)) && (*flags & MS_RDONLY)) {
360                 rc = jfs_umount_rw(sb);
361                 JFS_SBI(sb)->flag = flag;
362                 return rc;
363         }
364         if ((JFS_SBI(sb)->flag & JFS_NOINTEGRITY) != (flag & JFS_NOINTEGRITY))
365                 if (!(sb->s_flags & MS_RDONLY)) {
366                         rc = jfs_umount_rw(sb);
367                         if (rc)
368                                 return rc;
369                         JFS_SBI(sb)->flag = flag;
370                         return jfs_mount_rw(sb, 1);
371                 }
372         JFS_SBI(sb)->flag = flag;
373
374         return 0;
375 }
376
377 static int jfs_fill_super(struct super_block *sb, void *data, int silent)
378 {
379         struct jfs_sb_info *sbi;
380         struct inode *inode;
381         int rc;
382         s64 newLVSize = 0;
383         int flag;
384
385         jfs_info("In jfs_read_super: s_flags=0x%lx", sb->s_flags);
386
387         if (!new_valid_dev(sb->s_bdev->bd_dev))
388                 return -EOVERFLOW;
389
390         sbi = kmalloc(sizeof (struct jfs_sb_info), GFP_KERNEL);
391         if (!sbi)
392                 return -ENOSPC;
393         memset(sbi, 0, sizeof (struct jfs_sb_info));
394         sb->s_fs_info = sbi;
395         sbi->sb = sb;
396
397         /* initialize the mount flag and determine the default error handler */
398         flag = JFS_ERR_REMOUNT_RO;
399
400         if (!parse_options((char *) data, sb, &newLVSize, &flag)) {
401                 kfree(sbi);
402                 return -EINVAL;
403         }
404         sbi->flag = flag;
405
406         if (newLVSize) {
407                 printk(KERN_ERR "resize option for remount only\n");
408                 return -EINVAL;
409         }
410
411         /*
412          * Initialize blocksize to 4K.
413          */
414         sb_set_blocksize(sb, PSIZE);
415
416         /*
417          * Set method vectors.
418          */
419         sb->s_op = &jfs_super_operations;
420         sb->s_export_op = &jfs_export_operations;
421
422         rc = jfs_mount(sb);
423         if (rc) {
424                 if (!silent) {
425                         jfs_err("jfs_mount failed w/return code = %d", rc);
426                 }
427                 goto out_kfree;
428         }
429         if (sb->s_flags & MS_RDONLY)
430                 sbi->log = NULL;
431         else {
432                 rc = jfs_mount_rw(sb, 0);
433                 if (rc) {
434                         if (!silent) {
435                                 jfs_err("jfs_mount_rw failed, return code = %d",
436                                         rc);
437                         }
438                         goto out_no_rw;
439                 }
440         }
441
442         sb->s_magic = JFS_SUPER_MAGIC;
443
444         inode = iget(sb, ROOT_I);
445         if (!inode || is_bad_inode(inode))
446                 goto out_no_root;
447         sb->s_root = d_alloc_root(inode);
448         if (!sb->s_root)
449                 goto out_no_root;
450
451         if (sbi->mntflag & JFS_OS2)
452                 sb->s_root->d_op = &jfs_ci_dentry_operations;
453
454         /* logical blocks are represented by 40 bits in pxd_t, etc. */
455         sb->s_maxbytes = ((u64) sb->s_blocksize) << 40;
456 #if BITS_PER_LONG == 32
457         /*
458          * Page cache is indexed by long.
459          * I would use MAX_LFS_FILESIZE, but it's only half as big
460          */
461         sb->s_maxbytes = min(((u64) PAGE_CACHE_SIZE << 32) - 1, sb->s_maxbytes);
462 #endif
463
464         return 0;
465
466 out_no_root:
467         jfs_err("jfs_read_super: get root inode failed");
468         if (inode)
469                 iput(inode);
470
471 out_no_rw:
472         rc = jfs_umount(sb);
473         if (rc) {
474                 jfs_err("jfs_umount failed with return code %d", rc);
475         }
476 out_kfree:
477         if (sbi->nls_tab)
478                 unload_nls(sbi->nls_tab);
479         kfree(sbi);
480         return -EINVAL;
481 }
482
483 static void jfs_write_super_lockfs(struct super_block *sb)
484 {
485         struct jfs_sb_info *sbi = JFS_SBI(sb);
486         struct jfs_log *log = sbi->log;
487
488         if (!(sb->s_flags & MS_RDONLY)) {
489                 txQuiesce(sb);
490                 lmLogShutdown(log);
491                 updateSuper(sb, FM_CLEAN);
492         }
493 }
494
495 static void jfs_unlockfs(struct super_block *sb)
496 {
497         struct jfs_sb_info *sbi = JFS_SBI(sb);
498         struct jfs_log *log = sbi->log;
499         int rc = 0;
500
501         if (!(sb->s_flags & MS_RDONLY)) {
502                 updateSuper(sb, FM_MOUNT);
503                 if ((rc = lmLogInit(log)))
504                         jfs_err("jfs_unlock failed with return code %d", rc);
505                 else
506                         txResume(sb);
507         }
508 }
509
510 static struct super_block *jfs_get_sb(struct file_system_type *fs_type, 
511         int flags, const char *dev_name, void *data)
512 {
513         return get_sb_bdev(fs_type, flags, dev_name, data, jfs_fill_super);
514 }
515
516 static int jfs_sync_fs(struct super_block *sb, int wait)
517 {
518         struct jfs_log *log = JFS_SBI(sb)->log;
519
520         /* log == NULL indicates read-only mount */
521         if (log)
522                 jfs_flush_journal(log, wait);
523
524         return 0;
525 }
526
527 static struct super_operations jfs_super_operations = {
528         .alloc_inode    = jfs_alloc_inode,
529         .destroy_inode  = jfs_destroy_inode,
530         .read_inode     = jfs_read_inode,
531         .dirty_inode    = jfs_dirty_inode,
532         .write_inode    = jfs_write_inode,
533         .delete_inode   = jfs_delete_inode,
534         .put_super      = jfs_put_super,
535         .sync_fs        = jfs_sync_fs,
536         .write_super_lockfs = jfs_write_super_lockfs,
537         .unlockfs       = jfs_unlockfs,
538         .statfs         = jfs_statfs,
539         .remount_fs     = jfs_remount,
540 };
541
542 static struct export_operations jfs_export_operations = {
543         .get_parent     = jfs_get_parent,
544 };
545
546 static struct file_system_type jfs_fs_type = {
547         .owner          = THIS_MODULE,
548         .name           = "jfs",
549         .get_sb         = jfs_get_sb,
550         .kill_sb        = kill_block_super,
551         .fs_flags       = FS_REQUIRES_DEV,
552 };
553
554 extern int metapage_init(void);
555 extern int txInit(void);
556 extern void txExit(void);
557 extern void metapage_exit(void);
558
559 static void init_once(void *foo, kmem_cache_t * cachep, unsigned long flags)
560 {
561         struct jfs_inode_info *jfs_ip = (struct jfs_inode_info *) foo;
562
563         if ((flags & (SLAB_CTOR_VERIFY | SLAB_CTOR_CONSTRUCTOR)) ==
564             SLAB_CTOR_CONSTRUCTOR) {
565                 memset(jfs_ip, 0, sizeof(struct jfs_inode_info));
566                 INIT_LIST_HEAD(&jfs_ip->anon_inode_list);
567                 init_rwsem(&jfs_ip->rdwrlock);
568                 init_MUTEX(&jfs_ip->commit_sem);
569                 init_rwsem(&jfs_ip->xattr_sem);
570                 spin_lock_init(&jfs_ip->ag_lock);
571                 jfs_ip->active_ag = -1;
572 #ifdef CONFIG_JFS_POSIX_ACL
573                 jfs_ip->i_acl = JFS_ACL_NOT_CACHED;
574                 jfs_ip->i_default_acl = JFS_ACL_NOT_CACHED;
575 #endif
576                 inode_init_once(&jfs_ip->vfs_inode);
577         }
578 }
579
580 static int __init init_jfs_fs(void)
581 {
582         int i;
583         int rc;
584
585         jfs_inode_cachep =
586             kmem_cache_create("jfs_ip", sizeof(struct jfs_inode_info), 0, 
587                             SLAB_RECLAIM_ACCOUNT, init_once, NULL);
588         if (jfs_inode_cachep == NULL)
589                 return -ENOMEM;
590
591         /*
592          * Metapage initialization
593          */
594         rc = metapage_init();
595         if (rc) {
596                 jfs_err("metapage_init failed w/rc = %d", rc);
597                 goto free_slab;
598         }
599
600         /*
601          * Transaction Manager initialization
602          */
603         rc = txInit();
604         if (rc) {
605                 jfs_err("txInit failed w/rc = %d", rc);
606                 goto free_metapage;
607         }
608
609         /*
610          * I/O completion thread (endio)
611          */
612         jfsIOthread = kernel_thread(jfsIOWait, NULL, CLONE_KERNEL);
613         if (jfsIOthread < 0) {
614                 jfs_err("init_jfs_fs: fork failed w/rc = %d", jfsIOthread);
615                 goto end_txmngr;
616         }
617         wait_for_completion(&jfsIOwait);        /* Wait until thread starts */
618
619         if (commit_threads < 1)
620                 commit_threads = num_online_cpus();
621         else if (commit_threads > MAX_COMMIT_THREADS)
622                 commit_threads = MAX_COMMIT_THREADS;
623
624         for (i = 0; i < commit_threads; i++) {
625                 jfsCommitThread[i] = kernel_thread(jfs_lazycommit, NULL,
626                                                    CLONE_KERNEL);
627                 if (jfsCommitThread[i] < 0) {
628                         jfs_err("init_jfs_fs: fork failed w/rc = %d",
629                                 jfsCommitThread[i]);
630                         commit_threads = i;
631                         goto kill_committask;
632                 }
633                 /* Wait until thread starts */
634                 wait_for_completion(&jfsIOwait);
635         }
636
637         jfsSyncThread = kernel_thread(jfs_sync, NULL, CLONE_KERNEL);
638         if (jfsSyncThread < 0) {
639                 jfs_err("init_jfs_fs: fork failed w/rc = %d", jfsSyncThread);
640                 goto kill_committask;
641         }
642         wait_for_completion(&jfsIOwait);        /* Wait until thread starts */
643
644 #ifdef PROC_FS_JFS
645         jfs_proc_init();
646 #endif
647
648         return register_filesystem(&jfs_fs_type);
649
650 kill_committask:
651         jfs_stop_threads = 1;
652         wake_up_all(&jfs_commit_thread_wait);
653         for (i = 0; i < commit_threads; i++)
654                 wait_for_completion(&jfsIOwait);
655
656         wake_up(&jfs_IO_thread_wait);
657         wait_for_completion(&jfsIOwait);        /* Wait for thread exit */
658 end_txmngr:
659         txExit();
660 free_metapage:
661         metapage_exit();
662 free_slab:
663         kmem_cache_destroy(jfs_inode_cachep);
664         return rc;
665 }
666
667 static void __exit exit_jfs_fs(void)
668 {
669         int i;
670
671         jfs_info("exit_jfs_fs called");
672
673         jfs_stop_threads = 1;
674         txExit();
675         metapage_exit();
676         wake_up(&jfs_IO_thread_wait);
677         wait_for_completion(&jfsIOwait);        /* Wait until IO thread exits */
678         wake_up_all(&jfs_commit_thread_wait);
679         for (i = 0; i < commit_threads; i++)
680                 wait_for_completion(&jfsIOwait);
681         wake_up(&jfs_sync_thread_wait);
682         wait_for_completion(&jfsIOwait);        /* Wait until Sync thread exits */
683 #ifdef PROC_FS_JFS
684         jfs_proc_clean();
685 #endif
686         unregister_filesystem(&jfs_fs_type);
687         kmem_cache_destroy(jfs_inode_cachep);
688 }
689
690 module_init(init_jfs_fs)
691 module_exit(exit_jfs_fs)