Whamcloud - gitweb
adding 2.6-sles10 target and kernel config files for the sles10 kernel
[fs/lustre-release.git] / lustre / kernel_patches / patches / ext3-external-journal-2.6.12.patch
1 Signed-off-by: Johann Lombardi <johann.lombardi@bull.net>
2
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
5 @@ -39,7 +39,8 @@
6  #include "xattr.h"
7  #include "acl.h"
8  
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 *,
13                                int);
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"},
29         {Opt_abort, "abort"},
30         {Opt_data_journal, "data=journal"},
31         {Opt_data_ordered, "data=ordered"},
32 @@ -663,8 +665,9 @@ static unsigned long get_sb_block(void *
33         return sb_block;
34  }
35  
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)
41  {
42         struct ext3_sb_info *sbi = EXT3_SB(sb);
43         char * p;
44 @@ -805,6 +808,16 @@ static int parse_options (char * options
45                                 return 0;
46                         *inum = option;
47                         break;
48 +               case Opt_journal_dev:
49 +                       if (is_remount) {
50 +                               printk(KERN_ERR "EXT3-fs: cannot specify "
51 +                                      "journal on remount\n");
52 +                               return 0;
53 +                       }
54 +                       if (match_int(&args[0], &option))
55 +                               return 0;
56 +                       *journal_devnum = option;
57 +                       break;
58                 case Opt_noload:
59                         set_opt (sbi->s_mount_opt, NOLOAD);
60                         break;
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;
67         struct inode *root;
68         int blocksize;
69 @@ -1330,7 +1344,8 @@ static int ext3_fill_super (struct super
70  
71         set_opt(sbi->s_mount_opt, RESERVATION);
72  
73 -       if (!parse_options ((char *) data, sb, &journal_inum, NULL, 0))
74 +       if (!parse_options ((char *) data, sb, &journal_inum, &journal_devnum, 
75 +                           NULL, 0))
76                 goto failed_mount;
77  
78         sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
79 @@ -1541,7 +1556,7 @@ static int ext3_fill_super (struct super
80          */
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))
85                         goto failed_mount2;
86         } else if (journal_inum) {
87                 if (ext3_create_journal(sb, es, journal_inum))
88 @@ -1821,15 +1836,24 @@ out_bdev:
89         return NULL;
90  }
91  
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)
97  {
98         journal_t *journal;
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));
101 +       dev_t journal_dev;
102         int err = 0;
103         int really_read_only;
104  
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);
110 +       } else
111 +               journal_dev = new_decode_dev(le32_to_cpu(es->s_journal_dev));
112 +
113         really_read_only = bdev_read_only(sb->s_bdev);
114  
115         /*
116 @@ -1888,6 +1912,16 @@ static int ext3_load_journal(struct supe
117  
118         EXT3_SB(sb)->s_journal = journal;
119         ext3_clear_journal_err(sb, es);
120 +
121 +       if (journal_devnum &&
122 +           journal_devnum != le32_to_cpu(es->s_journal_dev)) {
123 +               es->s_journal_dev = cpu_to_le32(journal_devnum);
124 +               sb->s_dirt = 1;
125 +
126 +               /* Make sure we flush the recovery flag to disk. */
127 +               ext3_commit_super(sb, es, 1);
128 +       }
129 +
130         return 0;
131  }
132  
133 @@ -2093,13 +2127,13 @@ static int ext3_remount (struct super_bl
134  {
135         struct ext3_super_block * es;
136         struct ext3_sb_info *sbi = EXT3_SB(sb);
137 -       unsigned long tmp;
138 +       unsigned long tmp1, tmp2;
139         unsigned long n_blocks_count = 0;
140  
141         /*
142          * Allow the "check" option to be passed as a remount option.
143          */
144 -       if (!parse_options(data, sb, &tmp, &n_blocks_count, 1))
145 +       if (!parse_options(data, sb, &tmp1, &tmp2, &n_blocks_count, 1))
146                 return -EINVAL;
147  
148         if (sbi->s_mount_opt & EXT3_MOUNT_ABORT)