blob: 6f4ac1c070f0118d8dbda1a9405a2abd4f6ad426 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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
Dave Kleikamp63f83c92006-10-02 09:55:27 -05007 * the Free Software Foundation; either version 2 of the License, or
Linus Torvalds1da177e2005-04-16 15:20:36 -07008 * (at your option) any later version.
Dave Kleikamp63f83c92006-10-02 09:55:27 -05009 *
Linus Torvalds1da177e2005-04-16 15:20:36 -070010 * 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
Dave Kleikamp63f83c92006-10-02 09:55:27 -050016 * along with this program; if not, write to the Free Software
Linus Torvalds1da177e2005-04-16 15:20:36 -070017 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#include <linux/fs.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070021#include <linux/module.h>
22#include <linux/parser.h>
23#include <linux/completion.h>
24#include <linux/vfs.h>
Jan Kara74abb982008-07-25 01:46:51 -070025#include <linux/quotaops.h>
Mark Bellon8fc27512005-09-06 15:16:54 -070026#include <linux/mount.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070027#include <linux/moduleparam.h>
Christoph Hellwig91dbb4d2006-02-15 12:49:04 -060028#include <linux/kthread.h>
Christoph Hellwig9a59f452005-06-23 00:10:19 -070029#include <linux/posix_acl.h>
Dave Kleikamp115ff502006-07-26 14:52:13 -050030#include <linux/buffer_head.h>
Christoph Hellwiga5694252007-07-17 04:04:28 -070031#include <linux/exportfs.h>
Coly Lib5c816a2009-01-21 00:05:39 +080032#include <linux/crc32.h>
Tejun Heo5a0e3ad2010-03-24 17:04:11 +090033#include <linux/slab.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070034#include <asm/uaccess.h>
Mark Bellon8fc27512005-09-06 15:16:54 -070035#include <linux/seq_file.h>
Tino Reichardtb40c2e62012-09-17 11:58:19 -050036#include <linux/blkdev.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070037
38#include "jfs_incore.h"
39#include "jfs_filsys.h"
Dave Kleikamp1868f4a2005-05-04 15:29:35 -050040#include "jfs_inode.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070041#include "jfs_metapage.h"
42#include "jfs_superblock.h"
43#include "jfs_dmap.h"
44#include "jfs_imap.h"
45#include "jfs_acl.h"
46#include "jfs_debug.h"
47
48MODULE_DESCRIPTION("The Journaled Filesystem (JFS)");
49MODULE_AUTHOR("Steve Best/Dave Kleikamp/Barry Arndt, IBM");
50MODULE_LICENSE("GPL");
51
Christoph Lametere18b8902006-12-06 20:33:20 -080052static struct kmem_cache * jfs_inode_cachep;
Linus Torvalds1da177e2005-04-16 15:20:36 -070053
Josef 'Jeff' Sipekee9b6d62007-02-12 00:55:41 -080054static const struct super_operations jfs_super_operations;
Christoph Hellwig39655162007-10-21 16:42:17 -070055static const struct export_operations jfs_export_operations;
Linus Torvalds1da177e2005-04-16 15:20:36 -070056static struct file_system_type jfs_fs_type;
57
58#define MAX_COMMIT_THREADS 64
59static int commit_threads = 0;
60module_param(commit_threads, int, 0);
61MODULE_PARM_DESC(commit_threads, "Number of commit threads");
62
Christoph Hellwig91dbb4d2006-02-15 12:49:04 -060063static struct task_struct *jfsCommitThread[MAX_COMMIT_THREADS];
64struct task_struct *jfsIOthread;
65struct task_struct *jfsSyncThread;
Linus Torvalds1da177e2005-04-16 15:20:36 -070066
67#ifdef CONFIG_JFS_DEBUG
68int jfsloglevel = JFS_LOGLEVEL_WARN;
69module_param(jfsloglevel, int, 0644);
70MODULE_PARM_DESC(jfsloglevel, "Specify JFS loglevel (0, 1 or 2)");
71#endif
72
Linus Torvalds1da177e2005-04-16 15:20:36 -070073static void jfs_handle_error(struct super_block *sb)
74{
75 struct jfs_sb_info *sbi = JFS_SBI(sb);
76
77 if (sb->s_flags & MS_RDONLY)
78 return;
79
80 updateSuper(sb, FM_DIRTY);
81
82 if (sbi->flag & JFS_ERR_PANIC)
83 panic("JFS (device %s): panic forced after error\n",
84 sb->s_id);
85 else if (sbi->flag & JFS_ERR_REMOUNT_RO) {
86 jfs_err("ERROR: (device %s): remounting filesystem "
87 "as read-only\n",
88 sb->s_id);
89 sb->s_flags |= MS_RDONLY;
Dave Kleikamp63f83c92006-10-02 09:55:27 -050090 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070091
92 /* nothing is done for continue beyond marking the superblock dirty */
93}
94
95void jfs_error(struct super_block *sb, const char * function, ...)
96{
97 static char error_buf[256];
98 va_list args;
99
100 va_start(args, function);
Alexey Dobriyan4a6e6172006-12-06 20:37:04 -0800101 vsnprintf(error_buf, sizeof(error_buf), function, args);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700102 va_end(args);
103
Tino Reichardtb40c2e62012-09-17 11:58:19 -0500104 pr_err("ERROR: (device %s): %s\n", sb->s_id, error_buf);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700105
106 jfs_handle_error(sb);
107}
108
109static struct inode *jfs_alloc_inode(struct super_block *sb)
110{
111 struct jfs_inode_info *jfs_inode;
112
113 jfs_inode = kmem_cache_alloc(jfs_inode_cachep, GFP_NOFS);
114 if (!jfs_inode)
115 return NULL;
116 return &jfs_inode->vfs_inode;
117}
118
Nick Pigginfa0d7e3d2011-01-07 17:49:49 +1100119static void jfs_i_callback(struct rcu_head *head)
120{
121 struct inode *inode = container_of(head, struct inode, i_rcu);
122 struct jfs_inode_info *ji = JFS_IP(inode);
Nick Pigginfa0d7e3d2011-01-07 17:49:49 +1100123 kmem_cache_free(jfs_inode_cachep, ji);
124}
125
Linus Torvalds1da177e2005-04-16 15:20:36 -0700126static void jfs_destroy_inode(struct inode *inode)
127{
128 struct jfs_inode_info *ji = JFS_IP(inode);
129
Dave Kleikamp8a9cd6d2005-08-10 11:14:39 -0500130 BUG_ON(!list_empty(&ji->anon_inode_list));
131
Linus Torvalds1da177e2005-04-16 15:20:36 -0700132 spin_lock_irq(&ji->ag_lock);
133 if (ji->active_ag != -1) {
134 struct bmap *bmap = JFS_SBI(inode->i_sb)->bmap;
135 atomic_dec(&bmap->db_active[ji->active_ag]);
136 ji->active_ag = -1;
137 }
138 spin_unlock_irq(&ji->ag_lock);
Nick Pigginfa0d7e3d2011-01-07 17:49:49 +1100139 call_rcu(&inode->i_rcu, jfs_i_callback);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700140}
141
David Howells726c3342006-06-23 02:02:58 -0700142static int jfs_statfs(struct dentry *dentry, struct kstatfs *buf)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700143{
David Howells726c3342006-06-23 02:02:58 -0700144 struct jfs_sb_info *sbi = JFS_SBI(dentry->d_sb);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700145 s64 maxinodes;
146 struct inomap *imap = JFS_IP(sbi->ipimap)->i_imap;
147
148 jfs_info("In jfs_statfs");
149 buf->f_type = JFS_SUPER_MAGIC;
150 buf->f_bsize = sbi->bsize;
151 buf->f_blocks = sbi->bmap->db_mapsize;
152 buf->f_bfree = sbi->bmap->db_nfree;
153 buf->f_bavail = sbi->bmap->db_nfree;
154 /*
155 * If we really return the number of allocated & free inodes, some
156 * applications will fail because they won't see enough free inodes.
157 * We'll try to calculate some guess as to how may inodes we can
158 * really allocate
159 *
160 * buf->f_files = atomic_read(&imap->im_numinos);
161 * buf->f_ffree = atomic_read(&imap->im_numfree);
162 */
163 maxinodes = min((s64) atomic_read(&imap->im_numinos) +
164 ((sbi->bmap->db_nfree >> imap->im_l2nbperiext)
165 << L2INOSPEREXT), (s64) 0xffffffffLL);
166 buf->f_files = maxinodes;
167 buf->f_ffree = maxinodes - (atomic_read(&imap->im_numinos) -
168 atomic_read(&imap->im_numfree));
Coly Lib5c816a2009-01-21 00:05:39 +0800169 buf->f_fsid.val[0] = (u32)crc32_le(0, sbi->uuid, sizeof(sbi->uuid)/2);
170 buf->f_fsid.val[1] = (u32)crc32_le(0, sbi->uuid + sizeof(sbi->uuid)/2,
171 sizeof(sbi->uuid)/2);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700172
173 buf->f_namelen = JFS_NAME_MAX;
174 return 0;
175}
176
177static void jfs_put_super(struct super_block *sb)
178{
179 struct jfs_sb_info *sbi = JFS_SBI(sb);
180 int rc;
181
182 jfs_info("In jfs_put_super");
Christoph Hellwig6cfd0142009-05-05 15:40:36 +0200183
Christoph Hellwige0ccfd92010-05-19 07:16:42 -0400184 dquot_disable(sb, -1, DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED);
185
Linus Torvalds1da177e2005-04-16 15:20:36 -0700186 rc = jfs_umount(sb);
187 if (rc)
188 jfs_err("jfs_umount failed with return code %d", rc);
Thomas Gleixner6d729e42009-08-16 21:05:08 +0000189
190 unload_nls(sbi->nls_tab);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700191
Dave Kleikamp7fab4792005-05-02 12:25:02 -0600192 truncate_inode_pages(sbi->direct_inode->i_mapping, 0);
193 iput(sbi->direct_inode);
Dave Kleikamp7fab4792005-05-02 12:25:02 -0600194
Linus Torvalds1da177e2005-04-16 15:20:36 -0700195 kfree(sbi);
196}
197
198enum {
199 Opt_integrity, Opt_nointegrity, Opt_iocharset, Opt_resize,
Mark Bellon8fc27512005-09-06 15:16:54 -0700200 Opt_resize_nosize, Opt_errors, Opt_ignore, Opt_err, Opt_quota,
Tino Reichardtb40c2e62012-09-17 11:58:19 -0500201 Opt_usrquota, Opt_grpquota, Opt_uid, Opt_gid, Opt_umask,
202 Opt_discard, Opt_nodiscard, Opt_discard_minblk
Linus Torvalds1da177e2005-04-16 15:20:36 -0700203};
204
Steven Whitehousea447c092008-10-13 10:46:57 +0100205static const match_table_t tokens = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700206 {Opt_integrity, "integrity"},
207 {Opt_nointegrity, "nointegrity"},
208 {Opt_iocharset, "iocharset=%s"},
209 {Opt_resize, "resize=%u"},
210 {Opt_resize_nosize, "resize"},
211 {Opt_errors, "errors=%s"},
212 {Opt_ignore, "noquota"},
213 {Opt_ignore, "quota"},
Mark Bellon8fc27512005-09-06 15:16:54 -0700214 {Opt_usrquota, "usrquota"},
215 {Opt_grpquota, "grpquota"},
Dave Kleikamp69eb66d2006-03-09 13:59:30 -0600216 {Opt_uid, "uid=%u"},
217 {Opt_gid, "gid=%u"},
218 {Opt_umask, "umask=%u"},
Tino Reichardtb40c2e62012-09-17 11:58:19 -0500219 {Opt_discard, "discard"},
220 {Opt_nodiscard, "nodiscard"},
221 {Opt_discard_minblk, "discard=%u"},
Linus Torvalds1da177e2005-04-16 15:20:36 -0700222 {Opt_err, NULL}
223};
224
225static int parse_options(char *options, struct super_block *sb, s64 *newLVSize,
226 int *flag)
227{
228 void *nls_map = (void *)-1; /* -1: no change; NULL: none */
229 char *p;
230 struct jfs_sb_info *sbi = JFS_SBI(sb);
231
232 *newLVSize = 0;
233
234 if (!options)
235 return 1;
236
237 while ((p = strsep(&options, ",")) != NULL) {
238 substring_t args[MAX_OPT_ARGS];
239 int token;
240 if (!*p)
241 continue;
242
243 token = match_token(p, tokens, args);
244 switch (token) {
245 case Opt_integrity:
246 *flag &= ~JFS_NOINTEGRITY;
247 break;
248 case Opt_nointegrity:
249 *flag |= JFS_NOINTEGRITY;
250 break;
251 case Opt_ignore:
252 /* Silently ignore the quota options */
253 /* Don't do anything ;-) */
254 break;
255 case Opt_iocharset:
256 if (nls_map && nls_map != (void *) -1)
257 unload_nls(nls_map);
258 if (!strcmp(args[0].from, "none"))
259 nls_map = NULL;
260 else {
261 nls_map = load_nls(args[0].from);
262 if (!nls_map) {
Tino Reichardtb40c2e62012-09-17 11:58:19 -0500263 pr_err("JFS: charset not found\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700264 goto cleanup;
265 }
266 }
267 break;
268 case Opt_resize:
269 {
270 char *resize = args[0].from;
271 *newLVSize = simple_strtoull(resize, &resize, 0);
272 break;
273 }
274 case Opt_resize_nosize:
275 {
276 *newLVSize = sb->s_bdev->bd_inode->i_size >>
277 sb->s_blocksize_bits;
278 if (*newLVSize == 0)
Tino Reichardtb40c2e62012-09-17 11:58:19 -0500279 pr_err("JFS: Cannot determine volume size\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700280 break;
281 }
282 case Opt_errors:
283 {
284 char *errors = args[0].from;
285 if (!errors || !*errors)
286 goto cleanup;
287 if (!strcmp(errors, "continue")) {
288 *flag &= ~JFS_ERR_REMOUNT_RO;
289 *flag &= ~JFS_ERR_PANIC;
290 *flag |= JFS_ERR_CONTINUE;
291 } else if (!strcmp(errors, "remount-ro")) {
292 *flag &= ~JFS_ERR_CONTINUE;
293 *flag &= ~JFS_ERR_PANIC;
294 *flag |= JFS_ERR_REMOUNT_RO;
295 } else if (!strcmp(errors, "panic")) {
296 *flag &= ~JFS_ERR_CONTINUE;
297 *flag &= ~JFS_ERR_REMOUNT_RO;
298 *flag |= JFS_ERR_PANIC;
299 } else {
Tino Reichardtb40c2e62012-09-17 11:58:19 -0500300 pr_err("JFS: %s is an invalid error handler\n",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700301 errors);
302 goto cleanup;
303 }
304 break;
305 }
Mark Bellon8fc27512005-09-06 15:16:54 -0700306
Dave Kleikamp115ff502006-07-26 14:52:13 -0500307#ifdef CONFIG_QUOTA
Mark Bellon8fc27512005-09-06 15:16:54 -0700308 case Opt_quota:
309 case Opt_usrquota:
310 *flag |= JFS_USRQUOTA;
311 break;
312 case Opt_grpquota:
313 *flag |= JFS_GRPQUOTA;
314 break;
315#else
316 case Opt_usrquota:
317 case Opt_grpquota:
318 case Opt_quota:
Tino Reichardtb40c2e62012-09-17 11:58:19 -0500319 pr_err("JFS: quota operations not supported\n");
Mark Bellon8fc27512005-09-06 15:16:54 -0700320 break;
321#endif
Dave Kleikamp69eb66d2006-03-09 13:59:30 -0600322 case Opt_uid:
323 {
324 char *uid = args[0].from;
325 sbi->uid = simple_strtoul(uid, &uid, 0);
326 break;
327 }
Tino Reichardtb40c2e62012-09-17 11:58:19 -0500328
Dave Kleikamp69eb66d2006-03-09 13:59:30 -0600329 case Opt_gid:
330 {
331 char *gid = args[0].from;
332 sbi->gid = simple_strtoul(gid, &gid, 0);
333 break;
334 }
Tino Reichardtb40c2e62012-09-17 11:58:19 -0500335
Dave Kleikamp69eb66d2006-03-09 13:59:30 -0600336 case Opt_umask:
337 {
338 char *umask = args[0].from;
339 sbi->umask = simple_strtoul(umask, &umask, 8);
340 if (sbi->umask & ~0777) {
Tino Reichardtb40c2e62012-09-17 11:58:19 -0500341 pr_err("JFS: Invalid value of umask\n");
Dave Kleikamp69eb66d2006-03-09 13:59:30 -0600342 goto cleanup;
343 }
344 break;
345 }
Tino Reichardtb40c2e62012-09-17 11:58:19 -0500346
347 case Opt_discard:
348 {
349 struct request_queue *q = bdev_get_queue(sb->s_bdev);
350 /* if set to 1, even copying files will cause
351 * trimming :O
352 * -> user has more control over the online trimming
353 */
354 sbi->minblks_trim = 64;
355 if (blk_queue_discard(q)) {
356 *flag |= JFS_DISCARD;
357 } else {
358 pr_err("JFS: discard option " \
359 "not supported on device\n");
360 }
361 break;
362 }
363
364 case Opt_nodiscard:
365 *flag &= ~JFS_DISCARD;
366 break;
367
368 case Opt_discard_minblk:
369 {
370 struct request_queue *q = bdev_get_queue(sb->s_bdev);
371 char *minblks_trim = args[0].from;
372 if (blk_queue_discard(q)) {
373 *flag |= JFS_DISCARD;
374 sbi->minblks_trim = simple_strtoull(
375 minblks_trim, &minblks_trim, 0);
376 } else {
377 pr_err("JFS: discard option " \
378 "not supported on device\n");
379 }
380 break;
381 }
382
Linus Torvalds1da177e2005-04-16 15:20:36 -0700383 default:
384 printk("jfs: Unrecognized mount option \"%s\" "
385 " or missing value\n", p);
386 goto cleanup;
387 }
388 }
389
390 if (nls_map != (void *) -1) {
391 /* Discard old (if remount) */
Thomas Gleixner6d729e42009-08-16 21:05:08 +0000392 unload_nls(sbi->nls_tab);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700393 sbi->nls_tab = nls_map;
394 }
395 return 1;
396
397cleanup:
398 if (nls_map && nls_map != (void *) -1)
399 unload_nls(nls_map);
400 return 0;
401}
402
403static int jfs_remount(struct super_block *sb, int *flags, char *data)
404{
405 s64 newLVSize = 0;
406 int rc = 0;
407 int flag = JFS_SBI(sb)->flag;
Alessio Igor Bogani337eb002009-05-12 15:10:54 +0200408 int ret;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700409
410 if (!parse_options(data, sb, &newLVSize, &flag)) {
411 return -EINVAL;
412 }
Jan Blunck22b26db2010-02-24 13:25:31 +0100413
Linus Torvalds1da177e2005-04-16 15:20:36 -0700414 if (newLVSize) {
415 if (sb->s_flags & MS_RDONLY) {
Tino Reichardtb40c2e62012-09-17 11:58:19 -0500416 pr_err("JFS: resize requires volume" \
417 " to be mounted read-write\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700418 return -EROFS;
419 }
420 rc = jfs_extendfs(sb, newLVSize, 0);
Jan Blunck22b26db2010-02-24 13:25:31 +0100421 if (rc)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700422 return rc;
423 }
424
425 if ((sb->s_flags & MS_RDONLY) && !(*flags & MS_RDONLY)) {
Dave Kleikamp7fab4792005-05-02 12:25:02 -0600426 /*
427 * Invalidate any previously read metadata. fsck may have
428 * changed the on-disk data since we mounted r/o
429 */
430 truncate_inode_pages(JFS_SBI(sb)->direct_inode->i_mapping, 0);
431
Linus Torvalds1da177e2005-04-16 15:20:36 -0700432 JFS_SBI(sb)->flag = flag;
Alessio Igor Bogani337eb002009-05-12 15:10:54 +0200433 ret = jfs_mount_rw(sb, 1);
Christoph Hellwigc79d9672010-05-19 07:16:40 -0400434
435 /* mark the fs r/w for quota activity */
436 sb->s_flags &= ~MS_RDONLY;
437
Christoph Hellwig0f0dd622010-05-19 07:16:41 -0400438 dquot_resume(sb, -1);
Alessio Igor Bogani337eb002009-05-12 15:10:54 +0200439 return ret;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700440 }
441 if ((!(sb->s_flags & MS_RDONLY)) && (*flags & MS_RDONLY)) {
Christoph Hellwig0f0dd622010-05-19 07:16:41 -0400442 rc = dquot_suspend(sb, -1);
443 if (rc < 0) {
Christoph Hellwig0f0dd622010-05-19 07:16:41 -0400444 return rc;
Christoph Hellwigc79d9672010-05-19 07:16:40 -0400445 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700446 rc = jfs_umount_rw(sb);
447 JFS_SBI(sb)->flag = flag;
448 return rc;
449 }
450 if ((JFS_SBI(sb)->flag & JFS_NOINTEGRITY) != (flag & JFS_NOINTEGRITY))
451 if (!(sb->s_flags & MS_RDONLY)) {
452 rc = jfs_umount_rw(sb);
Jan Blunck22b26db2010-02-24 13:25:31 +0100453 if (rc)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700454 return rc;
Jan Blunck22b26db2010-02-24 13:25:31 +0100455
Linus Torvalds1da177e2005-04-16 15:20:36 -0700456 JFS_SBI(sb)->flag = flag;
Alessio Igor Bogani337eb002009-05-12 15:10:54 +0200457 ret = jfs_mount_rw(sb, 1);
Alessio Igor Bogani337eb002009-05-12 15:10:54 +0200458 return ret;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700459 }
460 JFS_SBI(sb)->flag = flag;
461
462 return 0;
463}
464
465static int jfs_fill_super(struct super_block *sb, void *data, int silent)
466{
467 struct jfs_sb_info *sbi;
468 struct inode *inode;
469 int rc;
470 s64 newLVSize = 0;
David Howellseab1df72008-02-07 00:15:43 -0800471 int flag, ret = -EINVAL;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700472
473 jfs_info("In jfs_read_super: s_flags=0x%lx", sb->s_flags);
474
Jan Blunck22b26db2010-02-24 13:25:31 +0100475 if (!new_valid_dev(sb->s_bdev->bd_dev))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700476 return -EOVERFLOW;
477
Eric Sesterhenn5b3030e2006-02-23 09:47:13 -0600478 sbi = kzalloc(sizeof (struct jfs_sb_info), GFP_KERNEL);
Jan Blunck22b26db2010-02-24 13:25:31 +0100479 if (!sbi)
Akinobu Mita087387f2006-09-14 09:22:38 -0500480 return -ENOMEM;
Jan Blunck22b26db2010-02-24 13:25:31 +0100481
Linus Torvalds1da177e2005-04-16 15:20:36 -0700482 sb->s_fs_info = sbi;
Al Viro8de52772012-02-06 12:45:27 -0500483 sb->s_max_links = JFS_LINK_MAX;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700484 sbi->sb = sb;
Dave Kleikamp69eb66d2006-03-09 13:59:30 -0600485 sbi->uid = sbi->gid = sbi->umask = -1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700486
487 /* initialize the mount flag and determine the default error handler */
488 flag = JFS_ERR_REMOUNT_RO;
489
Jan Blunck684bdc72010-04-12 16:44:08 -0700490 if (!parse_options((char *) data, sb, &newLVSize, &flag))
491 goto out_kfree;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700492 sbi->flag = flag;
493
494#ifdef CONFIG_JFS_POSIX_ACL
495 sb->s_flags |= MS_POSIXACL;
496#endif
497
498 if (newLVSize) {
Tino Reichardtb40c2e62012-09-17 11:58:19 -0500499 pr_err("resize option for remount only\n");
Jan Blunck684bdc72010-04-12 16:44:08 -0700500 goto out_kfree;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700501 }
502
503 /*
504 * Initialize blocksize to 4K.
505 */
506 sb_set_blocksize(sb, PSIZE);
507
508 /*
509 * Set method vectors.
510 */
511 sb->s_op = &jfs_super_operations;
512 sb->s_export_op = &jfs_export_operations;
Christoph Hellwig123e9ca2010-05-19 07:16:44 -0400513#ifdef CONFIG_QUOTA
514 sb->dq_op = &dquot_operations;
Christoph Hellwig287a8092010-05-19 07:16:45 -0400515 sb->s_qcop = &dquot_quotactl_ops;
Christoph Hellwig123e9ca2010-05-19 07:16:44 -0400516#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700517
Dave Kleikamp7fab4792005-05-02 12:25:02 -0600518 /*
519 * Initialize direct-mapping inode/address-space
520 */
521 inode = new_inode(sb);
David Howellseab1df72008-02-07 00:15:43 -0800522 if (inode == NULL) {
523 ret = -ENOMEM;
Jan Blunck684bdc72010-04-12 16:44:08 -0700524 goto out_unload;
David Howellseab1df72008-02-07 00:15:43 -0800525 }
Dave Kleikamp7fab4792005-05-02 12:25:02 -0600526 inode->i_ino = 0;
Dave Kleikamp7fab4792005-05-02 12:25:02 -0600527 inode->i_size = sb->s_bdev->bd_inode->i_size;
528 inode->i_mapping->a_ops = &jfs_metapage_aops;
Dave Kleikampac17b8b2005-10-03 15:32:11 -0500529 insert_inode_hash(inode);
Dave Kleikamp7fab4792005-05-02 12:25:02 -0600530 mapping_set_gfp_mask(inode->i_mapping, GFP_NOFS);
531
532 sbi->direct_inode = inode;
533
Linus Torvalds1da177e2005-04-16 15:20:36 -0700534 rc = jfs_mount(sb);
535 if (rc) {
536 if (!silent) {
537 jfs_err("jfs_mount failed w/return code = %d", rc);
538 }
Dave Kleikamp7fab4792005-05-02 12:25:02 -0600539 goto out_mount_failed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700540 }
541 if (sb->s_flags & MS_RDONLY)
542 sbi->log = NULL;
543 else {
544 rc = jfs_mount_rw(sb, 0);
545 if (rc) {
546 if (!silent) {
547 jfs_err("jfs_mount_rw failed, return code = %d",
548 rc);
549 }
550 goto out_no_rw;
551 }
552 }
553
554 sb->s_magic = JFS_SUPER_MAGIC;
555
Al Viro94b77bd2010-12-18 10:59:31 -0500556 if (sbi->mntflag & JFS_OS2)
557 sb->s_d_op = &jfs_ci_dentry_operations;
558
David Howellseab1df72008-02-07 00:15:43 -0800559 inode = jfs_iget(sb, ROOT_I);
560 if (IS_ERR(inode)) {
561 ret = PTR_ERR(inode);
Dave Kleikamp6536d282008-05-21 10:45:16 -0500562 goto out_no_rw;
David Howellseab1df72008-02-07 00:15:43 -0800563 }
Al Viro48fde702012-01-08 22:15:13 -0500564 sb->s_root = d_make_root(inode);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700565 if (!sb->s_root)
566 goto out_no_root;
567
Linus Torvalds1da177e2005-04-16 15:20:36 -0700568 /* logical blocks are represented by 40 bits in pxd_t, etc. */
569 sb->s_maxbytes = ((u64) sb->s_blocksize) << 40;
570#if BITS_PER_LONG == 32
571 /*
572 * Page cache is indexed by long.
573 * I would use MAX_LFS_FILESIZE, but it's only half as big
574 */
Alan Cox28ba0ec2009-11-06 11:31:06 +0000575 sb->s_maxbytes = min(((u64) PAGE_CACHE_SIZE << 32) - 1, (u64)sb->s_maxbytes);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700576#endif
577 sb->s_time_gran = 1;
578 return 0;
579
580out_no_root:
Dave Kleikamp6536d282008-05-21 10:45:16 -0500581 jfs_err("jfs_read_super: get root dentry failed");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700582
583out_no_rw:
584 rc = jfs_umount(sb);
585 if (rc) {
586 jfs_err("jfs_umount failed with return code %d", rc);
587 }
Dave Kleikamp7fab4792005-05-02 12:25:02 -0600588out_mount_failed:
OGAWA Hirofumi28fd1292006-01-08 01:02:14 -0800589 filemap_write_and_wait(sbi->direct_inode->i_mapping);
Dave Kleikamp7fab4792005-05-02 12:25:02 -0600590 truncate_inode_pages(sbi->direct_inode->i_mapping, 0);
591 make_bad_inode(sbi->direct_inode);
592 iput(sbi->direct_inode);
593 sbi->direct_inode = NULL;
Jan Blunck684bdc72010-04-12 16:44:08 -0700594out_unload:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700595 if (sbi->nls_tab)
596 unload_nls(sbi->nls_tab);
Jan Blunck684bdc72010-04-12 16:44:08 -0700597out_kfree:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700598 kfree(sbi);
David Howellseab1df72008-02-07 00:15:43 -0800599 return ret;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700600}
601
Takashi Satoc4be0c12009-01-09 16:40:58 -0800602static int jfs_freeze(struct super_block *sb)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700603{
604 struct jfs_sb_info *sbi = JFS_SBI(sb);
605 struct jfs_log *log = sbi->log;
606
607 if (!(sb->s_flags & MS_RDONLY)) {
608 txQuiesce(sb);
609 lmLogShutdown(log);
610 updateSuper(sb, FM_CLEAN);
611 }
Takashi Satoc4be0c12009-01-09 16:40:58 -0800612 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700613}
614
Takashi Satoc4be0c12009-01-09 16:40:58 -0800615static int jfs_unfreeze(struct super_block *sb)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700616{
617 struct jfs_sb_info *sbi = JFS_SBI(sb);
618 struct jfs_log *log = sbi->log;
619 int rc = 0;
620
621 if (!(sb->s_flags & MS_RDONLY)) {
622 updateSuper(sb, FM_MOUNT);
623 if ((rc = lmLogInit(log)))
624 jfs_err("jfs_unlock failed with return code %d", rc);
625 else
626 txResume(sb);
627 }
Takashi Satoc4be0c12009-01-09 16:40:58 -0800628 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700629}
630
Al Viro152a0832010-07-25 00:46:55 +0400631static struct dentry *jfs_do_mount(struct file_system_type *fs_type,
632 int flags, const char *dev_name, void *data)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700633{
Al Viro152a0832010-07-25 00:46:55 +0400634 return mount_bdev(fs_type, flags, dev_name, data, jfs_fill_super);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700635}
636
637static int jfs_sync_fs(struct super_block *sb, int wait)
638{
639 struct jfs_log *log = JFS_SBI(sb)->log;
640
641 /* log == NULL indicates read-only mount */
Dave Kleikamp1c627822005-05-02 12:25:08 -0600642 if (log) {
Jan Karaa1177822012-07-03 16:45:29 +0200643 /*
644 * Write quota structures to quota file, sync_blockdev() will
645 * write them to disk later
646 */
647 dquot_writeback_dquots(sb, -1);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700648 jfs_flush_journal(log, wait);
Dave Kleikampcbc3d652005-07-27 09:17:57 -0500649 jfs_syncpt(log, 0);
Dave Kleikamp1c627822005-05-02 12:25:08 -0600650 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700651
652 return 0;
653}
654
Al Viro34c80b12011-12-08 21:32:45 -0500655static int jfs_show_options(struct seq_file *seq, struct dentry *root)
Mark Bellon8fc27512005-09-06 15:16:54 -0700656{
Al Viro34c80b12011-12-08 21:32:45 -0500657 struct jfs_sb_info *sbi = JFS_SBI(root->d_sb);
Mark Bellon8fc27512005-09-06 15:16:54 -0700658
Dave Kleikamp69eb66d2006-03-09 13:59:30 -0600659 if (sbi->uid != -1)
660 seq_printf(seq, ",uid=%d", sbi->uid);
661 if (sbi->gid != -1)
662 seq_printf(seq, ",gid=%d", sbi->gid);
663 if (sbi->umask != -1)
664 seq_printf(seq, ",umask=%03o", sbi->umask);
Mark Bellon8fc27512005-09-06 15:16:54 -0700665 if (sbi->flag & JFS_NOINTEGRITY)
666 seq_puts(seq, ",nointegrity");
Tino Reichardtb40c2e62012-09-17 11:58:19 -0500667 if (sbi->flag & JFS_DISCARD)
668 seq_printf(seq, ",discard=%u", sbi->minblks_trim);
Miklos Szeredi5c5e32c2008-01-24 16:13:21 -0600669 if (sbi->nls_tab)
670 seq_printf(seq, ",iocharset=%s", sbi->nls_tab->charset);
671 if (sbi->flag & JFS_ERR_CONTINUE)
672 seq_printf(seq, ",errors=continue");
673 if (sbi->flag & JFS_ERR_PANIC)
674 seq_printf(seq, ",errors=panic");
Mark Bellon8fc27512005-09-06 15:16:54 -0700675
Dave Kleikamp115ff502006-07-26 14:52:13 -0500676#ifdef CONFIG_QUOTA
Mark Bellon8fc27512005-09-06 15:16:54 -0700677 if (sbi->flag & JFS_USRQUOTA)
678 seq_puts(seq, ",usrquota");
679
680 if (sbi->flag & JFS_GRPQUOTA)
681 seq_puts(seq, ",grpquota");
682#endif
683
684 return 0;
685}
686
Dave Kleikamp115ff502006-07-26 14:52:13 -0500687#ifdef CONFIG_QUOTA
688
689/* Read data from quotafile - avoid pagecache and such because we cannot afford
690 * acquiring the locks... As quota files are never truncated and quota code
Lucas De Marchi25985ed2011-03-30 22:57:33 -0300691 * itself serializes the operations (and no one else should touch the files)
Dave Kleikamp115ff502006-07-26 14:52:13 -0500692 * we don't have to be afraid of races */
693static ssize_t jfs_quota_read(struct super_block *sb, int type, char *data,
694 size_t len, loff_t off)
695{
696 struct inode *inode = sb_dqopt(sb)->files[type];
697 sector_t blk = off >> sb->s_blocksize_bits;
698 int err = 0;
699 int offset = off & (sb->s_blocksize - 1);
700 int tocopy;
701 size_t toread;
702 struct buffer_head tmp_bh;
703 struct buffer_head *bh;
704 loff_t i_size = i_size_read(inode);
705
706 if (off > i_size)
707 return 0;
708 if (off+len > i_size)
709 len = i_size-off;
710 toread = len;
711 while (toread > 0) {
712 tocopy = sb->s_blocksize - offset < toread ?
713 sb->s_blocksize - offset : toread;
714
715 tmp_bh.b_state = 0;
716 tmp_bh.b_size = 1 << inode->i_blkbits;
717 err = jfs_get_block(inode, blk, &tmp_bh, 0);
718 if (err)
719 return err;
720 if (!buffer_mapped(&tmp_bh)) /* A hole? */
721 memset(data, 0, tocopy);
722 else {
723 bh = sb_bread(sb, tmp_bh.b_blocknr);
724 if (!bh)
725 return -EIO;
726 memcpy(data, bh->b_data+offset, tocopy);
727 brelse(bh);
728 }
729 offset = 0;
730 toread -= tocopy;
731 data += tocopy;
732 blk++;
733 }
734 return len;
735}
736
737/* Write to quotafile */
738static ssize_t jfs_quota_write(struct super_block *sb, int type,
739 const char *data, size_t len, loff_t off)
740{
741 struct inode *inode = sb_dqopt(sb)->files[type];
742 sector_t blk = off >> sb->s_blocksize_bits;
743 int err = 0;
744 int offset = off & (sb->s_blocksize - 1);
745 int tocopy;
746 size_t towrite = len;
747 struct buffer_head tmp_bh;
748 struct buffer_head *bh;
749
750 mutex_lock(&inode->i_mutex);
751 while (towrite > 0) {
752 tocopy = sb->s_blocksize - offset < towrite ?
753 sb->s_blocksize - offset : towrite;
754
755 tmp_bh.b_state = 0;
Dave Kleikamp8bcb2832006-07-28 08:46:05 -0500756 tmp_bh.b_size = 1 << inode->i_blkbits;
Dave Kleikamp115ff502006-07-26 14:52:13 -0500757 err = jfs_get_block(inode, blk, &tmp_bh, 1);
758 if (err)
759 goto out;
760 if (offset || tocopy != sb->s_blocksize)
761 bh = sb_bread(sb, tmp_bh.b_blocknr);
762 else
763 bh = sb_getblk(sb, tmp_bh.b_blocknr);
764 if (!bh) {
765 err = -EIO;
766 goto out;
767 }
768 lock_buffer(bh);
769 memcpy(bh->b_data+offset, data, tocopy);
770 flush_dcache_page(bh->b_page);
771 set_buffer_uptodate(bh);
772 mark_buffer_dirty(bh);
773 unlock_buffer(bh);
774 brelse(bh);
775 offset = 0;
776 towrite -= tocopy;
777 data += tocopy;
778 blk++;
779 }
780out:
Dan Carpenter9c836332009-04-07 14:48:16 +0300781 if (len == towrite) {
782 mutex_unlock(&inode->i_mutex);
Dave Kleikamp115ff502006-07-26 14:52:13 -0500783 return err;
Dan Carpenter9c836332009-04-07 14:48:16 +0300784 }
Dave Kleikamp115ff502006-07-26 14:52:13 -0500785 if (inode->i_size < off+len-towrite)
786 i_size_write(inode, off+len-towrite);
787 inode->i_version++;
788 inode->i_mtime = inode->i_ctime = CURRENT_TIME;
789 mark_inode_dirty(inode);
790 mutex_unlock(&inode->i_mutex);
791 return len - towrite;
792}
793
794#endif
795
Josef 'Jeff' Sipekee9b6d62007-02-12 00:55:41 -0800796static const struct super_operations jfs_super_operations = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700797 .alloc_inode = jfs_alloc_inode,
798 .destroy_inode = jfs_destroy_inode,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700799 .dirty_inode = jfs_dirty_inode,
800 .write_inode = jfs_write_inode,
Al Viro62aff862010-06-07 00:28:54 -0400801 .evict_inode = jfs_evict_inode,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700802 .put_super = jfs_put_super,
803 .sync_fs = jfs_sync_fs,
Takashi Satoc4be0c12009-01-09 16:40:58 -0800804 .freeze_fs = jfs_freeze,
805 .unfreeze_fs = jfs_unfreeze,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700806 .statfs = jfs_statfs,
807 .remount_fs = jfs_remount,
Dave Kleikamp115ff502006-07-26 14:52:13 -0500808 .show_options = jfs_show_options,
809#ifdef CONFIG_QUOTA
810 .quota_read = jfs_quota_read,
811 .quota_write = jfs_quota_write,
812#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700813};
814
Christoph Hellwig39655162007-10-21 16:42:17 -0700815static const struct export_operations jfs_export_operations = {
Christoph Hellwigd425de72007-10-21 16:42:09 -0700816 .fh_to_dentry = jfs_fh_to_dentry,
817 .fh_to_parent = jfs_fh_to_parent,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700818 .get_parent = jfs_get_parent,
819};
820
821static struct file_system_type jfs_fs_type = {
822 .owner = THIS_MODULE,
823 .name = "jfs",
Al Viro152a0832010-07-25 00:46:55 +0400824 .mount = jfs_do_mount,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700825 .kill_sb = kill_block_super,
826 .fs_flags = FS_REQUIRES_DEV,
827};
828
Alexey Dobriyan51cc5062008-07-25 19:45:34 -0700829static void init_once(void *foo)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700830{
831 struct jfs_inode_info *jfs_ip = (struct jfs_inode_info *) foo;
832
Christoph Lametera35afb82007-05-16 22:10:57 -0700833 memset(jfs_ip, 0, sizeof(struct jfs_inode_info));
834 INIT_LIST_HEAD(&jfs_ip->anon_inode_list);
835 init_rwsem(&jfs_ip->rdwrlock);
836 mutex_init(&jfs_ip->commit_mutex);
837 init_rwsem(&jfs_ip->xattr_sem);
838 spin_lock_init(&jfs_ip->ag_lock);
839 jfs_ip->active_ag = -1;
Christoph Lametera35afb82007-05-16 22:10:57 -0700840 inode_init_once(&jfs_ip->vfs_inode);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700841}
842
843static int __init init_jfs_fs(void)
844{
845 int i;
846 int rc;
847
848 jfs_inode_cachep =
Dave Kleikamp63f83c92006-10-02 09:55:27 -0500849 kmem_cache_create("jfs_ip", sizeof(struct jfs_inode_info), 0,
Paul Jacksonfffb60f2006-03-24 03:16:06 -0800850 SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD,
Paul Mundt20c2df82007-07-20 10:11:58 +0900851 init_once);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700852 if (jfs_inode_cachep == NULL)
853 return -ENOMEM;
854
855 /*
856 * Metapage initialization
857 */
858 rc = metapage_init();
859 if (rc) {
860 jfs_err("metapage_init failed w/rc = %d", rc);
861 goto free_slab;
862 }
863
864 /*
865 * Transaction Manager initialization
866 */
867 rc = txInit();
868 if (rc) {
869 jfs_err("txInit failed w/rc = %d", rc);
870 goto free_metapage;
871 }
872
873 /*
874 * I/O completion thread (endio)
875 */
Christoph Hellwig91dbb4d2006-02-15 12:49:04 -0600876 jfsIOthread = kthread_run(jfsIOWait, NULL, "jfsIO");
877 if (IS_ERR(jfsIOthread)) {
878 rc = PTR_ERR(jfsIOthread);
879 jfs_err("init_jfs_fs: fork failed w/rc = %d", rc);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700880 goto end_txmngr;
881 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700882
883 if (commit_threads < 1)
884 commit_threads = num_online_cpus();
885 if (commit_threads > MAX_COMMIT_THREADS)
886 commit_threads = MAX_COMMIT_THREADS;
887
888 for (i = 0; i < commit_threads; i++) {
Christoph Hellwig91dbb4d2006-02-15 12:49:04 -0600889 jfsCommitThread[i] = kthread_run(jfs_lazycommit, NULL, "jfsCommit");
890 if (IS_ERR(jfsCommitThread[i])) {
891 rc = PTR_ERR(jfsCommitThread[i]);
892 jfs_err("init_jfs_fs: fork failed w/rc = %d", rc);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700893 commit_threads = i;
894 goto kill_committask;
895 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700896 }
897
Christoph Hellwig91dbb4d2006-02-15 12:49:04 -0600898 jfsSyncThread = kthread_run(jfs_sync, NULL, "jfsSync");
899 if (IS_ERR(jfsSyncThread)) {
900 rc = PTR_ERR(jfsSyncThread);
901 jfs_err("init_jfs_fs: fork failed w/rc = %d", rc);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700902 goto kill_committask;
903 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700904
905#ifdef PROC_FS_JFS
906 jfs_proc_init();
907#endif
908
Al Viro76bf09f2012-03-17 18:14:34 -0400909 rc = register_filesystem(&jfs_fs_type);
910 if (!rc)
911 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700912
Al Viro76bf09f2012-03-17 18:14:34 -0400913#ifdef PROC_FS_JFS
914 jfs_proc_clean();
915#endif
916 kthread_stop(jfsSyncThread);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700917kill_committask:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700918 for (i = 0; i < commit_threads; i++)
Christoph Hellwig91dbb4d2006-02-15 12:49:04 -0600919 kthread_stop(jfsCommitThread[i]);
920 kthread_stop(jfsIOthread);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700921end_txmngr:
922 txExit();
923free_metapage:
924 metapage_exit();
925free_slab:
926 kmem_cache_destroy(jfs_inode_cachep);
927 return rc;
928}
929
930static void __exit exit_jfs_fs(void)
931{
932 int i;
933
934 jfs_info("exit_jfs_fs called");
935
Linus Torvalds1da177e2005-04-16 15:20:36 -0700936 txExit();
937 metapage_exit();
Christoph Hellwig91dbb4d2006-02-15 12:49:04 -0600938
939 kthread_stop(jfsIOthread);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700940 for (i = 0; i < commit_threads; i++)
Christoph Hellwig91dbb4d2006-02-15 12:49:04 -0600941 kthread_stop(jfsCommitThread[i]);
942 kthread_stop(jfsSyncThread);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700943#ifdef PROC_FS_JFS
944 jfs_proc_clean();
945#endif
946 unregister_filesystem(&jfs_fs_type);
947 kmem_cache_destroy(jfs_inode_cachep);
948}
949
950module_init(init_jfs_fs)
951module_exit(exit_jfs_fs)