aboutsummaryrefslogtreecommitdiffstats
path: root/fs/reiserfs/super.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2011-12-21 14:17:10 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2012-01-06 23:20:13 -0500
commitc3aa077648e147783a7a53b409578234647db853 (patch)
tree6ad21f0a005080a1a89bcd736454bc32f0cffab4 /fs/reiserfs/super.c
parent8e8b87964bc8dc5c14b6543fc933b7725f07d3ac (diff)
reiserfs: Properly display mount options in /proc/mounts
Make reiserfs properly display mount options in /proc/mounts. CC: reiserfs-devel@vger.kernel.org Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/reiserfs/super.c')
-rw-r--r--fs/reiserfs/super.c116
1 files changed, 106 insertions, 10 deletions
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index 1abffa45152..19c454e61b7 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -28,6 +28,7 @@
28#include <linux/mount.h> 28#include <linux/mount.h>
29#include <linux/namei.h> 29#include <linux/namei.h>
30#include <linux/crc32.h> 30#include <linux/crc32.h>
31#include <linux/seq_file.h>
31 32
32struct file_system_type reiserfs_fs_type; 33struct file_system_type reiserfs_fs_type;
33 34
@@ -61,6 +62,7 @@ static int is_any_reiserfs_magic_string(struct reiserfs_super_block *rs)
61 62
62static int reiserfs_remount(struct super_block *s, int *flags, char *data); 63static int reiserfs_remount(struct super_block *s, int *flags, char *data);
63static int reiserfs_statfs(struct dentry *dentry, struct kstatfs *buf); 64static int reiserfs_statfs(struct dentry *dentry, struct kstatfs *buf);
65void show_alloc_options(struct seq_file *seq, struct super_block *s);
64 66
65static int reiserfs_sync_fs(struct super_block *s, int wait) 67static int reiserfs_sync_fs(struct super_block *s, int wait)
66{ 68{
@@ -596,6 +598,82 @@ out:
596 reiserfs_write_unlock_once(inode->i_sb, lock_depth); 598 reiserfs_write_unlock_once(inode->i_sb, lock_depth);
597} 599}
598 600
601static int reiserfs_show_options(struct seq_file *seq, struct dentry *root)
602{
603 struct super_block *s = root->d_sb;
604 struct reiserfs_journal *journal = SB_JOURNAL(s);
605 long opts = REISERFS_SB(s)->s_mount_opt;
606
607 if (opts & (1 << REISERFS_LARGETAIL))
608 seq_puts(seq, ",tails=on");
609 else if (!(opts & (1 << REISERFS_SMALLTAIL)))
610 seq_puts(seq, ",notail");
611 /* tails=small is default so we don't show it */
612
613 if (!(opts & (1 << REISERFS_BARRIER_FLUSH)))
614 seq_puts(seq, ",barrier=none");
615 /* barrier=flush is default so we don't show it */
616
617 if (opts & (1 << REISERFS_ERROR_CONTINUE))
618 seq_puts(seq, ",errors=continue");
619 else if (opts & (1 << REISERFS_ERROR_PANIC))
620 seq_puts(seq, ",errors=panic");
621 /* errors=ro is default so we don't show it */
622
623 if (opts & (1 << REISERFS_DATA_LOG))
624 seq_puts(seq, ",data=journal");
625 else if (opts & (1 << REISERFS_DATA_WRITEBACK))
626 seq_puts(seq, ",data=writeback");
627 /* data=ordered is default so we don't show it */
628
629 if (opts & (1 << REISERFS_ATTRS))
630 seq_puts(seq, ",attrs");
631
632 if (opts & (1 << REISERFS_XATTRS_USER))
633 seq_puts(seq, ",user_xattr");
634
635 if (opts & (1 << REISERFS_EXPOSE_PRIVROOT))
636 seq_puts(seq, ",expose_privroot");
637
638 if (opts & (1 << REISERFS_POSIXACL))
639 seq_puts(seq, ",acl");
640
641 if (REISERFS_SB(s)->s_jdev)
642 seq_printf(seq, ",jdev=%s", REISERFS_SB(s)->s_jdev);
643
644 if (journal->j_max_commit_age != journal->j_default_max_commit_age)
645 seq_printf(seq, ",commit=%d", journal->j_max_commit_age);
646
647#ifdef CONFIG_QUOTA
648 if (REISERFS_SB(s)->s_qf_names[USRQUOTA])
649 seq_printf(seq, ",usrjquota=%s", REISERFS_SB(s)->s_qf_names[USRQUOTA]);
650 else if (opts & (1 << REISERFS_USRQUOTA))
651 seq_puts(seq, ",usrquota");
652 if (REISERFS_SB(s)->s_qf_names[GRPQUOTA])
653 seq_printf(seq, ",grpjquota=%s", REISERFS_SB(s)->s_qf_names[GRPQUOTA]);
654 else if (opts & (1 << REISERFS_GRPQUOTA))
655 seq_puts(seq, ",grpquota");
656 if (REISERFS_SB(s)->s_jquota_fmt) {
657 if (REISERFS_SB(s)->s_jquota_fmt == QFMT_VFS_OLD)
658 seq_puts(seq, ",jqfmt=vfsold");
659 else if (REISERFS_SB(s)->s_jquota_fmt == QFMT_VFS_V0)
660 seq_puts(seq, ",jqfmt=vfsv0");
661 }
662#endif
663
664 /* Block allocator options */
665 if (opts & (1 << REISERFS_NO_BORDER))
666 seq_puts(seq, ",block-allocator=noborder");
667 if (opts & (1 << REISERFS_NO_UNHASHED_RELOCATION))
668 seq_puts(seq, ",block-allocator=no_unhashed_relocation");
669 if (opts & (1 << REISERFS_HASHED_RELOCATION))
670 seq_puts(seq, ",block-allocator=hashed_relocation");
671 if (opts & (1 << REISERFS_TEST4))
672 seq_puts(seq, ",block-allocator=test4");
673 show_alloc_options(seq, s);
674 return 0;
675}
676
599#ifdef CONFIG_QUOTA 677#ifdef CONFIG_QUOTA
600static ssize_t reiserfs_quota_write(struct super_block *, int, const char *, 678static ssize_t reiserfs_quota_write(struct super_block *, int, const char *,
601 size_t, loff_t); 679 size_t, loff_t);
@@ -616,7 +694,7 @@ static const struct super_operations reiserfs_sops = {
616 .unfreeze_fs = reiserfs_unfreeze, 694 .unfreeze_fs = reiserfs_unfreeze,
617 .statfs = reiserfs_statfs, 695 .statfs = reiserfs_statfs,
618 .remount_fs = reiserfs_remount, 696 .remount_fs = reiserfs_remount,
619 .show_options = generic_show_options, 697 .show_options = reiserfs_show_options,
620#ifdef CONFIG_QUOTA 698#ifdef CONFIG_QUOTA
621 .quota_read = reiserfs_quota_read, 699 .quota_read = reiserfs_quota_read,
622 .quota_write = reiserfs_quota_write, 700 .quota_write = reiserfs_quota_write,
@@ -914,9 +992,9 @@ static int reiserfs_parse_options(struct super_block *s, char *options, /* strin
914 {"jdev",.arg_required = 'j',.values = NULL}, 992 {"jdev",.arg_required = 'j',.values = NULL},
915 {"nolargeio",.arg_required = 'w',.values = NULL}, 993 {"nolargeio",.arg_required = 'w',.values = NULL},
916 {"commit",.arg_required = 'c',.values = NULL}, 994 {"commit",.arg_required = 'c',.values = NULL},
917 {"usrquota",.setmask = 1 << REISERFS_QUOTA}, 995 {"usrquota",.setmask = 1 << REISERFS_USRQUOTA},
918 {"grpquota",.setmask = 1 << REISERFS_QUOTA}, 996 {"grpquota",.setmask = 1 << REISERFS_GRPQUOTA},
919 {"noquota",.clrmask = 1 << REISERFS_QUOTA}, 997 {"noquota",.clrmask = 1 << REISERFS_USRQUOTA | 1 << REISERFS_GRPQUOTA},
920 {"errors",.arg_required = 'e',.values = error_actions}, 998 {"errors",.arg_required = 'e',.values = error_actions},
921 {"usrjquota",.arg_required = 999 {"usrjquota",.arg_required =
922 'u' | (1 << REISERFS_OPT_ALLOWEMPTY),.values = NULL}, 1000 'u' | (1 << REISERFS_OPT_ALLOWEMPTY),.values = NULL},
@@ -1030,12 +1108,19 @@ static int reiserfs_parse_options(struct super_block *s, char *options, /* strin
1030 return 0; 1108 return 0;
1031 } 1109 }
1032 strcpy(qf_names[qtype], arg); 1110 strcpy(qf_names[qtype], arg);
1033 *mount_options |= 1 << REISERFS_QUOTA; 1111 if (qtype == USRQUOTA)
1112 *mount_options |= 1 << REISERFS_USRQUOTA;
1113 else
1114 *mount_options |= 1 << REISERFS_GRPQUOTA;
1034 } else { 1115 } else {
1035 if (qf_names[qtype] != 1116 if (qf_names[qtype] !=
1036 REISERFS_SB(s)->s_qf_names[qtype]) 1117 REISERFS_SB(s)->s_qf_names[qtype])
1037 kfree(qf_names[qtype]); 1118 kfree(qf_names[qtype]);
1038 qf_names[qtype] = NULL; 1119 qf_names[qtype] = NULL;
1120 if (qtype == USRQUOTA)
1121 *mount_options &= ~(1 << REISERFS_USRQUOTA);
1122 else
1123 *mount_options &= ~(1 << REISERFS_GRPQUOTA);
1039 } 1124 }
1040 } 1125 }
1041 if (c == 'f') { 1126 if (c == 'f') {
@@ -1074,9 +1159,10 @@ static int reiserfs_parse_options(struct super_block *s, char *options, /* strin
1074 "journaled quota format not specified."); 1159 "journaled quota format not specified.");
1075 return 0; 1160 return 0;
1076 } 1161 }
1077 /* This checking is not precise wrt the quota type but for our purposes it is sufficient */ 1162 if ((!(*mount_options & (1 << REISERFS_USRQUOTA)) &&
1078 if (!(*mount_options & (1 << REISERFS_QUOTA)) 1163 sb_has_quota_loaded(s, USRQUOTA)) ||
1079 && sb_any_quota_loaded(s)) { 1164 (!(*mount_options & (1 << REISERFS_GRPQUOTA)) &&
1165 sb_has_quota_loaded(s, GRPQUOTA))) {
1080 reiserfs_warning(s, "super-6516", "quota options must " 1166 reiserfs_warning(s, "super-6516", "quota options must "
1081 "be present when quota is turned on."); 1167 "be present when quota is turned on.");
1082 return 0; 1168 return 0;
@@ -1224,7 +1310,8 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg)
1224 safe_mask |= 1 << REISERFS_ERROR_RO; 1310 safe_mask |= 1 << REISERFS_ERROR_RO;
1225 safe_mask |= 1 << REISERFS_ERROR_CONTINUE; 1311 safe_mask |= 1 << REISERFS_ERROR_CONTINUE;
1226 safe_mask |= 1 << REISERFS_ERROR_PANIC; 1312 safe_mask |= 1 << REISERFS_ERROR_PANIC;
1227 safe_mask |= 1 << REISERFS_QUOTA; 1313 safe_mask |= 1 << REISERFS_USRQUOTA;
1314 safe_mask |= 1 << REISERFS_GRPQUOTA;
1228 1315
1229 /* Update the bitmask, taking care to keep 1316 /* Update the bitmask, taking care to keep
1230 * the bits we're not allowed to change here */ 1317 * the bits we're not allowed to change here */
@@ -1671,6 +1758,14 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
1671 &commit_max_age, qf_names, &qfmt) == 0) { 1758 &commit_max_age, qf_names, &qfmt) == 0) {
1672 goto error; 1759 goto error;
1673 } 1760 }
1761 if (jdev_name && jdev_name[0]) {
1762 REISERFS_SB(s)->s_jdev = kstrdup(jdev_name, GFP_KERNEL);
1763 if (!REISERFS_SB(s)->s_jdev) {
1764 SWARN(silent, s, "", "Cannot allocate memory for "
1765 "journal device name");
1766 goto error;
1767 }
1768 }
1674#ifdef CONFIG_QUOTA 1769#ifdef CONFIG_QUOTA
1675 handle_quota_files(s, qf_names, &qfmt); 1770 handle_quota_files(s, qf_names, &qfmt);
1676#endif 1771#endif
@@ -2053,8 +2148,9 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id,
2053 int err; 2148 int err;
2054 struct inode *inode; 2149 struct inode *inode;
2055 struct reiserfs_transaction_handle th; 2150 struct reiserfs_transaction_handle th;
2151 int opt = type == USRQUOTA ? REISERFS_USRQUOTA : REISERFS_GRPQUOTA;
2056 2152
2057 if (!(REISERFS_SB(sb)->s_mount_opt & (1 << REISERFS_QUOTA))) 2153 if (!(REISERFS_SB(sb)->s_mount_opt & (1 << opt)))
2058 return -EINVAL; 2154 return -EINVAL;
2059 2155
2060 /* Quotafile not on the same filesystem? */ 2156 /* Quotafile not on the same filesystem? */