aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jfs/super.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /fs/jfs/super.c
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'fs/jfs/super.c')
-rw-r--r--fs/jfs/super.c700
1 files changed, 700 insertions, 0 deletions
diff --git a/fs/jfs/super.c b/fs/jfs/super.c
new file mode 100644
index 000000000000..5856866e24fc
--- /dev/null
+++ b/fs/jfs/super.c
@@ -0,0 +1,700 @@
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
38MODULE_DESCRIPTION("The Journaled Filesystem (JFS)");
39MODULE_AUTHOR("Steve Best/Dave Kleikamp/Barry Arndt, IBM");
40MODULE_LICENSE("GPL");
41
42static kmem_cache_t * jfs_inode_cachep;
43
44static struct super_operations jfs_super_operations;
45static struct export_operations jfs_export_operations;
46static struct file_system_type jfs_fs_type;
47
48#define MAX_COMMIT_THREADS 64
49static int commit_threads = 0;
50module_param(commit_threads, int, 0);
51MODULE_PARM_DESC(commit_threads, "Number of commit threads");
52
53int jfs_stop_threads;
54static pid_t jfsIOthread;
55static pid_t jfsCommitThread[MAX_COMMIT_THREADS];
56static pid_t jfsSyncThread;
57DECLARE_COMPLETION(jfsIOwait);
58
59#ifdef CONFIG_JFS_DEBUG
60int jfsloglevel = JFS_LOGLEVEL_WARN;
61module_param(jfsloglevel, int, 0644);
62MODULE_PARM_DESC(jfsloglevel, "Specify JFS loglevel (0, 1 or 2)");
63#endif
64
65/*
66 * External declarations
67 */
68extern int jfs_mount(struct super_block *);
69extern int jfs_mount_rw(struct super_block *, int);
70extern int jfs_umount(struct super_block *);
71extern int jfs_umount_rw(struct super_block *);
72
73extern int jfsIOWait(void *);
74extern int jfs_lazycommit(void *);
75extern int jfs_sync(void *);
76
77extern void jfs_read_inode(struct inode *inode);
78extern void jfs_dirty_inode(struct inode *inode);
79extern void jfs_delete_inode(struct inode *inode);
80extern int jfs_write_inode(struct inode *inode, int wait);
81
82extern struct dentry *jfs_get_parent(struct dentry *dentry);
83extern int jfs_extendfs(struct super_block *, s64, int);
84
85extern struct dentry_operations jfs_ci_dentry_operations;
86
87#ifdef PROC_FS_JFS /* see jfs_debug.h */
88extern void jfs_proc_init(void);
89extern void jfs_proc_clean(void);
90#endif
91
92extern wait_queue_head_t jfs_IO_thread_wait;
93extern wait_queue_head_t jfs_commit_thread_wait;
94extern wait_queue_head_t jfs_sync_thread_wait;
95
96static 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
118void 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
132static 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
142static 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
168static 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
200static 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
216enum {
217 Opt_integrity, Opt_nointegrity, Opt_iocharset, Opt_resize,
218 Opt_resize_nosize, Opt_errors, Opt_ignore, Opt_err,
219};
220
221static 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
235static int parse_options(char *options, struct super_block *sb, s64 *newLVSize,
236 int *flag)
237{
238 void *nls_map = (void *)-1; /* -1: no change; NULL: none */
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 && nls_map != (void *) -1)
267 unload_nls(nls_map);
268 if (!strcmp(args[0].from, "none"))
269 nls_map = NULL;
270 else {
271 nls_map = load_nls(args[0].from);
272 if (!nls_map) {
273 printk(KERN_ERR
274 "JFS: charset not found\n");
275 goto cleanup;
276 }
277 }
278 break;
279 case Opt_resize:
280 {
281 char *resize = args[0].from;
282 *newLVSize = simple_strtoull(resize, &resize, 0);
283 break;
284 }
285 case Opt_resize_nosize:
286 {
287 *newLVSize = sb->s_bdev->bd_inode->i_size >>
288 sb->s_blocksize_bits;
289 if (*newLVSize == 0)
290 printk(KERN_ERR
291 "JFS: Cannot determine volume size\n");
292 break;
293 }
294 case Opt_errors:
295 {
296 char *errors = args[0].from;
297 if (!errors || !*errors)
298 goto cleanup;
299 if (!strcmp(errors, "continue")) {
300 *flag &= ~JFS_ERR_REMOUNT_RO;
301 *flag &= ~JFS_ERR_PANIC;
302 *flag |= JFS_ERR_CONTINUE;
303 } else if (!strcmp(errors, "remount-ro")) {
304 *flag &= ~JFS_ERR_CONTINUE;
305 *flag &= ~JFS_ERR_PANIC;
306 *flag |= JFS_ERR_REMOUNT_RO;
307 } else if (!strcmp(errors, "panic")) {
308 *flag &= ~JFS_ERR_CONTINUE;
309 *flag &= ~JFS_ERR_REMOUNT_RO;
310 *flag |= JFS_ERR_PANIC;
311 } else {
312 printk(KERN_ERR
313 "JFS: %s is an invalid error handler\n",
314 errors);
315 goto cleanup;
316 }
317 break;
318 }
319 default:
320 printk("jfs: Unrecognized mount option \"%s\" "
321 " or missing value\n", p);
322 goto cleanup;
323 }
324 }
325
326 if (nls_map != (void *) -1) {
327 /* Discard old (if remount) */
328 if (sbi->nls_tab)
329 unload_nls(sbi->nls_tab);
330 sbi->nls_tab = nls_map;
331 }
332 return 1;
333
334cleanup:
335 if (nls_map && nls_map != (void *) -1)
336 unload_nls(nls_map);
337 return 0;
338}
339
340static int jfs_remount(struct super_block *sb, int *flags, char *data)
341{
342 s64 newLVSize = 0;
343 int rc = 0;
344 int flag = JFS_SBI(sb)->flag;
345
346 if (!parse_options(data, sb, &newLVSize, &flag)) {
347 return -EINVAL;
348 }
349 if (newLVSize) {
350 if (sb->s_flags & MS_RDONLY) {
351 printk(KERN_ERR
352 "JFS: resize requires volume to be mounted read-write\n");
353 return -EROFS;
354 }
355 rc = jfs_extendfs(sb, newLVSize, 0);
356 if (rc)
357 return rc;
358 }
359
360 if ((sb->s_flags & MS_RDONLY) && !(*flags & MS_RDONLY)) {
361 JFS_SBI(sb)->flag = flag;
362 return jfs_mount_rw(sb, 1);
363 }
364 if ((!(sb->s_flags & MS_RDONLY)) && (*flags & MS_RDONLY)) {
365 rc = jfs_umount_rw(sb);
366 JFS_SBI(sb)->flag = flag;
367 return rc;
368 }
369 if ((JFS_SBI(sb)->flag & JFS_NOINTEGRITY) != (flag & JFS_NOINTEGRITY))
370 if (!(sb->s_flags & MS_RDONLY)) {
371 rc = jfs_umount_rw(sb);
372 if (rc)
373 return rc;
374 JFS_SBI(sb)->flag = flag;
375 return jfs_mount_rw(sb, 1);
376 }
377 JFS_SBI(sb)->flag = flag;
378
379 return 0;
380}
381
382static int jfs_fill_super(struct super_block *sb, void *data, int silent)
383{
384 struct jfs_sb_info *sbi;
385 struct inode *inode;
386 int rc;
387 s64 newLVSize = 0;
388 int flag;
389
390 jfs_info("In jfs_read_super: s_flags=0x%lx", sb->s_flags);
391
392 if (!new_valid_dev(sb->s_bdev->bd_dev))
393 return -EOVERFLOW;
394
395 sbi = kmalloc(sizeof (struct jfs_sb_info), GFP_KERNEL);
396 if (!sbi)
397 return -ENOSPC;
398 memset(sbi, 0, sizeof (struct jfs_sb_info));
399 sb->s_fs_info = sbi;
400 sbi->sb = sb;
401
402 /* initialize the mount flag and determine the default error handler */
403 flag = JFS_ERR_REMOUNT_RO;
404
405 if (!parse_options((char *) data, sb, &newLVSize, &flag)) {
406 kfree(sbi);
407 return -EINVAL;
408 }
409 sbi->flag = flag;
410
411#ifdef CONFIG_JFS_POSIX_ACL
412 sb->s_flags |= MS_POSIXACL;
413#endif
414
415 if (newLVSize) {
416 printk(KERN_ERR "resize option for remount only\n");
417 return -EINVAL;
418 }
419
420 /*
421 * Initialize blocksize to 4K.
422 */
423 sb_set_blocksize(sb, PSIZE);
424
425 /*
426 * Set method vectors.
427 */
428 sb->s_op = &jfs_super_operations;
429 sb->s_export_op = &jfs_export_operations;
430
431 rc = jfs_mount(sb);
432 if (rc) {
433 if (!silent) {
434 jfs_err("jfs_mount failed w/return code = %d", rc);
435 }
436 goto out_kfree;
437 }
438 if (sb->s_flags & MS_RDONLY)
439 sbi->log = NULL;
440 else {
441 rc = jfs_mount_rw(sb, 0);
442 if (rc) {
443 if (!silent) {
444 jfs_err("jfs_mount_rw failed, return code = %d",
445 rc);
446 }
447 goto out_no_rw;
448 }
449 }
450
451 sb->s_magic = JFS_SUPER_MAGIC;
452
453 inode = iget(sb, ROOT_I);
454 if (!inode || is_bad_inode(inode))
455 goto out_no_root;
456 sb->s_root = d_alloc_root(inode);
457 if (!sb->s_root)
458 goto out_no_root;
459
460 if (sbi->mntflag & JFS_OS2)
461 sb->s_root->d_op = &jfs_ci_dentry_operations;
462
463 /* logical blocks are represented by 40 bits in pxd_t, etc. */
464 sb->s_maxbytes = ((u64) sb->s_blocksize) << 40;
465#if BITS_PER_LONG == 32
466 /*
467 * Page cache is indexed by long.
468 * I would use MAX_LFS_FILESIZE, but it's only half as big
469 */
470 sb->s_maxbytes = min(((u64) PAGE_CACHE_SIZE << 32) - 1, sb->s_maxbytes);
471#endif
472 sb->s_time_gran = 1;
473 return 0;
474
475out_no_root:
476 jfs_err("jfs_read_super: get root inode failed");
477 if (inode)
478 iput(inode);
479
480out_no_rw:
481 rc = jfs_umount(sb);
482 if (rc) {
483 jfs_err("jfs_umount failed with return code %d", rc);
484 }
485out_kfree:
486 if (sbi->nls_tab)
487 unload_nls(sbi->nls_tab);
488 kfree(sbi);
489 return -EINVAL;
490}
491
492static void jfs_write_super_lockfs(struct super_block *sb)
493{
494 struct jfs_sb_info *sbi = JFS_SBI(sb);
495 struct jfs_log *log = sbi->log;
496
497 if (!(sb->s_flags & MS_RDONLY)) {
498 txQuiesce(sb);
499 lmLogShutdown(log);
500 updateSuper(sb, FM_CLEAN);
501 }
502}
503
504static void jfs_unlockfs(struct super_block *sb)
505{
506 struct jfs_sb_info *sbi = JFS_SBI(sb);
507 struct jfs_log *log = sbi->log;
508 int rc = 0;
509
510 if (!(sb->s_flags & MS_RDONLY)) {
511 updateSuper(sb, FM_MOUNT);
512 if ((rc = lmLogInit(log)))
513 jfs_err("jfs_unlock failed with return code %d", rc);
514 else
515 txResume(sb);
516 }
517}
518
519static struct super_block *jfs_get_sb(struct file_system_type *fs_type,
520 int flags, const char *dev_name, void *data)
521{
522 return get_sb_bdev(fs_type, flags, dev_name, data, jfs_fill_super);
523}
524
525static int jfs_sync_fs(struct super_block *sb, int wait)
526{
527 struct jfs_log *log = JFS_SBI(sb)->log;
528
529 /* log == NULL indicates read-only mount */
530 if (log)
531 jfs_flush_journal(log, wait);
532
533 return 0;
534}
535
536static struct super_operations jfs_super_operations = {
537 .alloc_inode = jfs_alloc_inode,
538 .destroy_inode = jfs_destroy_inode,
539 .read_inode = jfs_read_inode,
540 .dirty_inode = jfs_dirty_inode,
541 .write_inode = jfs_write_inode,
542 .delete_inode = jfs_delete_inode,
543 .put_super = jfs_put_super,
544 .sync_fs = jfs_sync_fs,
545 .write_super_lockfs = jfs_write_super_lockfs,
546 .unlockfs = jfs_unlockfs,
547 .statfs = jfs_statfs,
548 .remount_fs = jfs_remount,
549};
550
551static struct export_operations jfs_export_operations = {
552 .get_parent = jfs_get_parent,
553};
554
555static struct file_system_type jfs_fs_type = {
556 .owner = THIS_MODULE,
557 .name = "jfs",
558 .get_sb = jfs_get_sb,
559 .kill_sb = kill_block_super,
560 .fs_flags = FS_REQUIRES_DEV,
561};
562
563extern int metapage_init(void);
564extern int txInit(void);
565extern void txExit(void);
566extern void metapage_exit(void);
567
568static void init_once(void *foo, kmem_cache_t * cachep, unsigned long flags)
569{
570 struct jfs_inode_info *jfs_ip = (struct jfs_inode_info *) foo;
571
572 if ((flags & (SLAB_CTOR_VERIFY | SLAB_CTOR_CONSTRUCTOR)) ==
573 SLAB_CTOR_CONSTRUCTOR) {
574 memset(jfs_ip, 0, sizeof(struct jfs_inode_info));
575 INIT_LIST_HEAD(&jfs_ip->anon_inode_list);
576 init_rwsem(&jfs_ip->rdwrlock);
577 init_MUTEX(&jfs_ip->commit_sem);
578 init_rwsem(&jfs_ip->xattr_sem);
579 spin_lock_init(&jfs_ip->ag_lock);
580 jfs_ip->active_ag = -1;
581#ifdef CONFIG_JFS_POSIX_ACL
582 jfs_ip->i_acl = JFS_ACL_NOT_CACHED;
583 jfs_ip->i_default_acl = JFS_ACL_NOT_CACHED;
584#endif
585 inode_init_once(&jfs_ip->vfs_inode);
586 }
587}
588
589static int __init init_jfs_fs(void)
590{
591 int i;
592 int rc;
593
594 jfs_inode_cachep =
595 kmem_cache_create("jfs_ip", sizeof(struct jfs_inode_info), 0,
596 SLAB_RECLAIM_ACCOUNT, init_once, NULL);
597 if (jfs_inode_cachep == NULL)
598 return -ENOMEM;
599
600 /*
601 * Metapage initialization
602 */
603 rc = metapage_init();
604 if (rc) {
605 jfs_err("metapage_init failed w/rc = %d", rc);
606 goto free_slab;
607 }
608
609 /*
610 * Transaction Manager initialization
611 */
612 rc = txInit();
613 if (rc) {
614 jfs_err("txInit failed w/rc = %d", rc);
615 goto free_metapage;
616 }
617
618 /*
619 * I/O completion thread (endio)
620 */
621 jfsIOthread = kernel_thread(jfsIOWait, NULL, CLONE_KERNEL);
622 if (jfsIOthread < 0) {
623 jfs_err("init_jfs_fs: fork failed w/rc = %d", jfsIOthread);
624 goto end_txmngr;
625 }
626 wait_for_completion(&jfsIOwait); /* Wait until thread starts */
627
628 if (commit_threads < 1)
629 commit_threads = num_online_cpus();
630 if (commit_threads > MAX_COMMIT_THREADS)
631 commit_threads = MAX_COMMIT_THREADS;
632
633 for (i = 0; i < commit_threads; i++) {
634 jfsCommitThread[i] = kernel_thread(jfs_lazycommit, NULL,
635 CLONE_KERNEL);
636 if (jfsCommitThread[i] < 0) {
637 jfs_err("init_jfs_fs: fork failed w/rc = %d",
638 jfsCommitThread[i]);
639 commit_threads = i;
640 goto kill_committask;
641 }
642 /* Wait until thread starts */
643 wait_for_completion(&jfsIOwait);
644 }
645
646 jfsSyncThread = kernel_thread(jfs_sync, NULL, CLONE_KERNEL);
647 if (jfsSyncThread < 0) {
648 jfs_err("init_jfs_fs: fork failed w/rc = %d", jfsSyncThread);
649 goto kill_committask;
650 }
651 wait_for_completion(&jfsIOwait); /* Wait until thread starts */
652
653#ifdef PROC_FS_JFS
654 jfs_proc_init();
655#endif
656
657 return register_filesystem(&jfs_fs_type);
658
659kill_committask:
660 jfs_stop_threads = 1;
661 wake_up_all(&jfs_commit_thread_wait);
662 for (i = 0; i < commit_threads; i++)
663 wait_for_completion(&jfsIOwait);
664
665 wake_up(&jfs_IO_thread_wait);
666 wait_for_completion(&jfsIOwait); /* Wait for thread exit */
667end_txmngr:
668 txExit();
669free_metapage:
670 metapage_exit();
671free_slab:
672 kmem_cache_destroy(jfs_inode_cachep);
673 return rc;
674}
675
676static void __exit exit_jfs_fs(void)
677{
678 int i;
679
680 jfs_info("exit_jfs_fs called");
681
682 jfs_stop_threads = 1;
683 txExit();
684 metapage_exit();
685 wake_up(&jfs_IO_thread_wait);
686 wait_for_completion(&jfsIOwait); /* Wait until IO thread exits */
687 wake_up_all(&jfs_commit_thread_wait);
688 for (i = 0; i < commit_threads; i++)
689 wait_for_completion(&jfsIOwait);
690 wake_up(&jfs_sync_thread_wait);
691 wait_for_completion(&jfsIOwait); /* Wait until Sync thread exits */
692#ifdef PROC_FS_JFS
693 jfs_proc_clean();
694#endif
695 unregister_filesystem(&jfs_fs_type);
696 kmem_cache_destroy(jfs_inode_cachep);
697}
698
699module_init(init_jfs_fs)
700module_exit(exit_jfs_fs)