aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nilfs2/super.c
diff options
context:
space:
mode:
authorRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2011-03-08 21:05:07 -0500
committerRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2011-03-08 21:05:07 -0500
commit3b2ce58b0f3c1633750529713be0e467282abd78 (patch)
tree48c0111adadf00e67933fb5d9883296754fca6ce /fs/nilfs2/super.c
parentbe667377a8b8cd73e1b923f33fb5be4034aa4bfa (diff)
nilfs2: move mount options to nilfs object
This moves mount_opt local variable to nilfs object from nilfs_sb_info struct. Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Diffstat (limited to 'fs/nilfs2/super.c')
-rw-r--r--fs/nilfs2/super.c56
1 files changed, 29 insertions, 27 deletions
diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c
index 1673b3d99842..0576cb21d699 100644
--- a/fs/nilfs2/super.c
+++ b/fs/nilfs2/super.c
@@ -109,7 +109,7 @@ static void nilfs_set_error(struct nilfs_sb_info *sbi)
109void nilfs_error(struct super_block *sb, const char *function, 109void nilfs_error(struct super_block *sb, const char *function,
110 const char *fmt, ...) 110 const char *fmt, ...)
111{ 111{
112 struct nilfs_sb_info *sbi = NILFS_SB(sb); 112 struct the_nilfs *nilfs = sbi->s_nilfs;
113 struct va_format vaf; 113 struct va_format vaf;
114 va_list args; 114 va_list args;
115 115
@@ -126,13 +126,13 @@ void nilfs_error(struct super_block *sb, const char *function,
126 if (!(sb->s_flags & MS_RDONLY)) { 126 if (!(sb->s_flags & MS_RDONLY)) {
127 nilfs_set_error(sbi); 127 nilfs_set_error(sbi);
128 128
129 if (nilfs_test_opt(sbi, ERRORS_RO)) { 129 if (nilfs_test_opt(nilfs, ERRORS_RO)) {
130 printk(KERN_CRIT "Remounting filesystem read-only\n"); 130 printk(KERN_CRIT "Remounting filesystem read-only\n");
131 sb->s_flags |= MS_RDONLY; 131 sb->s_flags |= MS_RDONLY;
132 } 132 }
133 } 133 }
134 134
135 if (nilfs_test_opt(sbi, ERRORS_PANIC)) 135 if (nilfs_test_opt(nilfs, ERRORS_PANIC))
136 panic("NILFS (device %s): panic forced after error\n", 136 panic("NILFS (device %s): panic forced after error\n",
137 sb->s_id); 137 sb->s_id);
138} 138}
@@ -196,7 +196,7 @@ static int nilfs_sync_super(struct nilfs_sb_info *sbi, int flag)
196 196
197 retry: 197 retry:
198 set_buffer_dirty(nilfs->ns_sbh[0]); 198 set_buffer_dirty(nilfs->ns_sbh[0]);
199 if (nilfs_test_opt(sbi, BARRIER)) { 199 if (nilfs_test_opt(nilfs, BARRIER)) {
200 err = __sync_dirty_buffer(nilfs->ns_sbh[0], 200 err = __sync_dirty_buffer(nilfs->ns_sbh[0],
201 WRITE_SYNC | WRITE_FLUSH_FUA); 201 WRITE_SYNC | WRITE_FLUSH_FUA);
202 } else { 202 } else {
@@ -530,22 +530,22 @@ static int nilfs_statfs(struct dentry *dentry, struct kstatfs *buf)
530static int nilfs_show_options(struct seq_file *seq, struct vfsmount *vfs) 530static int nilfs_show_options(struct seq_file *seq, struct vfsmount *vfs)
531{ 531{
532 struct super_block *sb = vfs->mnt_sb; 532 struct super_block *sb = vfs->mnt_sb;
533 struct nilfs_sb_info *sbi = NILFS_SB(sb); 533 struct the_nilfs *nilfs = NILFS_SB(sb)->s_nilfs;
534 struct nilfs_root *root = NILFS_I(vfs->mnt_root->d_inode)->i_root; 534 struct nilfs_root *root = NILFS_I(vfs->mnt_root->d_inode)->i_root;
535 535
536 if (!nilfs_test_opt(sbi, BARRIER)) 536 if (!nilfs_test_opt(nilfs, BARRIER))
537 seq_puts(seq, ",nobarrier"); 537 seq_puts(seq, ",nobarrier");
538 if (root->cno != NILFS_CPTREE_CURRENT_CNO) 538 if (root->cno != NILFS_CPTREE_CURRENT_CNO)
539 seq_printf(seq, ",cp=%llu", (unsigned long long)root->cno); 539 seq_printf(seq, ",cp=%llu", (unsigned long long)root->cno);
540 if (nilfs_test_opt(sbi, ERRORS_PANIC)) 540 if (nilfs_test_opt(nilfs, ERRORS_PANIC))
541 seq_puts(seq, ",errors=panic"); 541 seq_puts(seq, ",errors=panic");
542 if (nilfs_test_opt(sbi, ERRORS_CONT)) 542 if (nilfs_test_opt(nilfs, ERRORS_CONT))
543 seq_puts(seq, ",errors=continue"); 543 seq_puts(seq, ",errors=continue");
544 if (nilfs_test_opt(sbi, STRICT_ORDER)) 544 if (nilfs_test_opt(nilfs, STRICT_ORDER))
545 seq_puts(seq, ",order=strict"); 545 seq_puts(seq, ",order=strict");
546 if (nilfs_test_opt(sbi, NORECOVERY)) 546 if (nilfs_test_opt(nilfs, NORECOVERY))
547 seq_puts(seq, ",norecovery"); 547 seq_puts(seq, ",norecovery");
548 if (nilfs_test_opt(sbi, DISCARD)) 548 if (nilfs_test_opt(nilfs, DISCARD))
549 seq_puts(seq, ",discard"); 549 seq_puts(seq, ",discard");
550 550
551 return 0; 551 return 0;
@@ -594,7 +594,7 @@ static match_table_t tokens = {
594 594
595static int parse_options(char *options, struct super_block *sb, int is_remount) 595static int parse_options(char *options, struct super_block *sb, int is_remount)
596{ 596{
597 struct nilfs_sb_info *sbi = NILFS_SB(sb); 597 struct the_nilfs *nilfs = NILFS_SB(sb)->s_nilfs;
598 char *p; 598 char *p;
599 substring_t args[MAX_OPT_ARGS]; 599 substring_t args[MAX_OPT_ARGS];
600 600
@@ -609,29 +609,29 @@ static int parse_options(char *options, struct super_block *sb, int is_remount)
609 token = match_token(p, tokens, args); 609 token = match_token(p, tokens, args);
610 switch (token) { 610 switch (token) {
611 case Opt_barrier: 611 case Opt_barrier:
612 nilfs_set_opt(sbi, BARRIER); 612 nilfs_set_opt(nilfs, BARRIER);
613 break; 613 break;
614 case Opt_nobarrier: 614 case Opt_nobarrier:
615 nilfs_clear_opt(sbi, BARRIER); 615 nilfs_clear_opt(nilfs, BARRIER);
616 break; 616 break;
617 case Opt_order: 617 case Opt_order:
618 if (strcmp(args[0].from, "relaxed") == 0) 618 if (strcmp(args[0].from, "relaxed") == 0)
619 /* Ordered data semantics */ 619 /* Ordered data semantics */
620 nilfs_clear_opt(sbi, STRICT_ORDER); 620 nilfs_clear_opt(nilfs, STRICT_ORDER);
621 else if (strcmp(args[0].from, "strict") == 0) 621 else if (strcmp(args[0].from, "strict") == 0)
622 /* Strict in-order semantics */ 622 /* Strict in-order semantics */
623 nilfs_set_opt(sbi, STRICT_ORDER); 623 nilfs_set_opt(nilfs, STRICT_ORDER);
624 else 624 else
625 return 0; 625 return 0;
626 break; 626 break;
627 case Opt_err_panic: 627 case Opt_err_panic:
628 nilfs_write_opt(sbi, ERROR_MODE, ERRORS_PANIC); 628 nilfs_write_opt(nilfs, ERROR_MODE, ERRORS_PANIC);
629 break; 629 break;
630 case Opt_err_ro: 630 case Opt_err_ro:
631 nilfs_write_opt(sbi, ERROR_MODE, ERRORS_RO); 631 nilfs_write_opt(nilfs, ERROR_MODE, ERRORS_RO);
632 break; 632 break;
633 case Opt_err_cont: 633 case Opt_err_cont:
634 nilfs_write_opt(sbi, ERROR_MODE, ERRORS_CONT); 634 nilfs_write_opt(nilfs, ERROR_MODE, ERRORS_CONT);
635 break; 635 break;
636 case Opt_snapshot: 636 case Opt_snapshot:
637 if (is_remount) { 637 if (is_remount) {
@@ -642,13 +642,13 @@ static int parse_options(char *options, struct super_block *sb, int is_remount)
642 } 642 }
643 break; 643 break;
644 case Opt_norecovery: 644 case Opt_norecovery:
645 nilfs_set_opt(sbi, NORECOVERY); 645 nilfs_set_opt(nilfs, NORECOVERY);
646 break; 646 break;
647 case Opt_discard: 647 case Opt_discard:
648 nilfs_set_opt(sbi, DISCARD); 648 nilfs_set_opt(nilfs, DISCARD);
649 break; 649 break;
650 case Opt_nodiscard: 650 case Opt_nodiscard:
651 nilfs_clear_opt(sbi, DISCARD); 651 nilfs_clear_opt(nilfs, DISCARD);
652 break; 652 break;
653 default: 653 default:
654 printk(KERN_ERR 654 printk(KERN_ERR
@@ -660,10 +660,12 @@ static int parse_options(char *options, struct super_block *sb, int is_remount)
660} 660}
661 661
662static inline void 662static inline void
663nilfs_set_default_options(struct nilfs_sb_info *sbi, 663nilfs_set_default_options(struct super_block *sb,
664 struct nilfs_super_block *sbp) 664 struct nilfs_super_block *sbp)
665{ 665{
666 sbi->s_mount_opt = 666 struct the_nilfs *nilfs = NILFS_SB(sb)->s_nilfs;
667
668 nilfs->ns_mount_opt =
667 NILFS_MOUNT_ERRORS_RO | NILFS_MOUNT_BARRIER; 669 NILFS_MOUNT_ERRORS_RO | NILFS_MOUNT_BARRIER;
668} 670}
669 671
@@ -736,7 +738,7 @@ int nilfs_store_magic_and_option(struct super_block *sb,
736 sb->s_flags |= MS_NOATIME; 738 sb->s_flags |= MS_NOATIME;
737#endif 739#endif
738 740
739 nilfs_set_default_options(sbi, sbp); 741 nilfs_set_default_options(sb, sbp);
740 742
741 sbi->s_resuid = le16_to_cpu(sbp->s_def_resuid); 743 sbi->s_resuid = le16_to_cpu(sbp->s_def_resuid);
742 sbi->s_resgid = le16_to_cpu(sbp->s_def_resgid); 744 sbi->s_resgid = le16_to_cpu(sbp->s_def_resgid);
@@ -1023,7 +1025,7 @@ static int nilfs_remount(struct super_block *sb, int *flags, char *data)
1023 int err; 1025 int err;
1024 1026
1025 old_sb_flags = sb->s_flags; 1027 old_sb_flags = sb->s_flags;
1026 old_mount_opt = sbi->s_mount_opt; 1028 old_mount_opt = nilfs->ns_mount_opt;
1027 1029
1028 if (!parse_options(data, sb, 1)) { 1030 if (!parse_options(data, sb, 1)) {
1029 err = -EINVAL; 1031 err = -EINVAL;
@@ -1092,7 +1094,7 @@ static int nilfs_remount(struct super_block *sb, int *flags, char *data)
1092 1094
1093 restore_opts: 1095 restore_opts:
1094 sb->s_flags = old_sb_flags; 1096 sb->s_flags = old_sb_flags;
1095 sbi->s_mount_opt = old_mount_opt; 1097 nilfs->ns_mount_opt = old_mount_opt;
1096 return err; 1098 return err;
1097} 1099}
1098 1100