Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / lustre / kernel_patches / patches / ext3-external-journal-2.6.9.patch
1 Signed-off-by: Johann Lombardi <johann.lombardi@bull.net>
2
3 Index: linux-2.6.9-full/fs/ext3/super.c
4 ===================================================================
5 --- linux-2.6.9-full.orig/fs/ext3/super.c       2006-05-20 01:14:14.000000000 +0400
6 +++ linux-2.6.9-full/fs/ext3/super.c    2006-05-20 01:17:10.000000000 +0400
7 @@ -39,7 +39,8 @@
8  #include "xattr.h"
9  #include "acl.h"
10  
11 -static int ext3_load_journal(struct super_block *, struct ext3_super_block *);
12 +static int ext3_load_journal(struct super_block *, struct ext3_super_block *,
13 +                            unsigned long journal_devnum);
14  static int ext3_create_journal(struct super_block *, struct ext3_super_block *,
15                                int);
16  static void ext3_commit_super (struct super_block * sb,
17 @@ -591,7 +592,7 @@ enum {
18         Opt_nouid32, Opt_check, Opt_nocheck, Opt_debug, Opt_oldalloc, Opt_orlov,
19         Opt_user_xattr, Opt_nouser_xattr, Opt_acl, Opt_noacl,
20         Opt_reservation, Opt_noreservation, Opt_noload,
21 -       Opt_commit, Opt_journal_update, Opt_journal_inum,
22 +       Opt_commit, Opt_journal_update, Opt_journal_inum, Opt_journal_dev,
23         Opt_abort, Opt_data_journal, Opt_data_ordered, Opt_data_writeback,
24         Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota,
25         Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0,
26 @@ -630,6 +631,7 @@ static match_table_t tokens = {
27         {Opt_commit, "commit=%u"},
28         {Opt_journal_update, "journal=update"},
29         {Opt_journal_inum, "journal=%u"},
30 +       {Opt_journal_dev, "journal_dev=%u"},
31         {Opt_abort, "abort"},
32         {Opt_data_journal, "data=journal"},
33         {Opt_data_ordered, "data=ordered"},
34 @@ -675,8 +677,9 @@ static unsigned long get_sb_block(void *
35         return sb_block;
36  }
37  
38 -static int parse_options (char * options, struct super_block *sb,
39 -                         unsigned long * inum, unsigned long *n_blocks_count, int is_remount)
40 +static int parse_options (char *options, struct super_block *sb,
41 +                         unsigned long *inum, unsigned long *journal_devnum, 
42 +                         unsigned long *n_blocks_count, int is_remount)
43  {
44         struct ext3_sb_info *sbi = EXT3_SB(sb);
45         char * p;
46 @@ -816,6 +819,16 @@ static int parse_options (char * options
47                                 return 0;
48                         *inum = option;
49                         break;
50 +               case Opt_journal_dev:
51 +                       if (is_remount) {
52 +                               printk(KERN_ERR "EXT3-fs: cannot specify "
53 +                                      "journal on remount\n");
54 +                               return 0;
55 +                       }
56 +                       if (match_int(&args[0], &option))
57 +                               return 0;
58 +                       *journal_devnum = option;
59 +                       break;
60                 case Opt_noload:
61                         set_opt (sbi->s_mount_opt, NOLOAD);
62                         break;
63 @@ -1278,6 +1291,7 @@ static int ext3_fill_super (struct super
64         unsigned long logic_sb_block;
65         unsigned long offset = 0;
66         unsigned long journal_inum = 0;
67 +       unsigned long journal_devnum = 0;
68         unsigned long def_mount_opts;
69         struct inode *root;
70         int blocksize;
71 @@ -1361,7 +1375,8 @@ static int ext3_fill_super (struct super
72  
73         set_opt(sbi->s_mount_opt, RESERVATION);
74  
75 -       if (!parse_options ((char *) data, sb, &journal_inum, NULL, 0))
76 +       if (!parse_options ((char *) data, sb, &journal_inum, &journal_devnum, 
77 +                           NULL, 0))
78                 goto failed_mount;
79  
80         set_sb_time_gran(sb, 1000000000U);
81 @@ -1567,7 +1582,7 @@ static int ext3_fill_super (struct super
82          */
83         if (!test_opt(sb, NOLOAD) &&
84             EXT3_HAS_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_HAS_JOURNAL)) {
85 -               if (ext3_load_journal(sb, es))
86 +               if (ext3_load_journal(sb, es, journal_devnum))
87                         goto failed_mount2;
88         } else if (journal_inum) {
89                 if (ext3_create_journal(sb, es, journal_inum))
90 @@ -1831,15 +1846,24 @@ out_bdev:
91         return NULL;
92  }
93  
94 -static int ext3_load_journal(struct super_block * sb,
95 -                            struct ext3_super_block * es)
96 +static int ext3_load_journal(struct super_block *sb,
97 +                            struct ext3_super_block *es,
98 +                            unsigned long journal_devnum)
99  {
100         journal_t *journal;
101         int journal_inum = le32_to_cpu(es->s_journal_inum);
102 -       dev_t journal_dev = new_decode_dev(le32_to_cpu(es->s_journal_dev));
103 +       dev_t journal_dev;
104         int err = 0;
105         int really_read_only;
106  
107 +       if (journal_devnum &&
108 +           journal_devnum != le32_to_cpu(es->s_journal_dev)) {
109 +               printk(KERN_INFO "EXT3-fs: external journal device major/minor "
110 +                       "numbers have changed\n");
111 +               journal_dev = new_decode_dev(journal_devnum);
112 +       } else
113 +               journal_dev = new_decode_dev(le32_to_cpu(es->s_journal_dev));
114 +
115         really_read_only = bdev_read_only(sb->s_bdev);
116  
117         /*
118 @@ -1898,6 +1922,16 @@ static int ext3_load_journal(struct supe
119  
120         EXT3_SB(sb)->s_journal = journal;
121         ext3_clear_journal_err(sb, es);
122 +
123 +       if (journal_devnum &&
124 +           journal_devnum != le32_to_cpu(es->s_journal_dev)) {
125 +               es->s_journal_dev = cpu_to_le32(journal_devnum);
126 +               sb->s_dirt = 1;
127 +
128 +               /* Make sure we flush the recovery flag to disk. */
129 +               ext3_commit_super(sb, es, 1);
130 +       }
131 +
132         return 0;
133  }
134  
135 @@ -2105,13 +2139,13 @@ int ext3_remount (struct super_block * s
136  {
137         struct ext3_super_block * es;
138         struct ext3_sb_info *sbi = EXT3_SB(sb);
139 -       unsigned long tmp;
140 +       unsigned long tmp1, tmp2;
141         unsigned long n_blocks_count = 0;
142  
143         /*
144          * Allow the "check" option to be passed as a remount option.
145          */
146 -       if (!parse_options(data, sb, &tmp, &n_blocks_count, 1))
147 +       if (!parse_options(data, sb, &tmp1, &tmp2, &n_blocks_count, 1))
148                 return -EINVAL;
149  
150         if (sbi->s_mount_opt & EXT3_MOUNT_ABORT)