diff options
Diffstat (limited to 'fs/reiserfs')
-rw-r--r-- | fs/reiserfs/bitmap.c | 91 | ||||
-rw-r--r-- | fs/reiserfs/super.c | 116 |
2 files changed, 197 insertions, 10 deletions
diff --git a/fs/reiserfs/bitmap.c b/fs/reiserfs/bitmap.c index d1aca1df4f92..a945cd265228 100644 --- a/fs/reiserfs/bitmap.c +++ b/fs/reiserfs/bitmap.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/reiserfs_fs_sb.h> | 13 | #include <linux/reiserfs_fs_sb.h> |
14 | #include <linux/reiserfs_fs_i.h> | 14 | #include <linux/reiserfs_fs_i.h> |
15 | #include <linux/quotaops.h> | 15 | #include <linux/quotaops.h> |
16 | #include <linux/seq_file.h> | ||
16 | 17 | ||
17 | #define PREALLOCATION_SIZE 9 | 18 | #define PREALLOCATION_SIZE 9 |
18 | 19 | ||
@@ -634,6 +635,96 @@ int reiserfs_parse_alloc_options(struct super_block *s, char *options) | |||
634 | return 0; | 635 | return 0; |
635 | } | 636 | } |
636 | 637 | ||
638 | static void print_sep(struct seq_file *seq, int *first) | ||
639 | { | ||
640 | if (!*first) | ||
641 | seq_puts(seq, ":"); | ||
642 | else | ||
643 | *first = 0; | ||
644 | } | ||
645 | |||
646 | void show_alloc_options(struct seq_file *seq, struct super_block *s) | ||
647 | { | ||
648 | int first = 1; | ||
649 | |||
650 | if (SB_ALLOC_OPTS(s) == ((1 << _ALLOC_skip_busy) | | ||
651 | (1 << _ALLOC_dirid_groups) | (1 << _ALLOC_packing_groups))) | ||
652 | return; | ||
653 | |||
654 | seq_puts(seq, ",alloc="); | ||
655 | |||
656 | if (TEST_OPTION(concentrating_formatted_nodes, s)) { | ||
657 | print_sep(seq, &first); | ||
658 | if (REISERFS_SB(s)->s_alloc_options.border != 10) { | ||
659 | seq_printf(seq, "concentrating_formatted_nodes=%d", | ||
660 | 100 / REISERFS_SB(s)->s_alloc_options.border); | ||
661 | } else | ||
662 | seq_puts(seq, "concentrating_formatted_nodes"); | ||
663 | } | ||
664 | if (TEST_OPTION(displacing_large_files, s)) { | ||
665 | print_sep(seq, &first); | ||
666 | if (REISERFS_SB(s)->s_alloc_options.large_file_size != 16) { | ||
667 | seq_printf(seq, "displacing_large_files=%lu", | ||
668 | REISERFS_SB(s)->s_alloc_options.large_file_size); | ||
669 | } else | ||
670 | seq_puts(seq, "displacing_large_files"); | ||
671 | } | ||
672 | if (TEST_OPTION(displacing_new_packing_localities, s)) { | ||
673 | print_sep(seq, &first); | ||
674 | seq_puts(seq, "displacing_new_packing_localities"); | ||
675 | } | ||
676 | if (TEST_OPTION(old_hashed_relocation, s)) { | ||
677 | print_sep(seq, &first); | ||
678 | seq_puts(seq, "old_hashed_relocation"); | ||
679 | } | ||
680 | if (TEST_OPTION(new_hashed_relocation, s)) { | ||
681 | print_sep(seq, &first); | ||
682 | seq_puts(seq, "new_hashed_relocation"); | ||
683 | } | ||
684 | if (TEST_OPTION(dirid_groups, s)) { | ||
685 | print_sep(seq, &first); | ||
686 | seq_puts(seq, "dirid_groups"); | ||
687 | } | ||
688 | if (TEST_OPTION(oid_groups, s)) { | ||
689 | print_sep(seq, &first); | ||
690 | seq_puts(seq, "oid_groups"); | ||
691 | } | ||
692 | if (TEST_OPTION(packing_groups, s)) { | ||
693 | print_sep(seq, &first); | ||
694 | seq_puts(seq, "packing_groups"); | ||
695 | } | ||
696 | if (TEST_OPTION(hashed_formatted_nodes, s)) { | ||
697 | print_sep(seq, &first); | ||
698 | seq_puts(seq, "hashed_formatted_nodes"); | ||
699 | } | ||
700 | if (TEST_OPTION(skip_busy, s)) { | ||
701 | print_sep(seq, &first); | ||
702 | seq_puts(seq, "skip_busy"); | ||
703 | } | ||
704 | if (TEST_OPTION(hundredth_slices, s)) { | ||
705 | print_sep(seq, &first); | ||
706 | seq_puts(seq, "hundredth_slices"); | ||
707 | } | ||
708 | if (TEST_OPTION(old_way, s)) { | ||
709 | print_sep(seq, &first); | ||
710 | seq_puts(seq, "old_way"); | ||
711 | } | ||
712 | if (TEST_OPTION(displace_based_on_dirid, s)) { | ||
713 | print_sep(seq, &first); | ||
714 | seq_puts(seq, "displace_based_on_dirid"); | ||
715 | } | ||
716 | if (REISERFS_SB(s)->s_alloc_options.preallocmin != 0) { | ||
717 | print_sep(seq, &first); | ||
718 | seq_printf(seq, "preallocmin=%d", | ||
719 | REISERFS_SB(s)->s_alloc_options.preallocmin); | ||
720 | } | ||
721 | if (REISERFS_SB(s)->s_alloc_options.preallocsize != 17) { | ||
722 | print_sep(seq, &first); | ||
723 | seq_printf(seq, "preallocsize=%d", | ||
724 | REISERFS_SB(s)->s_alloc_options.preallocsize); | ||
725 | } | ||
726 | } | ||
727 | |||
637 | static inline void new_hashed_relocation(reiserfs_blocknr_hint_t * hint) | 728 | static inline void new_hashed_relocation(reiserfs_blocknr_hint_t * hint) |
638 | { | 729 | { |
639 | char *hash_in; | 730 | char *hash_in; |
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index 1abffa451529..19c454e61b79 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 | ||
32 | struct file_system_type reiserfs_fs_type; | 33 | struct 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 | ||
62 | static int reiserfs_remount(struct super_block *s, int *flags, char *data); | 63 | static int reiserfs_remount(struct super_block *s, int *flags, char *data); |
63 | static int reiserfs_statfs(struct dentry *dentry, struct kstatfs *buf); | 64 | static int reiserfs_statfs(struct dentry *dentry, struct kstatfs *buf); |
65 | void show_alloc_options(struct seq_file *seq, struct super_block *s); | ||
64 | 66 | ||
65 | static int reiserfs_sync_fs(struct super_block *s, int wait) | 67 | static 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 | ||
601 | static 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 |
600 | static ssize_t reiserfs_quota_write(struct super_block *, int, const char *, | 678 | static 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? */ |