1 Signed-off-by: Johann Lombardi <johann.lombardi@bull.net>
3 --- linux-2.6.12.orig/fs/ext3/super.c 2005-06-17 21:48:29.000000000 +0200
4 +++ linux-2.6.12/fs/ext3/super.c 2005-11-07 13:37:30.000000000 +0100
9 -static int ext3_load_journal(struct super_block *, struct ext3_super_block *);
10 +static int ext3_load_journal(struct super_block *, struct ext3_super_block *,
11 + unsigned long journal_devnum);
12 static int ext3_create_journal(struct super_block *, struct ext3_super_block *,
14 static void ext3_commit_super (struct super_block * sb,
15 @@ -586,7 +587,7 @@ enum {
16 Opt_nouid32, Opt_check, Opt_nocheck, Opt_debug, Opt_oldalloc, Opt_orlov,
17 Opt_user_xattr, Opt_nouser_xattr, Opt_acl, Opt_noacl,
18 Opt_reservation, Opt_noreservation, Opt_noload, Opt_nobh,
19 - Opt_commit, Opt_journal_update, Opt_journal_inum,
20 + Opt_commit, Opt_journal_update, Opt_journal_inum, Opt_journal_dev,
21 Opt_abort, Opt_data_journal, Opt_data_ordered, Opt_data_writeback,
22 Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota,
23 Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0,
24 @@ -624,6 +625,7 @@ static match_table_t tokens = {
25 {Opt_commit, "commit=%u"},
26 {Opt_journal_update, "journal=update"},
27 {Opt_journal_inum, "journal=%u"},
28 + {Opt_journal_dev, "journal_dev=%u"},
30 {Opt_data_journal, "data=journal"},
31 {Opt_data_ordered, "data=ordered"},
32 @@ -663,8 +665,9 @@ static unsigned long get_sb_block(void *
36 -static int parse_options (char * options, struct super_block *sb,
37 - unsigned long * inum, unsigned long *n_blocks_count, int is_remount)
38 +static int parse_options (char *options, struct super_block *sb,
39 + unsigned long *inum, unsigned long *journal_devnum,
40 + unsigned long *n_blocks_count, int is_remount)
42 struct ext3_sb_info *sbi = EXT3_SB(sb);
44 @@ -805,6 +808,16 @@ static int parse_options (char * options
48 + case Opt_journal_dev:
50 + printk(KERN_ERR "EXT3-fs: cannot specify "
51 + "journal on remount\n");
54 + if (match_int(&args[0], &option))
56 + *journal_devnum = option;
59 set_opt (sbi->s_mount_opt, NOLOAD);
61 @@ -1250,6 +1263,7 @@ static int ext3_fill_super (struct super
62 unsigned long logic_sb_block;
63 unsigned long offset = 0;
64 unsigned long journal_inum = 0;
65 + unsigned long journal_devnum = 0;
66 unsigned long def_mount_opts;
69 @@ -1330,7 +1344,8 @@ static int ext3_fill_super (struct super
71 set_opt(sbi->s_mount_opt, RESERVATION);
73 - if (!parse_options ((char *) data, sb, &journal_inum, NULL, 0))
74 + if (!parse_options ((char *) data, sb, &journal_inum, &journal_devnum,
78 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
79 @@ -1541,7 +1556,7 @@ static int ext3_fill_super (struct super
81 if (!test_opt(sb, NOLOAD) &&
82 EXT3_HAS_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_HAS_JOURNAL)) {
83 - if (ext3_load_journal(sb, es))
84 + if (ext3_load_journal(sb, es, journal_devnum))
86 } else if (journal_inum) {
87 if (ext3_create_journal(sb, es, journal_inum))
88 @@ -1821,15 +1836,24 @@ out_bdev:
92 -static int ext3_load_journal(struct super_block * sb,
93 - struct ext3_super_block * es)
94 +static int ext3_load_journal(struct super_block *sb,
95 + struct ext3_super_block *es,
96 + unsigned long journal_devnum)
99 int journal_inum = le32_to_cpu(es->s_journal_inum);
100 - dev_t journal_dev = new_decode_dev(le32_to_cpu(es->s_journal_dev));
103 int really_read_only;
105 + if (journal_devnum &&
106 + journal_devnum != le32_to_cpu(es->s_journal_dev)) {
107 + printk(KERN_INFO "EXT3-fs: external journal device major/minor "
108 + "numbers have changed\n");
109 + journal_dev = new_decode_dev(journal_devnum);
111 + journal_dev = new_decode_dev(le32_to_cpu(es->s_journal_dev));
113 really_read_only = bdev_read_only(sb->s_bdev);
116 @@ -1888,6 +1912,16 @@ static int ext3_load_journal(struct supe
118 EXT3_SB(sb)->s_journal = journal;
119 ext3_clear_journal_err(sb, es);
121 + if (journal_devnum &&
122 + journal_devnum != le32_to_cpu(es->s_journal_dev)) {
123 + es->s_journal_dev = cpu_to_le32(journal_devnum);
126 + /* Make sure we flush the recovery flag to disk. */
127 + ext3_commit_super(sb, es, 1);
133 @@ -2093,13 +2127,13 @@ static int ext3_remount (struct super_bl
135 struct ext3_super_block * es;
136 struct ext3_sb_info *sbi = EXT3_SB(sb);
138 + unsigned long tmp1, tmp2;
139 unsigned long n_blocks_count = 0;
142 * Allow the "check" option to be passed as a remount option.
144 - if (!parse_options(data, sb, &tmp, &n_blocks_count, 1))
145 + if (!parse_options(data, sb, &tmp1, &tmp2, &n_blocks_count, 1))
148 if (sbi->s_mount_opt & EXT3_MOUNT_ABORT)