aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jfs/super.c
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
commit8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch)
treea8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /fs/jfs/super.c
parent406089d01562f1e2bf9f089fd7637009ebaad589 (diff)
Patched in Tegra support.
Diffstat (limited to 'fs/jfs/super.c')
-rw-r--r--fs/jfs/super.c122
1 files changed, 29 insertions, 93 deletions
diff --git a/fs/jfs/super.c b/fs/jfs/super.c
index 1a543be09c7..06c8a67cbe7 100644
--- a/fs/jfs/super.c
+++ b/fs/jfs/super.c
@@ -33,7 +33,6 @@
33#include <linux/slab.h> 33#include <linux/slab.h>
34#include <asm/uaccess.h> 34#include <asm/uaccess.h>
35#include <linux/seq_file.h> 35#include <linux/seq_file.h>
36#include <linux/blkdev.h>
37 36
38#include "jfs_incore.h" 37#include "jfs_incore.h"
39#include "jfs_filsys.h" 38#include "jfs_filsys.h"
@@ -101,7 +100,7 @@ void jfs_error(struct super_block *sb, const char * function, ...)
101 vsnprintf(error_buf, sizeof(error_buf), function, args); 100 vsnprintf(error_buf, sizeof(error_buf), function, args);
102 va_end(args); 101 va_end(args);
103 102
104 pr_err("ERROR: (device %s): %s\n", sb->s_id, error_buf); 103 printk(KERN_ERR "ERROR: (device %s): %s\n", sb->s_id, error_buf);
105 104
106 jfs_handle_error(sb); 105 jfs_handle_error(sb);
107} 106}
@@ -120,6 +119,7 @@ static void jfs_i_callback(struct rcu_head *head)
120{ 119{
121 struct inode *inode = container_of(head, struct inode, i_rcu); 120 struct inode *inode = container_of(head, struct inode, i_rcu);
122 struct jfs_inode_info *ji = JFS_IP(inode); 121 struct jfs_inode_info *ji = JFS_IP(inode);
122 INIT_LIST_HEAD(&inode->i_dentry);
123 kmem_cache_free(jfs_inode_cachep, ji); 123 kmem_cache_free(jfs_inode_cachep, ji);
124} 124}
125 125
@@ -198,8 +198,7 @@ static void jfs_put_super(struct super_block *sb)
198enum { 198enum {
199 Opt_integrity, Opt_nointegrity, Opt_iocharset, Opt_resize, 199 Opt_integrity, Opt_nointegrity, Opt_iocharset, Opt_resize,
200 Opt_resize_nosize, Opt_errors, Opt_ignore, Opt_err, Opt_quota, 200 Opt_resize_nosize, Opt_errors, Opt_ignore, Opt_err, Opt_quota,
201 Opt_usrquota, Opt_grpquota, Opt_uid, Opt_gid, Opt_umask, 201 Opt_usrquota, Opt_grpquota, Opt_uid, Opt_gid, Opt_umask
202 Opt_discard, Opt_nodiscard, Opt_discard_minblk
203}; 202};
204 203
205static const match_table_t tokens = { 204static const match_table_t tokens = {
@@ -216,9 +215,6 @@ static const match_table_t tokens = {
216 {Opt_uid, "uid=%u"}, 215 {Opt_uid, "uid=%u"},
217 {Opt_gid, "gid=%u"}, 216 {Opt_gid, "gid=%u"},
218 {Opt_umask, "umask=%u"}, 217 {Opt_umask, "umask=%u"},
219 {Opt_discard, "discard"},
220 {Opt_nodiscard, "nodiscard"},
221 {Opt_discard_minblk, "discard=%u"},
222 {Opt_err, NULL} 218 {Opt_err, NULL}
223}; 219};
224 220
@@ -260,7 +256,8 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize,
260 else { 256 else {
261 nls_map = load_nls(args[0].from); 257 nls_map = load_nls(args[0].from);
262 if (!nls_map) { 258 if (!nls_map) {
263 pr_err("JFS: charset not found\n"); 259 printk(KERN_ERR
260 "JFS: charset not found\n");
264 goto cleanup; 261 goto cleanup;
265 } 262 }
266 } 263 }
@@ -276,7 +273,8 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize,
276 *newLVSize = sb->s_bdev->bd_inode->i_size >> 273 *newLVSize = sb->s_bdev->bd_inode->i_size >>
277 sb->s_blocksize_bits; 274 sb->s_blocksize_bits;
278 if (*newLVSize == 0) 275 if (*newLVSize == 0)
279 pr_err("JFS: Cannot determine volume size\n"); 276 printk(KERN_ERR
277 "JFS: Cannot determine volume size\n");
280 break; 278 break;
281 } 279 }
282 case Opt_errors: 280 case Opt_errors:
@@ -297,7 +295,8 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize,
297 *flag &= ~JFS_ERR_REMOUNT_RO; 295 *flag &= ~JFS_ERR_REMOUNT_RO;
298 *flag |= JFS_ERR_PANIC; 296 *flag |= JFS_ERR_PANIC;
299 } else { 297 } else {
300 pr_err("JFS: %s is an invalid error handler\n", 298 printk(KERN_ERR
299 "JFS: %s is an invalid error handler\n",
301 errors); 300 errors);
302 goto cleanup; 301 goto cleanup;
303 } 302 }
@@ -316,76 +315,33 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize,
316 case Opt_usrquota: 315 case Opt_usrquota:
317 case Opt_grpquota: 316 case Opt_grpquota:
318 case Opt_quota: 317 case Opt_quota:
319 pr_err("JFS: quota operations not supported\n"); 318 printk(KERN_ERR
319 "JFS: quota operations not supported\n");
320 break; 320 break;
321#endif 321#endif
322 case Opt_uid: 322 case Opt_uid:
323 { 323 {
324 char *uid = args[0].from; 324 char *uid = args[0].from;
325 uid_t val = simple_strtoul(uid, &uid, 0); 325 sbi->uid = simple_strtoul(uid, &uid, 0);
326 sbi->uid = make_kuid(current_user_ns(), val);
327 if (!uid_valid(sbi->uid))
328 goto cleanup;
329 break; 326 break;
330 } 327 }
331
332 case Opt_gid: 328 case Opt_gid:
333 { 329 {
334 char *gid = args[0].from; 330 char *gid = args[0].from;
335 gid_t val = simple_strtoul(gid, &gid, 0); 331 sbi->gid = simple_strtoul(gid, &gid, 0);
336 sbi->gid = make_kgid(current_user_ns(), val);
337 if (!gid_valid(sbi->gid))
338 goto cleanup;
339 break; 332 break;
340 } 333 }
341
342 case Opt_umask: 334 case Opt_umask:
343 { 335 {
344 char *umask = args[0].from; 336 char *umask = args[0].from;
345 sbi->umask = simple_strtoul(umask, &umask, 8); 337 sbi->umask = simple_strtoul(umask, &umask, 8);
346 if (sbi->umask & ~0777) { 338 if (sbi->umask & ~0777) {
347 pr_err("JFS: Invalid value of umask\n"); 339 printk(KERN_ERR
340 "JFS: Invalid value of umask\n");
348 goto cleanup; 341 goto cleanup;
349 } 342 }
350 break; 343 break;
351 } 344 }
352
353 case Opt_discard:
354 {
355 struct request_queue *q = bdev_get_queue(sb->s_bdev);
356 /* if set to 1, even copying files will cause
357 * trimming :O
358 * -> user has more control over the online trimming
359 */
360 sbi->minblks_trim = 64;
361 if (blk_queue_discard(q)) {
362 *flag |= JFS_DISCARD;
363 } else {
364 pr_err("JFS: discard option " \
365 "not supported on device\n");
366 }
367 break;
368 }
369
370 case Opt_nodiscard:
371 *flag &= ~JFS_DISCARD;
372 break;
373
374 case Opt_discard_minblk:
375 {
376 struct request_queue *q = bdev_get_queue(sb->s_bdev);
377 char *minblks_trim = args[0].from;
378 if (blk_queue_discard(q)) {
379 *flag |= JFS_DISCARD;
380 sbi->minblks_trim = simple_strtoull(
381 minblks_trim, &minblks_trim, 0);
382 } else {
383 pr_err("JFS: discard option " \
384 "not supported on device\n");
385 }
386 break;
387 }
388
389 default: 345 default:
390 printk("jfs: Unrecognized mount option \"%s\" " 346 printk("jfs: Unrecognized mount option \"%s\" "
391 " or missing value\n", p); 347 " or missing value\n", p);
@@ -419,8 +375,8 @@ static int jfs_remount(struct super_block *sb, int *flags, char *data)
419 375
420 if (newLVSize) { 376 if (newLVSize) {
421 if (sb->s_flags & MS_RDONLY) { 377 if (sb->s_flags & MS_RDONLY) {
422 pr_err("JFS: resize requires volume" \ 378 printk(KERN_ERR
423 " to be mounted read-write\n"); 379 "JFS: resize requires volume to be mounted read-write\n");
424 return -EROFS; 380 return -EROFS;
425 } 381 }
426 rc = jfs_extendfs(sb, newLVSize, 0); 382 rc = jfs_extendfs(sb, newLVSize, 0);
@@ -486,11 +442,8 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
486 return -ENOMEM; 442 return -ENOMEM;
487 443
488 sb->s_fs_info = sbi; 444 sb->s_fs_info = sbi;
489 sb->s_max_links = JFS_LINK_MAX;
490 sbi->sb = sb; 445 sbi->sb = sb;
491 sbi->uid = INVALID_UID; 446 sbi->uid = sbi->gid = sbi->umask = -1;
492 sbi->gid = INVALID_GID;
493 sbi->umask = -1;
494 447
495 /* initialize the mount flag and determine the default error handler */ 448 /* initialize the mount flag and determine the default error handler */
496 flag = JFS_ERR_REMOUNT_RO; 449 flag = JFS_ERR_REMOUNT_RO;
@@ -504,7 +457,7 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
504#endif 457#endif
505 458
506 if (newLVSize) { 459 if (newLVSize) {
507 pr_err("resize option for remount only\n"); 460 printk(KERN_ERR "resize option for remount only\n");
508 goto out_kfree; 461 goto out_kfree;
509 } 462 }
510 463
@@ -532,6 +485,7 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
532 goto out_unload; 485 goto out_unload;
533 } 486 }
534 inode->i_ino = 0; 487 inode->i_ino = 0;
488 inode->i_nlink = 1;
535 inode->i_size = sb->s_bdev->bd_inode->i_size; 489 inode->i_size = sb->s_bdev->bd_inode->i_size;
536 inode->i_mapping->a_ops = &jfs_metapage_aops; 490 inode->i_mapping->a_ops = &jfs_metapage_aops;
537 insert_inode_hash(inode); 491 insert_inode_hash(inode);
@@ -569,7 +523,7 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
569 ret = PTR_ERR(inode); 523 ret = PTR_ERR(inode);
570 goto out_no_rw; 524 goto out_no_rw;
571 } 525 }
572 sb->s_root = d_make_root(inode); 526 sb->s_root = d_alloc_root(inode);
573 if (!sb->s_root) 527 if (!sb->s_root)
574 goto out_no_root; 528 goto out_no_root;
575 529
@@ -587,6 +541,7 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
587 541
588out_no_root: 542out_no_root:
589 jfs_err("jfs_read_super: get root dentry failed"); 543 jfs_err("jfs_read_super: get root dentry failed");
544 iput(inode);
590 545
591out_no_rw: 546out_no_rw:
592 rc = jfs_umount(sb); 547 rc = jfs_umount(sb);
@@ -648,11 +603,6 @@ static int jfs_sync_fs(struct super_block *sb, int wait)
648 603
649 /* log == NULL indicates read-only mount */ 604 /* log == NULL indicates read-only mount */
650 if (log) { 605 if (log) {
651 /*
652 * Write quota structures to quota file, sync_blockdev() will
653 * write them to disk later
654 */
655 dquot_writeback_dquots(sb, -1);
656 jfs_flush_journal(log, wait); 606 jfs_flush_journal(log, wait);
657 jfs_syncpt(log, 0); 607 jfs_syncpt(log, 0);
658 } 608 }
@@ -660,20 +610,18 @@ static int jfs_sync_fs(struct super_block *sb, int wait)
660 return 0; 610 return 0;
661} 611}
662 612
663static int jfs_show_options(struct seq_file *seq, struct dentry *root) 613static int jfs_show_options(struct seq_file *seq, struct vfsmount *vfs)
664{ 614{
665 struct jfs_sb_info *sbi = JFS_SBI(root->d_sb); 615 struct jfs_sb_info *sbi = JFS_SBI(vfs->mnt_sb);
666 616
667 if (uid_valid(sbi->uid)) 617 if (sbi->uid != -1)
668 seq_printf(seq, ",uid=%d", from_kuid(&init_user_ns, sbi->uid)); 618 seq_printf(seq, ",uid=%d", sbi->uid);
669 if (gid_valid(sbi->gid)) 619 if (sbi->gid != -1)
670 seq_printf(seq, ",gid=%d", from_kgid(&init_user_ns, sbi->gid)); 620 seq_printf(seq, ",gid=%d", sbi->gid);
671 if (sbi->umask != -1) 621 if (sbi->umask != -1)
672 seq_printf(seq, ",umask=%03o", sbi->umask); 622 seq_printf(seq, ",umask=%03o", sbi->umask);
673 if (sbi->flag & JFS_NOINTEGRITY) 623 if (sbi->flag & JFS_NOINTEGRITY)
674 seq_puts(seq, ",nointegrity"); 624 seq_puts(seq, ",nointegrity");
675 if (sbi->flag & JFS_DISCARD)
676 seq_printf(seq, ",discard=%u", sbi->minblks_trim);
677 if (sbi->nls_tab) 625 if (sbi->nls_tab)
678 seq_printf(seq, ",iocharset=%s", sbi->nls_tab->charset); 626 seq_printf(seq, ",iocharset=%s", sbi->nls_tab->charset);
679 if (sbi->flag & JFS_ERR_CONTINUE) 627 if (sbi->flag & JFS_ERR_CONTINUE)
@@ -914,14 +862,8 @@ static int __init init_jfs_fs(void)
914 jfs_proc_init(); 862 jfs_proc_init();
915#endif 863#endif
916 864
917 rc = register_filesystem(&jfs_fs_type); 865 return register_filesystem(&jfs_fs_type);
918 if (!rc)
919 return 0;
920 866
921#ifdef PROC_FS_JFS
922 jfs_proc_clean();
923#endif
924 kthread_stop(jfsSyncThread);
925kill_committask: 867kill_committask:
926 for (i = 0; i < commit_threads; i++) 868 for (i = 0; i < commit_threads; i++)
927 kthread_stop(jfsCommitThread[i]); 869 kthread_stop(jfsCommitThread[i]);
@@ -952,12 +894,6 @@ static void __exit exit_jfs_fs(void)
952 jfs_proc_clean(); 894 jfs_proc_clean();
953#endif 895#endif
954 unregister_filesystem(&jfs_fs_type); 896 unregister_filesystem(&jfs_fs_type);
955
956 /*
957 * Make sure all delayed rcu free inodes are flushed before we
958 * destroy cache.
959 */
960 rcu_barrier();
961 kmem_cache_destroy(jfs_inode_cachep); 897 kmem_cache_destroy(jfs_inode_cachep);
962} 898}
963 899