aboutsummaryrefslogtreecommitdiffstats
path: root/fs/reiserfs/super.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/reiserfs/super.c')
-rw-r--r--fs/reiserfs/super.c368
1 files changed, 163 insertions, 205 deletions
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index f3c820b75829..0ae6486d9046 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -27,6 +27,7 @@
27#include <linux/mnt_namespace.h> 27#include <linux/mnt_namespace.h>
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 31
31struct file_system_type reiserfs_fs_type; 32struct file_system_type reiserfs_fs_type;
32 33
@@ -183,9 +184,9 @@ static int finish_unfinished(struct super_block *s)
183 if (REISERFS_SB(s)->s_qf_names[i]) { 184 if (REISERFS_SB(s)->s_qf_names[i]) {
184 int ret = reiserfs_quota_on_mount(s, i); 185 int ret = reiserfs_quota_on_mount(s, i);
185 if (ret < 0) 186 if (ret < 0)
186 reiserfs_warning(s, 187 reiserfs_warning(s, "reiserfs-2500",
187 "reiserfs: cannot turn on journaled quota: error %d", 188 "cannot turn on journaled "
188 ret); 189 "quota: error %d", ret);
189 } 190 }
190 } 191 }
191#endif 192#endif
@@ -195,17 +196,16 @@ static int finish_unfinished(struct super_block *s)
195 while (!retval) { 196 while (!retval) {
196 retval = search_item(s, &max_cpu_key, &path); 197 retval = search_item(s, &max_cpu_key, &path);
197 if (retval != ITEM_NOT_FOUND) { 198 if (retval != ITEM_NOT_FOUND) {
198 reiserfs_warning(s, 199 reiserfs_error(s, "vs-2140",
199 "vs-2140: finish_unfinished: search_by_key returned %d", 200 "search_by_key returned %d", retval);
200 retval);
201 break; 201 break;
202 } 202 }
203 203
204 bh = get_last_bh(&path); 204 bh = get_last_bh(&path);
205 item_pos = get_item_pos(&path); 205 item_pos = get_item_pos(&path);
206 if (item_pos != B_NR_ITEMS(bh)) { 206 if (item_pos != B_NR_ITEMS(bh)) {
207 reiserfs_warning(s, 207 reiserfs_warning(s, "vs-2060",
208 "vs-2060: finish_unfinished: wrong position found"); 208 "wrong position found");
209 break; 209 break;
210 } 210 }
211 item_pos--; 211 item_pos--;
@@ -235,8 +235,7 @@ static int finish_unfinished(struct super_block *s)
235 if (!inode) { 235 if (!inode) {
236 /* the unlink almost completed, it just did not manage to remove 236 /* the unlink almost completed, it just did not manage to remove
237 "save" link and release objectid */ 237 "save" link and release objectid */
238 reiserfs_warning(s, 238 reiserfs_warning(s, "vs-2180", "iget failed for %K",
239 "vs-2180: finish_unfinished: iget failed for %K",
240 &obj_key); 239 &obj_key);
241 retval = remove_save_link_only(s, &save_link_key, 1); 240 retval = remove_save_link_only(s, &save_link_key, 1);
242 continue; 241 continue;
@@ -244,21 +243,22 @@ static int finish_unfinished(struct super_block *s)
244 243
245 if (!truncate && inode->i_nlink) { 244 if (!truncate && inode->i_nlink) {
246 /* file is not unlinked */ 245 /* file is not unlinked */
247 reiserfs_warning(s, 246 reiserfs_warning(s, "vs-2185",
248 "vs-2185: finish_unfinished: file %K is not unlinked", 247 "file %K is not unlinked",
249 &obj_key); 248 &obj_key);
250 retval = remove_save_link_only(s, &save_link_key, 0); 249 retval = remove_save_link_only(s, &save_link_key, 0);
251 continue; 250 continue;
252 } 251 }
253 DQUOT_INIT(inode); 252 vfs_dq_init(inode);
254 253
255 if (truncate && S_ISDIR(inode->i_mode)) { 254 if (truncate && S_ISDIR(inode->i_mode)) {
256 /* We got a truncate request for a dir which is impossible. 255 /* We got a truncate request for a dir which is impossible.
257 The only imaginable way is to execute unfinished truncate request 256 The only imaginable way is to execute unfinished truncate request
258 then boot into old kernel, remove the file and create dir with 257 then boot into old kernel, remove the file and create dir with
259 the same key. */ 258 the same key. */
260 reiserfs_warning(s, 259 reiserfs_warning(s, "green-2101",
261 "green-2101: impossible truncate on a directory %k. Please report", 260 "impossible truncate on a "
261 "directory %k. Please report",
262 INODE_PKEY(inode)); 262 INODE_PKEY(inode));
263 retval = remove_save_link_only(s, &save_link_key, 0); 263 retval = remove_save_link_only(s, &save_link_key, 0);
264 truncate = 0; 264 truncate = 0;
@@ -288,9 +288,10 @@ static int finish_unfinished(struct super_block *s)
288 /* removal gets completed in iput */ 288 /* removal gets completed in iput */
289 retval = 0; 289 retval = 0;
290 } else { 290 } else {
291 reiserfs_warning(s, "Dead loop in " 291 reiserfs_warning(s, "super-2189", "Dead loop "
292 "finish_unfinished detected, " 292 "in finish_unfinished "
293 "just remove save link\n"); 293 "detected, just remove "
294 "save link\n");
294 retval = remove_save_link_only(s, 295 retval = remove_save_link_only(s,
295 &save_link_key, 0); 296 &save_link_key, 0);
296 } 297 }
@@ -360,8 +361,9 @@ void add_save_link(struct reiserfs_transaction_handle *th,
360 } else { 361 } else {
361 /* truncate */ 362 /* truncate */
362 if (S_ISDIR(inode->i_mode)) 363 if (S_ISDIR(inode->i_mode))
363 reiserfs_warning(inode->i_sb, 364 reiserfs_warning(inode->i_sb, "green-2102",
364 "green-2102: Adding a truncate savelink for a directory %k! Please report", 365 "Adding a truncate savelink for "
366 "a directory %k! Please report",
365 INODE_PKEY(inode)); 367 INODE_PKEY(inode));
366 set_cpu_key_k_offset(&key, 1); 368 set_cpu_key_k_offset(&key, 1);
367 set_cpu_key_k_type(&key, TYPE_INDIRECT); 369 set_cpu_key_k_type(&key, TYPE_INDIRECT);
@@ -376,9 +378,9 @@ void add_save_link(struct reiserfs_transaction_handle *th,
376 retval = search_item(inode->i_sb, &key, &path); 378 retval = search_item(inode->i_sb, &key, &path);
377 if (retval != ITEM_NOT_FOUND) { 379 if (retval != ITEM_NOT_FOUND) {
378 if (retval != -ENOSPC) 380 if (retval != -ENOSPC)
379 reiserfs_warning(inode->i_sb, "vs-2100: add_save_link:" 381 reiserfs_error(inode->i_sb, "vs-2100",
380 "search_by_key (%K) returned %d", &key, 382 "search_by_key (%K) returned %d", &key,
381 retval); 383 retval);
382 pathrelse(&path); 384 pathrelse(&path);
383 return; 385 return;
384 } 386 }
@@ -391,9 +393,8 @@ void add_save_link(struct reiserfs_transaction_handle *th,
391 reiserfs_insert_item(th, &path, &key, &ih, NULL, (char *)&link); 393 reiserfs_insert_item(th, &path, &key, &ih, NULL, (char *)&link);
392 if (retval) { 394 if (retval) {
393 if (retval != -ENOSPC) 395 if (retval != -ENOSPC)
394 reiserfs_warning(inode->i_sb, 396 reiserfs_error(inode->i_sb, "vs-2120",
395 "vs-2120: add_save_link: insert_item returned %d", 397 "insert_item returned %d", retval);
396 retval);
397 } else { 398 } else {
398 if (truncate) 399 if (truncate)
399 REISERFS_I(inode)->i_flags |= 400 REISERFS_I(inode)->i_flags |=
@@ -492,8 +493,7 @@ static void reiserfs_put_super(struct super_block *s)
492 print_statistics(s); 493 print_statistics(s);
493 494
494 if (REISERFS_SB(s)->reserved_blocks != 0) { 495 if (REISERFS_SB(s)->reserved_blocks != 0) {
495 reiserfs_warning(s, 496 reiserfs_warning(s, "green-2005", "reserved blocks left %d",
496 "green-2005: reiserfs_put_super: reserved blocks left %d",
497 REISERFS_SB(s)->reserved_blocks); 497 REISERFS_SB(s)->reserved_blocks);
498 } 498 }
499 499
@@ -559,8 +559,8 @@ static void reiserfs_dirty_inode(struct inode *inode)
559 559
560 int err = 0; 560 int err = 0;
561 if (inode->i_sb->s_flags & MS_RDONLY) { 561 if (inode->i_sb->s_flags & MS_RDONLY) {
562 reiserfs_warning(inode->i_sb, 562 reiserfs_warning(inode->i_sb, "clm-6006",
563 "clm-6006: writing inode %lu on readonly FS", 563 "writing inode %lu on readonly FS",
564 inode->i_ino); 564 inode->i_ino);
565 return; 565 return;
566 } 566 }
@@ -629,8 +629,6 @@ static const struct super_operations reiserfs_sops = {
629#ifdef CONFIG_QUOTA 629#ifdef CONFIG_QUOTA
630#define QTYPE2NAME(t) ((t)==USRQUOTA?"user":"group") 630#define QTYPE2NAME(t) ((t)==USRQUOTA?"user":"group")
631 631
632static int reiserfs_dquot_initialize(struct inode *, int);
633static int reiserfs_dquot_drop(struct inode *);
634static int reiserfs_write_dquot(struct dquot *); 632static int reiserfs_write_dquot(struct dquot *);
635static int reiserfs_acquire_dquot(struct dquot *); 633static int reiserfs_acquire_dquot(struct dquot *);
636static int reiserfs_release_dquot(struct dquot *); 634static int reiserfs_release_dquot(struct dquot *);
@@ -639,8 +637,8 @@ static int reiserfs_write_info(struct super_block *, int);
639static int reiserfs_quota_on(struct super_block *, int, int, char *, int); 637static int reiserfs_quota_on(struct super_block *, int, int, char *, int);
640 638
641static struct dquot_operations reiserfs_quota_operations = { 639static struct dquot_operations reiserfs_quota_operations = {
642 .initialize = reiserfs_dquot_initialize, 640 .initialize = dquot_initialize,
643 .drop = reiserfs_dquot_drop, 641 .drop = dquot_drop,
644 .alloc_space = dquot_alloc_space, 642 .alloc_space = dquot_alloc_space,
645 .alloc_inode = dquot_alloc_inode, 643 .alloc_inode = dquot_alloc_inode,
646 .free_space = dquot_free_space, 644 .free_space = dquot_free_space,
@@ -759,7 +757,7 @@ static int reiserfs_getopt(struct super_block *s, char **cur, opt_desc_t * opts,
759 char **opt_arg, unsigned long *bit_flags) 757 char **opt_arg, unsigned long *bit_flags)
760{ 758{
761 char *p; 759 char *p;
762 /* foo=bar, 760 /* foo=bar,
763 ^ ^ ^ 761 ^ ^ ^
764 | | +-- option_end 762 | | +-- option_end
765 | +-- arg_start 763 | +-- arg_start
@@ -794,13 +792,15 @@ static int reiserfs_getopt(struct super_block *s, char **cur, opt_desc_t * opts,
794 if (bit_flags) { 792 if (bit_flags) {
795 if (opt->clrmask == 793 if (opt->clrmask ==
796 (1 << REISERFS_UNSUPPORTED_OPT)) 794 (1 << REISERFS_UNSUPPORTED_OPT))
797 reiserfs_warning(s, "%s not supported.", 795 reiserfs_warning(s, "super-6500",
796 "%s not supported.\n",
798 p); 797 p);
799 else 798 else
800 *bit_flags &= ~opt->clrmask; 799 *bit_flags &= ~opt->clrmask;
801 if (opt->setmask == 800 if (opt->setmask ==
802 (1 << REISERFS_UNSUPPORTED_OPT)) 801 (1 << REISERFS_UNSUPPORTED_OPT))
803 reiserfs_warning(s, "%s not supported.", 802 reiserfs_warning(s, "super-6501",
803 "%s not supported.\n",
804 p); 804 p);
805 else 805 else
806 *bit_flags |= opt->setmask; 806 *bit_flags |= opt->setmask;
@@ -809,7 +809,8 @@ static int reiserfs_getopt(struct super_block *s, char **cur, opt_desc_t * opts,
809 } 809 }
810 } 810 }
811 if (!opt->option_name) { 811 if (!opt->option_name) {
812 reiserfs_warning(s, "unknown mount option \"%s\"", p); 812 reiserfs_warning(s, "super-6502",
813 "unknown mount option \"%s\"", p);
813 return -1; 814 return -1;
814 } 815 }
815 816
@@ -817,8 +818,9 @@ static int reiserfs_getopt(struct super_block *s, char **cur, opt_desc_t * opts,
817 switch (*p) { 818 switch (*p) {
818 case '=': 819 case '=':
819 if (!opt->arg_required) { 820 if (!opt->arg_required) {
820 reiserfs_warning(s, 821 reiserfs_warning(s, "super-6503",
821 "the option \"%s\" does not require an argument", 822 "the option \"%s\" does not "
823 "require an argument\n",
822 opt->option_name); 824 opt->option_name);
823 return -1; 825 return -1;
824 } 826 }
@@ -826,14 +828,15 @@ static int reiserfs_getopt(struct super_block *s, char **cur, opt_desc_t * opts,
826 828
827 case 0: 829 case 0:
828 if (opt->arg_required) { 830 if (opt->arg_required) {
829 reiserfs_warning(s, 831 reiserfs_warning(s, "super-6504",
830 "the option \"%s\" requires an argument", 832 "the option \"%s\" requires an "
831 opt->option_name); 833 "argument\n", opt->option_name);
832 return -1; 834 return -1;
833 } 835 }
834 break; 836 break;
835 default: 837 default:
836 reiserfs_warning(s, "head of option \"%s\" is only correct", 838 reiserfs_warning(s, "super-6505",
839 "head of option \"%s\" is only correct\n",
837 opt->option_name); 840 opt->option_name);
838 return -1; 841 return -1;
839 } 842 }
@@ -845,7 +848,8 @@ static int reiserfs_getopt(struct super_block *s, char **cur, opt_desc_t * opts,
845 && !(opt->arg_required & (1 << REISERFS_OPT_ALLOWEMPTY)) 848 && !(opt->arg_required & (1 << REISERFS_OPT_ALLOWEMPTY))
846 && !strlen(p)) { 849 && !strlen(p)) {
847 /* this catches "option=," if not allowed */ 850 /* this catches "option=," if not allowed */
848 reiserfs_warning(s, "empty argument for \"%s\"", 851 reiserfs_warning(s, "super-6506",
852 "empty argument for \"%s\"\n",
849 opt->option_name); 853 opt->option_name);
850 return -1; 854 return -1;
851 } 855 }
@@ -867,7 +871,8 @@ static int reiserfs_getopt(struct super_block *s, char **cur, opt_desc_t * opts,
867 } 871 }
868 } 872 }
869 873
870 reiserfs_warning(s, "bad value \"%s\" for option \"%s\"", p, 874 reiserfs_warning(s, "super-6506",
875 "bad value \"%s\" for option \"%s\"\n", p,
871 opt->option_name); 876 opt->option_name);
872 return -1; 877 return -1;
873} 878}
@@ -957,9 +962,9 @@ static int reiserfs_parse_options(struct super_block *s, char *options, /* strin
957 *blocks = simple_strtoul(arg, &p, 0); 962 *blocks = simple_strtoul(arg, &p, 0);
958 if (*p != '\0') { 963 if (*p != '\0') {
959 /* NNN does not look like a number */ 964 /* NNN does not look like a number */
960 reiserfs_warning(s, 965 reiserfs_warning(s, "super-6507",
961 "reiserfs_parse_options: bad value %s", 966 "bad value %s for "
962 arg); 967 "-oresize\n", arg);
963 return 0; 968 return 0;
964 } 969 }
965 } 970 }
@@ -970,8 +975,8 @@ static int reiserfs_parse_options(struct super_block *s, char *options, /* strin
970 unsigned long val = simple_strtoul(arg, &p, 0); 975 unsigned long val = simple_strtoul(arg, &p, 0);
971 /* commit=NNN (time in seconds) */ 976 /* commit=NNN (time in seconds) */
972 if (*p != '\0' || val >= (unsigned int)-1) { 977 if (*p != '\0' || val >= (unsigned int)-1) {
973 reiserfs_warning(s, 978 reiserfs_warning(s, "super-6508",
974 "reiserfs_parse_options: bad value %s", 979 "bad value %s for -ocommit\n",
975 arg); 980 arg);
976 return 0; 981 return 0;
977 } 982 }
@@ -979,16 +984,18 @@ static int reiserfs_parse_options(struct super_block *s, char *options, /* strin
979 } 984 }
980 985
981 if (c == 'w') { 986 if (c == 'w') {
982 reiserfs_warning(s, "reiserfs: nolargeio option is no longer supported"); 987 reiserfs_warning(s, "super-6509", "nolargeio option "
988 "is no longer supported");
983 return 0; 989 return 0;
984 } 990 }
985 991
986 if (c == 'j') { 992 if (c == 'j') {
987 if (arg && *arg && jdev_name) { 993 if (arg && *arg && jdev_name) {
988 if (*jdev_name) { //Hm, already assigned? 994 if (*jdev_name) { //Hm, already assigned?
989 reiserfs_warning(s, 995 reiserfs_warning(s, "super-6510",
990 "reiserfs_parse_options: journal device was already specified to be %s", 996 "journal device was "
991 *jdev_name); 997 "already specified to "
998 "be %s", *jdev_name);
992 return 0; 999 return 0;
993 } 1000 }
994 *jdev_name = arg; 1001 *jdev_name = arg;
@@ -1000,29 +1007,35 @@ static int reiserfs_parse_options(struct super_block *s, char *options, /* strin
1000 1007
1001 if (sb_any_quota_loaded(s) && 1008 if (sb_any_quota_loaded(s) &&
1002 (!*arg != !REISERFS_SB(s)->s_qf_names[qtype])) { 1009 (!*arg != !REISERFS_SB(s)->s_qf_names[qtype])) {
1003 reiserfs_warning(s, 1010 reiserfs_warning(s, "super-6511",
1004 "reiserfs_parse_options: cannot change journaled quota options when quota turned on."); 1011 "cannot change journaled "
1012 "quota options when quota "
1013 "turned on.");
1005 return 0; 1014 return 0;
1006 } 1015 }
1007 if (*arg) { /* Some filename specified? */ 1016 if (*arg) { /* Some filename specified? */
1008 if (REISERFS_SB(s)->s_qf_names[qtype] 1017 if (REISERFS_SB(s)->s_qf_names[qtype]
1009 && strcmp(REISERFS_SB(s)->s_qf_names[qtype], 1018 && strcmp(REISERFS_SB(s)->s_qf_names[qtype],
1010 arg)) { 1019 arg)) {
1011 reiserfs_warning(s, 1020 reiserfs_warning(s, "super-6512",
1012 "reiserfs_parse_options: %s quota file already specified.", 1021 "%s quota file "
1022 "already specified.",
1013 QTYPE2NAME(qtype)); 1023 QTYPE2NAME(qtype));
1014 return 0; 1024 return 0;
1015 } 1025 }
1016 if (strchr(arg, '/')) { 1026 if (strchr(arg, '/')) {
1017 reiserfs_warning(s, 1027 reiserfs_warning(s, "super-6513",
1018 "reiserfs_parse_options: quotafile must be on filesystem root."); 1028 "quotafile must be "
1029 "on filesystem root.");
1019 return 0; 1030 return 0;
1020 } 1031 }
1021 qf_names[qtype] = 1032 qf_names[qtype] =
1022 kmalloc(strlen(arg) + 1, GFP_KERNEL); 1033 kmalloc(strlen(arg) + 1, GFP_KERNEL);
1023 if (!qf_names[qtype]) { 1034 if (!qf_names[qtype]) {
1024 reiserfs_warning(s, 1035 reiserfs_warning(s, "reiserfs-2502",
1025 "reiserfs_parse_options: not enough memory for storing quotafile name."); 1036 "not enough memory "
1037 "for storing "
1038 "quotafile name.");
1026 return 0; 1039 return 0;
1027 } 1040 }
1028 strcpy(qf_names[qtype], arg); 1041 strcpy(qf_names[qtype], arg);
@@ -1040,21 +1053,24 @@ static int reiserfs_parse_options(struct super_block *s, char *options, /* strin
1040 else if (!strcmp(arg, "vfsv0")) 1053 else if (!strcmp(arg, "vfsv0"))
1041 *qfmt = QFMT_VFS_V0; 1054 *qfmt = QFMT_VFS_V0;
1042 else { 1055 else {
1043 reiserfs_warning(s, 1056 reiserfs_warning(s, "super-6514",
1044 "reiserfs_parse_options: unknown quota format specified."); 1057 "unknown quota format "
1058 "specified.");
1045 return 0; 1059 return 0;
1046 } 1060 }
1047 if (sb_any_quota_loaded(s) && 1061 if (sb_any_quota_loaded(s) &&
1048 *qfmt != REISERFS_SB(s)->s_jquota_fmt) { 1062 *qfmt != REISERFS_SB(s)->s_jquota_fmt) {
1049 reiserfs_warning(s, 1063 reiserfs_warning(s, "super-6515",
1050 "reiserfs_parse_options: cannot change journaled quota options when quota turned on."); 1064 "cannot change journaled "
1065 "quota options when quota "
1066 "turned on.");
1051 return 0; 1067 return 0;
1052 } 1068 }
1053 } 1069 }
1054#else 1070#else
1055 if (c == 'u' || c == 'g' || c == 'f') { 1071 if (c == 'u' || c == 'g' || c == 'f') {
1056 reiserfs_warning(s, 1072 reiserfs_warning(s, "reiserfs-2503", "journaled "
1057 "reiserfs_parse_options: journaled quota options not supported."); 1073 "quota options not supported.");
1058 return 0; 1074 return 0;
1059 } 1075 }
1060#endif 1076#endif
@@ -1063,15 +1079,15 @@ static int reiserfs_parse_options(struct super_block *s, char *options, /* strin
1063#ifdef CONFIG_QUOTA 1079#ifdef CONFIG_QUOTA
1064 if (!REISERFS_SB(s)->s_jquota_fmt && !*qfmt 1080 if (!REISERFS_SB(s)->s_jquota_fmt && !*qfmt
1065 && (qf_names[USRQUOTA] || qf_names[GRPQUOTA])) { 1081 && (qf_names[USRQUOTA] || qf_names[GRPQUOTA])) {
1066 reiserfs_warning(s, 1082 reiserfs_warning(s, "super-6515",
1067 "reiserfs_parse_options: journaled quota format not specified."); 1083 "journaled quota format not specified.");
1068 return 0; 1084 return 0;
1069 } 1085 }
1070 /* This checking is not precise wrt the quota type but for our purposes it is sufficient */ 1086 /* This checking is not precise wrt the quota type but for our purposes it is sufficient */
1071 if (!(*mount_options & (1 << REISERFS_QUOTA)) 1087 if (!(*mount_options & (1 << REISERFS_QUOTA))
1072 && sb_any_quota_loaded(s)) { 1088 && sb_any_quota_loaded(s)) {
1073 reiserfs_warning(s, 1089 reiserfs_warning(s, "super-6516", "quota options must "
1074 "reiserfs_parse_options: quota options must be present when quota is turned on."); 1090 "be present when quota is turned on.");
1075 return 0; 1091 return 0;
1076 } 1092 }
1077#endif 1093#endif
@@ -1131,14 +1147,15 @@ static void handle_attrs(struct super_block *s)
1131 1147
1132 if (reiserfs_attrs(s)) { 1148 if (reiserfs_attrs(s)) {
1133 if (old_format_only(s)) { 1149 if (old_format_only(s)) {
1134 reiserfs_warning(s, 1150 reiserfs_warning(s, "super-6517", "cannot support "
1135 "reiserfs: cannot support attributes on 3.5.x disk format"); 1151 "attributes on 3.5.x disk format");
1136 REISERFS_SB(s)->s_mount_opt &= ~(1 << REISERFS_ATTRS); 1152 REISERFS_SB(s)->s_mount_opt &= ~(1 << REISERFS_ATTRS);
1137 return; 1153 return;
1138 } 1154 }
1139 if (!(le32_to_cpu(rs->s_flags) & reiserfs_attrs_cleared)) { 1155 if (!(le32_to_cpu(rs->s_flags) & reiserfs_attrs_cleared)) {
1140 reiserfs_warning(s, 1156 reiserfs_warning(s, "super-6518", "cannot support "
1141 "reiserfs: cannot support attributes until flag is set in super-block"); 1157 "attributes until flag is set in "
1158 "super-block");
1142 REISERFS_SB(s)->s_mount_opt &= ~(1 << REISERFS_ATTRS); 1159 REISERFS_SB(s)->s_mount_opt &= ~(1 << REISERFS_ATTRS);
1143 } 1160 }
1144 } 1161 }
@@ -1280,6 +1297,8 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg)
1280 REISERFS_SB(s)->s_mount_state = sb_umount_state(rs); 1297 REISERFS_SB(s)->s_mount_state = sb_umount_state(rs);
1281 s->s_flags &= ~MS_RDONLY; 1298 s->s_flags &= ~MS_RDONLY;
1282 set_sb_umount_state(rs, REISERFS_ERROR_FS); 1299 set_sb_umount_state(rs, REISERFS_ERROR_FS);
1300 if (!old_format_only(s))
1301 set_sb_mnt_count(rs, sb_mnt_count(rs) + 1);
1283 /* mark_buffer_dirty (SB_BUFFER_WITH_SB (s), 1); */ 1302 /* mark_buffer_dirty (SB_BUFFER_WITH_SB (s), 1); */
1284 journal_mark_dirty(&th, s, SB_BUFFER_WITH_SB(s)); 1303 journal_mark_dirty(&th, s, SB_BUFFER_WITH_SB(s));
1285 REISERFS_SB(s)->s_mount_state = REISERFS_VALID_FS; 1304 REISERFS_SB(s)->s_mount_state = REISERFS_VALID_FS;
@@ -1314,7 +1333,7 @@ static int read_super_block(struct super_block *s, int offset)
1314 1333
1315 bh = sb_bread(s, offset / s->s_blocksize); 1334 bh = sb_bread(s, offset / s->s_blocksize);
1316 if (!bh) { 1335 if (!bh) {
1317 reiserfs_warning(s, "sh-2006: read_super_block: " 1336 reiserfs_warning(s, "sh-2006",
1318 "bread failed (dev %s, block %lu, size %lu)", 1337 "bread failed (dev %s, block %lu, size %lu)",
1319 reiserfs_bdevname(s), offset / s->s_blocksize, 1338 reiserfs_bdevname(s), offset / s->s_blocksize,
1320 s->s_blocksize); 1339 s->s_blocksize);
@@ -1328,15 +1347,15 @@ static int read_super_block(struct super_block *s, int offset)
1328 } 1347 }
1329 // 1348 //
1330 // ok, reiserfs signature (old or new) found in at the given offset 1349 // ok, reiserfs signature (old or new) found in at the given offset
1331 // 1350 //
1332 fs_blocksize = sb_blocksize(rs); 1351 fs_blocksize = sb_blocksize(rs);
1333 brelse(bh); 1352 brelse(bh);
1334 sb_set_blocksize(s, fs_blocksize); 1353 sb_set_blocksize(s, fs_blocksize);
1335 1354
1336 bh = sb_bread(s, offset / s->s_blocksize); 1355 bh = sb_bread(s, offset / s->s_blocksize);
1337 if (!bh) { 1356 if (!bh) {
1338 reiserfs_warning(s, "sh-2007: read_super_block: " 1357 reiserfs_warning(s, "sh-2007",
1339 "bread failed (dev %s, block %lu, size %lu)\n", 1358 "bread failed (dev %s, block %lu, size %lu)",
1340 reiserfs_bdevname(s), offset / s->s_blocksize, 1359 reiserfs_bdevname(s), offset / s->s_blocksize,
1341 s->s_blocksize); 1360 s->s_blocksize);
1342 return 1; 1361 return 1;
@@ -1344,8 +1363,8 @@ static int read_super_block(struct super_block *s, int offset)
1344 1363
1345 rs = (struct reiserfs_super_block *)bh->b_data; 1364 rs = (struct reiserfs_super_block *)bh->b_data;
1346 if (sb_blocksize(rs) != s->s_blocksize) { 1365 if (sb_blocksize(rs) != s->s_blocksize) {
1347 reiserfs_warning(s, "sh-2011: read_super_block: " 1366 reiserfs_warning(s, "sh-2011", "can't find a reiserfs "
1348 "can't find a reiserfs filesystem on (dev %s, block %Lu, size %lu)\n", 1367 "filesystem on (dev %s, block %Lu, size %lu)",
1349 reiserfs_bdevname(s), 1368 reiserfs_bdevname(s),
1350 (unsigned long long)bh->b_blocknr, 1369 (unsigned long long)bh->b_blocknr,
1351 s->s_blocksize); 1370 s->s_blocksize);
@@ -1355,9 +1374,10 @@ static int read_super_block(struct super_block *s, int offset)
1355 1374
1356 if (rs->s_v1.s_root_block == cpu_to_le32(-1)) { 1375 if (rs->s_v1.s_root_block == cpu_to_le32(-1)) {
1357 brelse(bh); 1376 brelse(bh);
1358 reiserfs_warning(s, 1377 reiserfs_warning(s, "super-6519", "Unfinished reiserfsck "
1359 "Unfinished reiserfsck --rebuild-tree run detected. Please run\n" 1378 "--rebuild-tree run detected. Please run\n"
1360 "reiserfsck --rebuild-tree and wait for a completion. If that fails\n" 1379 "reiserfsck --rebuild-tree and wait for a "
1380 "completion. If that fails\n"
1361 "get newer reiserfsprogs package"); 1381 "get newer reiserfsprogs package");
1362 return 1; 1382 return 1;
1363 } 1383 }
@@ -1369,18 +1389,15 @@ static int read_super_block(struct super_block *s, int offset)
1369 /* magic is of non-standard journal filesystem, look at s_version to 1389 /* magic is of non-standard journal filesystem, look at s_version to
1370 find which format is in use */ 1390 find which format is in use */
1371 if (sb_version(rs) == REISERFS_VERSION_2) 1391 if (sb_version(rs) == REISERFS_VERSION_2)
1372 reiserfs_warning(s, 1392 reiserfs_info(s, "found reiserfs format \"3.6\""
1373 "read_super_block: found reiserfs format \"3.6\"" 1393 " with non-standard journal\n");
1374 " with non-standard journal");
1375 else if (sb_version(rs) == REISERFS_VERSION_1) 1394 else if (sb_version(rs) == REISERFS_VERSION_1)
1376 reiserfs_warning(s, 1395 reiserfs_info(s, "found reiserfs format \"3.5\""
1377 "read_super_block: found reiserfs format \"3.5\"" 1396 " with non-standard journal\n");
1378 " with non-standard journal");
1379 else { 1397 else {
1380 reiserfs_warning(s, 1398 reiserfs_warning(s, "sh-2012", "found unknown "
1381 "sh-2012: read_super_block: found unknown " 1399 "format \"%u\" of reiserfs with "
1382 "format \"%u\" of reiserfs with non-standard magic", 1400 "non-standard magic", sb_version(rs));
1383 sb_version(rs));
1384 return 1; 1401 return 1;
1385 } 1402 }
1386 } else 1403 } else
@@ -1410,8 +1427,7 @@ static int reread_meta_blocks(struct super_block *s)
1410 ll_rw_block(READ, 1, &(SB_BUFFER_WITH_SB(s))); 1427 ll_rw_block(READ, 1, &(SB_BUFFER_WITH_SB(s)));
1411 wait_on_buffer(SB_BUFFER_WITH_SB(s)); 1428 wait_on_buffer(SB_BUFFER_WITH_SB(s));
1412 if (!buffer_uptodate(SB_BUFFER_WITH_SB(s))) { 1429 if (!buffer_uptodate(SB_BUFFER_WITH_SB(s))) {
1413 reiserfs_warning(s, 1430 reiserfs_warning(s, "reiserfs-2504", "error reading the super");
1414 "reread_meta_blocks, error reading the super");
1415 return 1; 1431 return 1;
1416 } 1432 }
1417 1433
@@ -1454,8 +1470,8 @@ static __u32 find_hash_out(struct super_block *s)
1454 if (reiserfs_rupasov_hash(s)) { 1470 if (reiserfs_rupasov_hash(s)) {
1455 hash = YURA_HASH; 1471 hash = YURA_HASH;
1456 } 1472 }
1457 reiserfs_warning(s, "FS seems to be empty, autodetect " 1473 reiserfs_info(s, "FS seems to be empty, autodetect "
1458 "is using the default hash"); 1474 "is using the default hash\n");
1459 break; 1475 break;
1460 } 1476 }
1461 r5hash = GET_HASH_VALUE(r5_hash(de.de_name, de.de_namelen)); 1477 r5hash = GET_HASH_VALUE(r5_hash(de.de_name, de.de_namelen));
@@ -1475,10 +1491,10 @@ static __u32 find_hash_out(struct super_block *s)
1475 && (yurahash == 1491 && (yurahash ==
1476 GET_HASH_VALUE(deh_offset 1492 GET_HASH_VALUE(deh_offset
1477 (&(de.de_deh[de.de_entry_num])))))) { 1493 (&(de.de_deh[de.de_entry_num])))))) {
1478 reiserfs_warning(s, 1494 reiserfs_warning(s, "reiserfs-2506", "Unable to "
1479 "Unable to automatically detect hash function. " 1495 "automatically detect hash function. "
1480 "Please mount with -o hash={tea,rupasov,r5}", 1496 "Please mount with -o "
1481 reiserfs_bdevname(s)); 1497 "hash={tea,rupasov,r5}");
1482 hash = UNSET_HASH; 1498 hash = UNSET_HASH;
1483 break; 1499 break;
1484 } 1500 }
@@ -1492,7 +1508,8 @@ static __u32 find_hash_out(struct super_block *s)
1492 (deh_offset(&(de.de_deh[de.de_entry_num]))) == r5hash) 1508 (deh_offset(&(de.de_deh[de.de_entry_num]))) == r5hash)
1493 hash = R5_HASH; 1509 hash = R5_HASH;
1494 else { 1510 else {
1495 reiserfs_warning(s, "Unrecognised hash function"); 1511 reiserfs_warning(s, "reiserfs-2506",
1512 "Unrecognised hash function");
1496 hash = UNSET_HASH; 1513 hash = UNSET_HASH;
1497 } 1514 }
1498 } while (0); 1515 } while (0);
@@ -1516,21 +1533,24 @@ static int what_hash(struct super_block *s)
1516 code = find_hash_out(s); 1533 code = find_hash_out(s);
1517 1534
1518 if (code != UNSET_HASH && reiserfs_hash_detect(s)) { 1535 if (code != UNSET_HASH && reiserfs_hash_detect(s)) {
1519 /* detection has found the hash, and we must check against the 1536 /* detection has found the hash, and we must check against the
1520 ** mount options 1537 ** mount options
1521 */ 1538 */
1522 if (reiserfs_rupasov_hash(s) && code != YURA_HASH) { 1539 if (reiserfs_rupasov_hash(s) && code != YURA_HASH) {
1523 reiserfs_warning(s, "Error, %s hash detected, " 1540 reiserfs_warning(s, "reiserfs-2507",
1541 "Error, %s hash detected, "
1524 "unable to force rupasov hash", 1542 "unable to force rupasov hash",
1525 reiserfs_hashname(code)); 1543 reiserfs_hashname(code));
1526 code = UNSET_HASH; 1544 code = UNSET_HASH;
1527 } else if (reiserfs_tea_hash(s) && code != TEA_HASH) { 1545 } else if (reiserfs_tea_hash(s) && code != TEA_HASH) {
1528 reiserfs_warning(s, "Error, %s hash detected, " 1546 reiserfs_warning(s, "reiserfs-2508",
1547 "Error, %s hash detected, "
1529 "unable to force tea hash", 1548 "unable to force tea hash",
1530 reiserfs_hashname(code)); 1549 reiserfs_hashname(code));
1531 code = UNSET_HASH; 1550 code = UNSET_HASH;
1532 } else if (reiserfs_r5_hash(s) && code != R5_HASH) { 1551 } else if (reiserfs_r5_hash(s) && code != R5_HASH) {
1533 reiserfs_warning(s, "Error, %s hash detected, " 1552 reiserfs_warning(s, "reiserfs-2509",
1553 "Error, %s hash detected, "
1534 "unable to force r5 hash", 1554 "unable to force r5 hash",
1535 reiserfs_hashname(code)); 1555 reiserfs_hashname(code));
1536 code = UNSET_HASH; 1556 code = UNSET_HASH;
@@ -1546,7 +1566,7 @@ static int what_hash(struct super_block *s)
1546 } 1566 }
1547 } 1567 }
1548 1568
1549 /* if we are mounted RW, and we have a new valid hash code, update 1569 /* if we are mounted RW, and we have a new valid hash code, update
1550 ** the super 1570 ** the super
1551 */ 1571 */
1552 if (code != UNSET_HASH && 1572 if (code != UNSET_HASH &&
@@ -1589,9 +1609,9 @@ static int function2code(hashf_t func)
1589 return 0; 1609 return 0;
1590} 1610}
1591 1611
1592#define SWARN(silent, s, ...) \ 1612#define SWARN(silent, s, id, ...) \
1593 if (!(silent)) \ 1613 if (!(silent)) \
1594 reiserfs_warning (s, __VA_ARGS__) 1614 reiserfs_warning(s, id, __VA_ARGS__)
1595 1615
1596static int reiserfs_fill_super(struct super_block *s, void *data, int silent) 1616static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
1597{ 1617{
@@ -1625,10 +1645,6 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
1625 REISERFS_SB(s)->s_alloc_options.preallocmin = 0; 1645 REISERFS_SB(s)->s_alloc_options.preallocmin = 0;
1626 /* Preallocate by 16 blocks (17-1) at once */ 1646 /* Preallocate by 16 blocks (17-1) at once */
1627 REISERFS_SB(s)->s_alloc_options.preallocsize = 17; 1647 REISERFS_SB(s)->s_alloc_options.preallocsize = 17;
1628#ifdef CONFIG_REISERFS_FS_XATTR
1629 /* Initialize the rwsem for xattr dir */
1630 init_rwsem(&REISERFS_SB(s)->xattr_dir_sem);
1631#endif
1632 /* setup default block allocator options */ 1648 /* setup default block allocator options */
1633 reiserfs_init_alloc_options(s); 1649 reiserfs_init_alloc_options(s);
1634 1650
@@ -1643,8 +1659,7 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
1643#endif 1659#endif
1644 1660
1645 if (blocks) { 1661 if (blocks) {
1646 SWARN(silent, s, "jmacd-7: reiserfs_fill_super: resize option " 1662 SWARN(silent, s, "jmacd-7", "resize option for remount only");
1647 "for remount only");
1648 goto error; 1663 goto error;
1649 } 1664 }
1650 1665
@@ -1653,8 +1668,7 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
1653 old_format = 1; 1668 old_format = 1;
1654 /* try new format (64-th 1k block), which can contain reiserfs super block */ 1669 /* try new format (64-th 1k block), which can contain reiserfs super block */
1655 else if (read_super_block(s, REISERFS_DISK_OFFSET_IN_BYTES)) { 1670 else if (read_super_block(s, REISERFS_DISK_OFFSET_IN_BYTES)) {
1656 SWARN(silent, s, 1671 SWARN(silent, s, "sh-2021", "can not find reiserfs on %s",
1657 "sh-2021: reiserfs_fill_super: can not find reiserfs on %s",
1658 reiserfs_bdevname(s)); 1672 reiserfs_bdevname(s));
1659 goto error; 1673 goto error;
1660 } 1674 }
@@ -1666,13 +1680,12 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
1666 if (s->s_bdev && s->s_bdev->bd_inode 1680 if (s->s_bdev && s->s_bdev->bd_inode
1667 && i_size_read(s->s_bdev->bd_inode) < 1681 && i_size_read(s->s_bdev->bd_inode) <
1668 sb_block_count(rs) * sb_blocksize(rs)) { 1682 sb_block_count(rs) * sb_blocksize(rs)) {
1669 SWARN(silent, s, 1683 SWARN(silent, s, "", "Filesystem cannot be "
1670 "Filesystem on %s cannot be mounted because it is bigger than the device", 1684 "mounted because it is bigger than the device");
1671 reiserfs_bdevname(s)); 1685 SWARN(silent, s, "", "You may need to run fsck "
1672 SWARN(silent, s, 1686 "or increase size of your LVM partition");
1673 "You may need to run fsck or increase size of your LVM partition"); 1687 SWARN(silent, s, "", "Or may be you forgot to "
1674 SWARN(silent, s, 1688 "reboot after fdisk when it told you to");
1675 "Or may be you forgot to reboot after fdisk when it told you to");
1676 goto error; 1689 goto error;
1677 } 1690 }
1678 1691
@@ -1680,14 +1693,13 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
1680 sbi->s_mount_state = REISERFS_VALID_FS; 1693 sbi->s_mount_state = REISERFS_VALID_FS;
1681 1694
1682 if ((errval = reiserfs_init_bitmap_cache(s))) { 1695 if ((errval = reiserfs_init_bitmap_cache(s))) {
1683 SWARN(silent, s, 1696 SWARN(silent, s, "jmacd-8", "unable to read bitmap");
1684 "jmacd-8: reiserfs_fill_super: unable to read bitmap");
1685 goto error; 1697 goto error;
1686 } 1698 }
1687 errval = -EINVAL; 1699 errval = -EINVAL;
1688#ifdef CONFIG_REISERFS_CHECK 1700#ifdef CONFIG_REISERFS_CHECK
1689 SWARN(silent, s, "CONFIG_REISERFS_CHECK is set ON"); 1701 SWARN(silent, s, "", "CONFIG_REISERFS_CHECK is set ON");
1690 SWARN(silent, s, "- it is slow mode for debugging."); 1702 SWARN(silent, s, "", "- it is slow mode for debugging.");
1691#endif 1703#endif
1692 1704
1693 /* make data=ordered the default */ 1705 /* make data=ordered the default */
@@ -1708,8 +1720,8 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
1708 } 1720 }
1709 // set_device_ro(s->s_dev, 1) ; 1721 // set_device_ro(s->s_dev, 1) ;
1710 if (journal_init(s, jdev_name, old_format, commit_max_age)) { 1722 if (journal_init(s, jdev_name, old_format, commit_max_age)) {
1711 SWARN(silent, s, 1723 SWARN(silent, s, "sh-2022",
1712 "sh-2022: reiserfs_fill_super: unable to initialize journal space"); 1724 "unable to initialize journal space");
1713 goto error; 1725 goto error;
1714 } else { 1726 } else {
1715 jinit_done = 1; /* once this is set, journal_release must be called 1727 jinit_done = 1; /* once this is set, journal_release must be called
@@ -1717,8 +1729,8 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
1717 */ 1729 */
1718 } 1730 }
1719 if (reread_meta_blocks(s)) { 1731 if (reread_meta_blocks(s)) {
1720 SWARN(silent, s, 1732 SWARN(silent, s, "jmacd-9",
1721 "jmacd-9: reiserfs_fill_super: unable to reread meta blocks after journal init"); 1733 "unable to reread meta blocks after journal init");
1722 goto error; 1734 goto error;
1723 } 1735 }
1724 1736
@@ -1726,8 +1738,8 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
1726 goto error; 1738 goto error;
1727 1739
1728 if (bdev_read_only(s->s_bdev) && !(s->s_flags & MS_RDONLY)) { 1740 if (bdev_read_only(s->s_bdev) && !(s->s_flags & MS_RDONLY)) {
1729 SWARN(silent, s, 1741 SWARN(silent, s, "clm-7000",
1730 "clm-7000: Detected readonly device, marking FS readonly"); 1742 "Detected readonly device, marking FS readonly");
1731 s->s_flags |= MS_RDONLY; 1743 s->s_flags |= MS_RDONLY;
1732 } 1744 }
1733 args.objectid = REISERFS_ROOT_OBJECTID; 1745 args.objectid = REISERFS_ROOT_OBJECTID;
@@ -1736,8 +1748,7 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
1736 iget5_locked(s, REISERFS_ROOT_OBJECTID, reiserfs_find_actor, 1748 iget5_locked(s, REISERFS_ROOT_OBJECTID, reiserfs_find_actor,
1737 reiserfs_init_locked_inode, (void *)(&args)); 1749 reiserfs_init_locked_inode, (void *)(&args));
1738 if (!root_inode) { 1750 if (!root_inode) {
1739 SWARN(silent, s, 1751 SWARN(silent, s, "jmacd-10", "get root inode failed");
1740 "jmacd-10: reiserfs_fill_super: get root inode failed");
1741 goto error; 1752 goto error;
1742 } 1753 }
1743 1754
@@ -1786,7 +1797,7 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
1786 * avoiding corruption. -jeffm */ 1797 * avoiding corruption. -jeffm */
1787 if (bmap_would_wrap(reiserfs_bmap_count(s)) && 1798 if (bmap_would_wrap(reiserfs_bmap_count(s)) &&
1788 sb_bmap_nr(rs) != 0) { 1799 sb_bmap_nr(rs) != 0) {
1789 reiserfs_warning(s, "super-2030: This file system " 1800 reiserfs_warning(s, "super-2030", "This file system "
1790 "claims to use %u bitmap blocks in " 1801 "claims to use %u bitmap blocks in "
1791 "its super block, but requires %u. " 1802 "its super block, but requires %u. "
1792 "Clearing to zero.", sb_bmap_nr(rs), 1803 "Clearing to zero.", sb_bmap_nr(rs),
@@ -1819,7 +1830,9 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
1819 } else if (!silent) { 1830 } else if (!silent) {
1820 reiserfs_info(s, "using 3.5.x disk format\n"); 1831 reiserfs_info(s, "using 3.5.x disk format\n");
1821 } 1832 }
1822 } 1833 } else
1834 set_sb_mnt_count(rs, sb_mnt_count(rs) + 1);
1835
1823 1836
1824 journal_mark_dirty(&th, s, SB_BUFFER_WITH_SB(s)); 1837 journal_mark_dirty(&th, s, SB_BUFFER_WITH_SB(s));
1825 errval = journal_end(&th, s, 1); 1838 errval = journal_end(&th, s, 1);
@@ -1892,62 +1905,14 @@ static int reiserfs_statfs(struct dentry *dentry, struct kstatfs *buf)
1892 buf->f_bsize = dentry->d_sb->s_blocksize; 1905 buf->f_bsize = dentry->d_sb->s_blocksize;
1893 /* changed to accommodate gcc folks. */ 1906 /* changed to accommodate gcc folks. */
1894 buf->f_type = REISERFS_SUPER_MAGIC; 1907 buf->f_type = REISERFS_SUPER_MAGIC;
1908 buf->f_fsid.val[0] = (u32)crc32_le(0, rs->s_uuid, sizeof(rs->s_uuid)/2);
1909 buf->f_fsid.val[1] = (u32)crc32_le(0, rs->s_uuid + sizeof(rs->s_uuid)/2,
1910 sizeof(rs->s_uuid)/2);
1911
1895 return 0; 1912 return 0;
1896} 1913}
1897 1914
1898#ifdef CONFIG_QUOTA 1915#ifdef CONFIG_QUOTA
1899static int reiserfs_dquot_initialize(struct inode *inode, int type)
1900{
1901 struct reiserfs_transaction_handle th;
1902 int ret, err;
1903
1904 /* We may create quota structure so we need to reserve enough blocks */
1905 reiserfs_write_lock(inode->i_sb);
1906 ret =
1907 journal_begin(&th, inode->i_sb,
1908 2 * REISERFS_QUOTA_INIT_BLOCKS(inode->i_sb));
1909 if (ret)
1910 goto out;
1911 ret = dquot_initialize(inode, type);
1912 err =
1913 journal_end(&th, inode->i_sb,
1914 2 * REISERFS_QUOTA_INIT_BLOCKS(inode->i_sb));
1915 if (!ret && err)
1916 ret = err;
1917 out:
1918 reiserfs_write_unlock(inode->i_sb);
1919 return ret;
1920}
1921
1922static int reiserfs_dquot_drop(struct inode *inode)
1923{
1924 struct reiserfs_transaction_handle th;
1925 int ret, err;
1926
1927 /* We may delete quota structure so we need to reserve enough blocks */
1928 reiserfs_write_lock(inode->i_sb);
1929 ret =
1930 journal_begin(&th, inode->i_sb,
1931 2 * REISERFS_QUOTA_DEL_BLOCKS(inode->i_sb));
1932 if (ret) {
1933 /*
1934 * We call dquot_drop() anyway to at least release references
1935 * to quota structures so that umount does not hang.
1936 */
1937 dquot_drop(inode);
1938 goto out;
1939 }
1940 ret = dquot_drop(inode);
1941 err =
1942 journal_end(&th, inode->i_sb,
1943 2 * REISERFS_QUOTA_DEL_BLOCKS(inode->i_sb));
1944 if (!ret && err)
1945 ret = err;
1946 out:
1947 reiserfs_write_unlock(inode->i_sb);
1948 return ret;
1949}
1950
1951static int reiserfs_write_dquot(struct dquot *dquot) 1916static int reiserfs_write_dquot(struct dquot *dquot)
1952{ 1917{
1953 struct reiserfs_transaction_handle th; 1918 struct reiserfs_transaction_handle th;
@@ -2085,8 +2050,8 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id,
2085 if (!(REISERFS_I(inode)->i_flags & i_nopack_mask)) { 2050 if (!(REISERFS_I(inode)->i_flags & i_nopack_mask)) {
2086 err = reiserfs_unpack(inode, NULL); 2051 err = reiserfs_unpack(inode, NULL);
2087 if (err) { 2052 if (err) {
2088 reiserfs_warning(sb, 2053 reiserfs_warning(sb, "super-6520",
2089 "reiserfs: Unpacking tail of quota file failed" 2054 "Unpacking tail of quota file failed"
2090 " (%d). Cannot turn on quotas.", err); 2055 " (%d). Cannot turn on quotas.", err);
2091 err = -EINVAL; 2056 err = -EINVAL;
2092 goto out; 2057 goto out;
@@ -2097,8 +2062,8 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id,
2097 if (REISERFS_SB(sb)->s_qf_names[type]) { 2062 if (REISERFS_SB(sb)->s_qf_names[type]) {
2098 /* Quotafile not of fs root? */ 2063 /* Quotafile not of fs root? */
2099 if (path.dentry->d_parent != sb->s_root) 2064 if (path.dentry->d_parent != sb->s_root)
2100 reiserfs_warning(sb, 2065 reiserfs_warning(sb, "super-6521",
2101 "reiserfs: Quota file not on filesystem root. " 2066 "Quota file not on filesystem root. "
2102 "Journalled quota will not work."); 2067 "Journalled quota will not work.");
2103 } 2068 }
2104 2069
@@ -2249,9 +2214,6 @@ static int __init init_reiserfs_fs(void)
2249 return ret; 2214 return ret;
2250 } 2215 }
2251 2216
2252 if ((ret = reiserfs_xattr_register_handlers()))
2253 goto failed_reiserfs_xattr_register_handlers;
2254
2255 reiserfs_proc_info_global_init(); 2217 reiserfs_proc_info_global_init();
2256 reiserfs_proc_register_global("version", 2218 reiserfs_proc_register_global("version",
2257 reiserfs_global_version_in_proc); 2219 reiserfs_global_version_in_proc);
@@ -2262,9 +2224,6 @@ static int __init init_reiserfs_fs(void)
2262 return 0; 2224 return 0;
2263 } 2225 }
2264 2226
2265 reiserfs_xattr_unregister_handlers();
2266
2267 failed_reiserfs_xattr_register_handlers:
2268 reiserfs_proc_unregister_global("version"); 2227 reiserfs_proc_unregister_global("version");
2269 reiserfs_proc_info_global_done(); 2228 reiserfs_proc_info_global_done();
2270 destroy_inodecache(); 2229 destroy_inodecache();
@@ -2274,7 +2233,6 @@ static int __init init_reiserfs_fs(void)
2274 2233
2275static void __exit exit_reiserfs_fs(void) 2234static void __exit exit_reiserfs_fs(void)
2276{ 2235{
2277 reiserfs_xattr_unregister_handlers();
2278 reiserfs_proc_unregister_global("version"); 2236 reiserfs_proc_unregister_global("version");
2279 reiserfs_proc_info_global_done(); 2237 reiserfs_proc_info_global_done();
2280 unregister_filesystem(&reiserfs_fs_type); 2238 unregister_filesystem(&reiserfs_fs_type);