Whamcloud - gitweb
file llobdstat.pl was initially added on branch b_devel.
[fs/lustre-release.git] / lustre / extN / ext3-2.4.18-ino_sb_macro.diff
1 --- ./fs/ext3/balloc.c.orig     Fri Apr 12 10:27:49 2002
2 +++ ./fs/ext3/balloc.c  Tue May  7 15:35:59 2002
3 @@ -46,18 +46,18 @@ struct ext3_group_desc * ext3_get_group_
4         unsigned long desc;
5         struct ext3_group_desc * gdp;
6  
7 -       if (block_group >= sb->u.ext3_sb.s_groups_count) {
8 +       if (block_group >= EXT3_SB(sb)->s_groups_count) {
9                 ext3_error (sb, "ext3_get_group_desc",
10                             "block_group >= groups_count - "
11                             "block_group = %d, groups_count = %lu",
12 -                           block_group, sb->u.ext3_sb.s_groups_count);
13 +                           block_group, EXT3_SB(sb)->s_groups_count);
14  
15                 return NULL;
16         }
17         
18         group_desc = block_group / EXT3_DESC_PER_BLOCK(sb);
19         desc = block_group % EXT3_DESC_PER_BLOCK(sb);
20 -       if (!sb->u.ext3_sb.s_group_desc[group_desc]) {
21 +       if (!EXT3_SB(sb)->s_group_desc[group_desc]) {
22                 ext3_error (sb, "ext3_get_group_desc",
23                             "Group descriptor not loaded - "
24                             "block_group = %d, group_desc = %lu, desc = %lu",
25 @@ -66,9 +66,9 @@ struct ext3_group_desc * ext3_get_group_
26         }
27         
28         gdp = (struct ext3_group_desc *) 
29 -             sb->u.ext3_sb.s_group_desc[group_desc]->b_data;
30 +             EXT3_SB(sb)->s_group_desc[group_desc]->b_data;
31         if (bh)
32 -               *bh = sb->u.ext3_sb.s_group_desc[group_desc];
33 +               *bh = EXT3_SB(sb)->s_group_desc[group_desc];
34         return gdp + desc;
35  }
36  
37 @@ -104,8 +104,8 @@ static int read_block_bitmap (struct sup
38          * this group.  The IO will be retried next time.
39          */
40  error_out:
41 -       sb->u.ext3_sb.s_block_bitmap_number[bitmap_nr] = block_group;
42 -       sb->u.ext3_sb.s_block_bitmap[bitmap_nr] = bh;
43 +       EXT3_SB(sb)->s_block_bitmap_number[bitmap_nr] = block_group;
44 +       EXT3_SB(sb)->s_block_bitmap[bitmap_nr] = bh;
45         return retval;
46  }
47  
48 @@ -128,16 +128,17 @@ static int __load_block_bitmap (struct s
49         int i, j, retval = 0;
50         unsigned long block_bitmap_number;
51         struct buffer_head * block_bitmap;
52 +       struct ext3_sb_info *sbi = EXT3_SB(sb);
53  
54 -       if (block_group >= sb->u.ext3_sb.s_groups_count)
55 +       if (block_group >= sbi->s_groups_count)
56                 ext3_panic (sb, "load_block_bitmap",
57                             "block_group >= groups_count - "
58                             "block_group = %d, groups_count = %lu",
59 -                           block_group, sb->u.ext3_sb.s_groups_count);
60 +                           block_group, EXT3_SB(sb)->s_groups_count);
61  
62 -       if (sb->u.ext3_sb.s_groups_count <= EXT3_MAX_GROUP_LOADED) {
63 -               if (sb->u.ext3_sb.s_block_bitmap[block_group]) {
64 -                       if (sb->u.ext3_sb.s_block_bitmap_number[block_group] ==
65 +       if (sbi->s_groups_count <= EXT3_MAX_GROUP_LOADED) {
66 +               if (sbi->s_block_bitmap[block_group]) {
67 +                       if (sbi->s_block_bitmap_number[block_group] ==
68                             block_group)
69                                 return block_group;
70                         ext3_error (sb, "__load_block_bitmap",
71 @@ -149,21 +150,20 @@ static int __load_block_bitmap (struct s
72                 return block_group;
73         }
74  
75 -       for (i = 0; i < sb->u.ext3_sb.s_loaded_block_bitmaps &&
76 -                   sb->u.ext3_sb.s_block_bitmap_number[i] != block_group; i++)
77 +       for (i = 0; i < sbi->s_loaded_block_bitmaps &&
78 +                   sbi->s_block_bitmap_number[i] != block_group; i++)
79                 ;
80 -       if (i < sb->u.ext3_sb.s_loaded_block_bitmaps &&
81 -           sb->u.ext3_sb.s_block_bitmap_number[i] == block_group) {
82 -               block_bitmap_number = sb->u.ext3_sb.s_block_bitmap_number[i];
83 -               block_bitmap = sb->u.ext3_sb.s_block_bitmap[i];
84 +       if (i < sbi->s_loaded_block_bitmaps &&
85 +           sbi->s_block_bitmap_number[i] == block_group) {
86 +               block_bitmap_number = sbi->s_block_bitmap_number[i];
87 +               block_bitmap = sbi->s_block_bitmap[i];
88                 for (j = i; j > 0; j--) {
89 -                       sb->u.ext3_sb.s_block_bitmap_number[j] =
90 -                               sb->u.ext3_sb.s_block_bitmap_number[j - 1];
91 -                       sb->u.ext3_sb.s_block_bitmap[j] =
92 -                               sb->u.ext3_sb.s_block_bitmap[j - 1];
93 +                       sbi->s_block_bitmap_number[j] =
94 +                               sbi->s_block_bitmap_number[j - 1];
95 +                       sbi->s_block_bitmap[j] = sbi->s_block_bitmap[j - 1];
96                 }
97 -               sb->u.ext3_sb.s_block_bitmap_number[0] = block_bitmap_number;
98 -               sb->u.ext3_sb.s_block_bitmap[0] = block_bitmap;
99 +               sbi->s_block_bitmap_number[0] = block_bitmap_number;
100 +               sbi->s_block_bitmap[0] = block_bitmap;
101  
102                 /*
103                  * There's still one special case here --- if block_bitmap == 0
104 @@ -173,17 +173,14 @@ static int __load_block_bitmap (struct s
105                 if (!block_bitmap)
106                         retval = read_block_bitmap (sb, block_group, 0);
107         } else {
108 -               if (sb->u.ext3_sb.s_loaded_block_bitmaps<EXT3_MAX_GROUP_LOADED)
109 -                       sb->u.ext3_sb.s_loaded_block_bitmaps++;
110 +               if (sbi->s_loaded_block_bitmaps<EXT3_MAX_GROUP_LOADED)
111 +                       sbi->s_loaded_block_bitmaps++;
112                 else
113 -                       brelse (sb->u.ext3_sb.s_block_bitmap
114 -                                       [EXT3_MAX_GROUP_LOADED - 1]);
115 -               for (j = sb->u.ext3_sb.s_loaded_block_bitmaps - 1;
116 -                                       j > 0;  j--) {
117 -                       sb->u.ext3_sb.s_block_bitmap_number[j] =
118 -                               sb->u.ext3_sb.s_block_bitmap_number[j - 1];
119 -                       sb->u.ext3_sb.s_block_bitmap[j] =
120 -                               sb->u.ext3_sb.s_block_bitmap[j - 1];
121 +                       brelse(sbi->s_block_bitmap[EXT3_MAX_GROUP_LOADED - 1]);
122 +               for (j = sbi->s_loaded_block_bitmaps - 1; j > 0;  j--) {
123 +                       sbi->s_block_bitmap_number[j] =
124 +                               sbi->s_block_bitmap_number[j - 1];
125 +                       sbi->s_block_bitmap[j] = sbi->s_block_bitmap[j - 1];
126                 }
127                 retval = read_block_bitmap (sb, block_group, 0);
128         }
129 @@ -206,24 +203,25 @@ static int __load_block_bitmap (struct s
130  static inline int load_block_bitmap (struct super_block * sb,
131                                      unsigned int block_group)
132  {
133 +       struct ext3_sb_info *sbi = EXT3_SB(sb);
134         int slot;
135 -       
136 +
137         /*
138          * Do the lookup for the slot.  First of all, check if we're asking
139          * for the same slot as last time, and did we succeed that last time?
140          */
141 -       if (sb->u.ext3_sb.s_loaded_block_bitmaps > 0 &&
142 -           sb->u.ext3_sb.s_block_bitmap_number[0] == block_group &&
143 -           sb->u.ext3_sb.s_block_bitmap[0]) {
144 +       if (sbi->s_loaded_block_bitmaps > 0 &&
145 +           sbi->s_block_bitmap_number[0] == block_group &&
146 +           sbi->s_block_bitmap[0]) {
147                 return 0;
148         }
149         /*
150          * Or can we do a fast lookup based on a loaded group on a filesystem
151          * small enough to be mapped directly into the superblock?
152          */
153 -       else if (sb->u.ext3_sb.s_groups_count <= EXT3_MAX_GROUP_LOADED && 
154 -                sb->u.ext3_sb.s_block_bitmap_number[block_group]==block_group
155 -                       && sb->u.ext3_sb.s_block_bitmap[block_group]) {
156 +       else if (sbi->s_groups_count <= EXT3_MAX_GROUP_LOADED &&
157 +                sbi->s_block_bitmap_number[block_group] == block_group
158 +                       && sbi->s_block_bitmap[block_group]) {
159                 slot = block_group;
160         }
161         /*
162 @@ -243,7 +241,7 @@ static inline int load_block_bitmap (str
163          * If it's a valid slot, we may still have cached a previous IO error,
164          * in which case the bh in the superblock cache will be zero.
165          */
166 -       if (!sb->u.ext3_sb.s_block_bitmap[slot])
167 +       if (!sbi->s_block_bitmap[slot])
168                 return -EIO;
169         
170         /*
171 @@ -275,7 +273,7 @@ void ext3_free_blocks (handle_t *handle,
172                 return;
173         }
174         lock_super (sb);
175 -       es = sb->u.ext3_sb.s_es;
176 +       es = EXT3_SB(sb)->s_es;
177         if (block < le32_to_cpu(es->s_first_data_block) ||
178             block + count < block ||
179             (block + count) > le32_to_cpu(es->s_blocks_count)) {
180 @@ -304,7 +302,7 @@ do_more:
181         if (bitmap_nr < 0)
182                 goto error_return;
183         
184 -       bitmap_bh = sb->u.ext3_sb.s_block_bitmap[bitmap_nr];
185 +       bitmap_bh = EXT3_SB(sb)->s_block_bitmap[bitmap_nr];
186         gdp = ext3_get_group_desc (sb, block_group, &gd_bh);
187         if (!gdp)
188                 goto error_return;
189 @@ -330,8 +328,8 @@ do_more:
190         if (err)
191                 goto error_return;
192  
193 -       BUFFER_TRACE(sb->u.ext3_sb.s_sbh, "get_write_access");
194 -       err = ext3_journal_get_write_access(handle, sb->u.ext3_sb.s_sbh);
195 +       BUFFER_TRACE(EXT3_SB(sb)->s_sbh, "get_write_access");
196 +       err = ext3_journal_get_write_access(handle, EXT3_SB(sb)->s_sbh);
197         if (err)
198                 goto error_return;
199  
200 @@ -341,7 +339,7 @@
201                 if (block == le32_to_cpu(gdp->bg_block_bitmap) ||
202                     block == le32_to_cpu(gdp->bg_inode_bitmap) ||
203                     in_range(block, le32_to_cpu(gdp->bg_inode_table),
204 -                            sb->u.ext2_sb.s_itb_per_group)) {
205 +                            EXT3_SB(sb)->s_itb_per_group)) {
206                         ext3_error(sb, __FUNCTION__,
207                                    "Freeing block in system zone - block = %lu",
208                                    block);
209 @@ -410,8 +407,8 @@ do_more:
210         if (!err) err = ret;
211  
212         /* And the superblock */
213 -       BUFFER_TRACE(sb->u.ext3_sb.s_sbh, "dirtied superblock");
214 -       ret = ext3_journal_dirty_metadata(handle, sb->u.ext3_sb.s_sbh);
215 +       BUFFER_TRACE(EXT3_SB(sb)->s_sbh, "dirtied superblock");
216 +       ret = ext3_journal_dirty_metadata(handle, EXT3_SB(sb)->s_sbh);
217         if (!err) err = ret;
218  
219         if (overflow && !err) {
220 @@ -564,12 +560,12 @@ int ext3_new_block (handle_t *handle, st
221         }
222  
223         lock_super (sb);
224 -       es = sb->u.ext3_sb.s_es;
225 +       es = EXT3_SB(sb)->s_es;
226         if (le32_to_cpu(es->s_free_blocks_count) <=
227                         le32_to_cpu(es->s_r_blocks_count) &&
228 -           ((sb->u.ext3_sb.s_resuid != current->fsuid) &&
229 -            (sb->u.ext3_sb.s_resgid == 0 ||
230 -             !in_group_p (sb->u.ext3_sb.s_resgid)) && 
231 +           ((EXT3_SB(sb)->s_resuid != current->fsuid) &&
232 +            (EXT3_SB(sb)->s_resgid == 0 ||
233 +             !in_group_p (EXT3_SB(sb)->s_resgid)) &&
234              !capable(CAP_SYS_RESOURCE)))
235                 goto out;
236  
237 @@ -598,7 +595,7 @@ int ext3_new_block (handle_t *handle, st
238                 if (bitmap_nr < 0)
239                         goto io_error;
240                 
241 -               bh = sb->u.ext3_sb.s_block_bitmap[bitmap_nr];
242 +               bh = EXT3_SB(sb)->s_block_bitmap[bitmap_nr];
243  
244                 ext3_debug ("goal is at %d:%d.\n", i, j);
245  
246 @@ -621,9 +618,9 @@ int ext3_new_block (handle_t *handle, st
247          * Now search the rest of the groups.  We assume that 
248          * i and gdp correctly point to the last group visited.
249          */
250 -       for (k = 0; k < sb->u.ext3_sb.s_groups_count; k++) {
251 +       for (k = 0; k < EXT3_SB(sb)->s_groups_count; k++) {
252                 i++;
253 -               if (i >= sb->u.ext3_sb.s_groups_count)
254 +               if (i >= EXT3_SB(sb)->s_groups_count)
255                         i = 0;
256                 gdp = ext3_get_group_desc (sb, i, &bh2);
257                 if (!gdp) {
258 @@ -635,7 +632,7 @@ int ext3_new_block (handle_t *handle, st
259                         if (bitmap_nr < 0)
260                                 goto io_error;
261         
262 -                       bh = sb->u.ext3_sb.s_block_bitmap[bitmap_nr];
263 +                       bh = EXT3_SB(sb)->s_block_bitmap[bitmap_nr];
264                         j = find_next_usable_block(-1, bh, 
265                                                    EXT3_BLOCKS_PER_GROUP(sb));
266                         if (j >= 0) 
267 @@ -674,8 +671,8 @@ got_block:
268         fatal = ext3_journal_get_write_access(handle, bh2);
269         if (fatal) goto out;
270  
271 -       BUFFER_TRACE(sb->u.ext3_sb.s_sbh, "get_write_access");
272 -       fatal = ext3_journal_get_write_access(handle, sb->u.ext3_sb.s_sbh);
273 +       BUFFER_TRACE(EXT3_SB(sb)->s_sbh, "get_write_access");
274 +       fatal = ext3_journal_get_write_access(handle, EXT3_SB(sb)->s_sbh);
275         if (fatal) goto out;
276  
277         tmp = j + i * EXT3_BLOCKS_PER_GROUP(sb)
278 @@ -796,7 +804,7 @@ got_block:
279         if (!fatal) fatal = err;
280         
281         BUFFER_TRACE(bh, "journal_dirty_metadata for superblock");
282 -       err = ext3_journal_dirty_metadata(handle, sb->u.ext3_sb.s_sbh);
283 +       err = ext3_journal_dirty_metadata(handle, EXT3_SB(sb)->s_sbh);
284         if (!fatal) fatal = err;
285  
286         sb->s_dirt = 1;
287 @@ -829,11 +837,11 @@ unsigned long ext3_count_free_blocks (st
288         int i;
289         
290         lock_super (sb);
291 -       es = sb->u.ext3_sb.s_es;
292 +       es = EXT3_SB(sb)->s_es;
293         desc_count = 0;
294         bitmap_count = 0;
295         gdp = NULL;
296 -       for (i = 0; i < sb->u.ext3_sb.s_groups_count; i++) {
297 +       for (i = 0; i < EXT3_SB(sb)->s_groups_count; i++) {
298                 gdp = ext3_get_group_desc (sb, i, NULL);
299                 if (!gdp)
300                         continue;
301 @@ -842,7 +850,7 @@ unsigned long ext3_count_free_blocks (st
302                 if (bitmap_nr < 0)
303                         continue;
304                 
305 -               x = ext3_count_free (sb->u.ext3_sb.s_block_bitmap[bitmap_nr],
306 +               x = ext3_count_free (EXT3_SB(sb)->s_block_bitmap[bitmap_nr],
307                                      sb->s_blocksize);
308                 printk ("group %d: stored = %d, counted = %lu\n",
309                         i, le16_to_cpu(gdp->bg_free_blocks_count), x);
310 @@ -853,7 +861,7 @@ unsigned long ext3_count_free_blocks (st
311         unlock_super (sb);
312         return bitmap_count;
313  #else
314 -       return le32_to_cpu(sb->u.ext3_sb.s_es->s_free_blocks_count);
315 +       return le32_to_cpu(EXT3_SB(sb)->s_es->s_free_blocks_count);
316  #endif
317  }
318  
319 @@ -862,7 +870,7 @@ static inline int block_in_use (unsigned
320                                 unsigned char * map)
321  {
322         return ext3_test_bit ((block -
323 -               le32_to_cpu(sb->u.ext3_sb.s_es->s_first_data_block)) %
324 +               le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block)) %
325                          EXT3_BLOCKS_PER_GROUP(sb), map);
326  }
327  
328 @@ -930,11 +938,11 @@ void ext3_check_blocks_bitmap (struct su
329         struct ext3_group_desc * gdp;
330         int i;
331  
332 -       es = sb->u.ext3_sb.s_es;
333 +       es = EXT3_SB(sb)->s_es;
334         desc_count = 0;
335         bitmap_count = 0;
336         gdp = NULL;
337 -       for (i = 0; i < sb->u.ext3_sb.s_groups_count; i++) {
338 +       for (i = 0; i < EXT3_SB(sb)->s_groups_count; i++) {
339                 gdp = ext3_get_group_desc (sb, i, NULL);
340                 if (!gdp)
341                         continue;
342 @@ -968,7 +976,7 @@ void ext3_check_blocks_bitmap (struct su
343                                     "Inode bitmap for group %d is marked free",
344                                     i);
345  
346 -               for (j = 0; j < sb->u.ext3_sb.s_itb_per_group; j++)
347 +               for (j = 0; j < EXT3_SB(sb)->s_itb_per_group; j++)
348                         if (!block_in_use (le32_to_cpu(gdp->bg_inode_table) + j,
349                                                         sb, bh->b_data))
350                                 ext3_error (sb, "ext3_check_blocks_bitmap",
351 --- ./fs/ext3/dir.c.orig        Fri Apr 12 10:27:49 2002
352 +++ ./fs/ext3/dir.c     Tue May  7 14:54:13 2002
353 @@ -52,7 +52,7 @@ int ext3_check_dir_entry (const char * f
354         else if (((char *) de - bh->b_data) + rlen > dir->i_sb->s_blocksize)
355                 error_msg = "directory entry across blocks";
356         else if (le32_to_cpu(de->inode) >
357 -                       le32_to_cpu(dir->i_sb->u.ext3_sb.s_es->s_inodes_count))
358 +                       le32_to_cpu(EXT3_SB(dir->i_sb)->s_es->s_inodes_count))
359                 error_msg = "inode out of bounds";
360  
361         if (error_msg != NULL)
362 --- ./fs/ext3/ialloc.c.orig     Fri Apr 12 10:27:49 2002
363 +++ ./fs/ext3/ialloc.c  Tue May  7 15:39:26 2002
364 @@ -73,8 +73,8 @@ static int read_inode_bitmap (struct sup
365          * this group.  The IO will be retried next time.
366          */
367  error_out:
368 -       sb->u.ext3_sb.s_inode_bitmap_number[bitmap_nr] = block_group;
369 -       sb->u.ext3_sb.s_inode_bitmap[bitmap_nr] = bh;
370 +       EXT3_SB(sb)->s_inode_bitmap_number[bitmap_nr] = block_group;
371 +       EXT3_SB(sb)->s_inode_bitmap[bitmap_nr] = bh;
372         return retval;
373  }
374  
375 @@ -225,7 +225,7 @@ void ext3_free_inode (handle_t *handle, 
376         clear_inode (inode);
377  
378         lock_super (sb);
379 -       es = sb->u.ext3_sb.s_es;
380 +       es = EXT3_SB(sb)->s_es;
381         if (ino < EXT3_FIRST_INO(sb) || ino > le32_to_cpu(es->s_inodes_count)) {
382                 ext3_error (sb, "ext3_free_inode",
383                             "reserved or nonexistent inode %lu", ino);
384 @@ -237,7 +237,7 @@ void ext3_free_inode (handle_t *handle, 
385         if (bitmap_nr < 0)
386                 goto error_return;
387  
388 -       bh = sb->u.ext3_sb.s_inode_bitmap[bitmap_nr];
389 +       bh = EXT3_SB(sb)->s_inode_bitmap[bitmap_nr];
390  
391         BUFFER_TRACE(bh, "get_write_access");
392         fatal = ext3_journal_get_write_access(handle, bh);
393 @@ -255,8 +255,8 @@ void ext3_free_inode (handle_t *handle, 
394                 fatal = ext3_journal_get_write_access(handle, bh2);
395                 if (fatal) goto error_return;
396  
397 -               BUFFER_TRACE(sb->u.ext3_sb.s_sbh, "get write access");
398 -               fatal = ext3_journal_get_write_access(handle, sb->u.ext3_sb.s_sbh);
399 +               BUFFER_TRACE(EXT3_SB(sb)->s_sbh, "get write access");
400 +               fatal = ext3_journal_get_write_access(handle, EXT3_SB(sb)->s_sbh);
401                 if (fatal) goto error_return;
402  
403                 if (gdp) {
404 @@ -271,9 +271,9 @@ void ext3_free_inode (handle_t *handle, 
405                 if (!fatal) fatal = err;
406                 es->s_free_inodes_count =
407                         cpu_to_le32(le32_to_cpu(es->s_free_inodes_count) + 1);
408 -               BUFFER_TRACE(sb->u.ext3_sb.s_sbh,
409 +               BUFFER_TRACE(EXT3_SB(sb)->s_sbh,
410                                         "call ext3_journal_dirty_metadata");
411 -               err = ext3_journal_dirty_metadata(handle, sb->u.ext3_sb.s_sbh);
412 +               err = ext3_journal_dirty_metadata(handle, EXT3_SB(sb)->s_sbh);
413                 if (!fatal) fatal = err;
414         }
415         BUFFER_TRACE(bh, "call ext3_journal_dirty_metadata");
416 @@ -305,6 +305,8 @@ struct inode * ext3_new_inode (handle_t 
417         int i, j, avefreei;
418         struct inode * inode;
419         int bitmap_nr;
420 +       struct ext3_inode_info *ei;
421 +       struct ext3_sb_info *sbi;
422         struct ext3_group_desc * gdp;
423         struct ext3_group_desc * tmp;
424         struct ext3_super_block * es;
425 @@ -318,19 +320,21 @@ struct inode * ext3_new_inode (handle_t 
426         inode = new_inode(sb);
427         if (!inode)
428                 return ERR_PTR(-ENOMEM);
429 -       init_rwsem(&inode->u.ext3_i.truncate_sem);
430 +       sbi = EXT3_SB(sb);
431 +       ei = EXT3_I(inode);
432 +       init_rwsem(&ei->truncate_sem);
433  
434         lock_super (sb);
435 -       es = sb->u.ext3_sb.s_es;
436 +       es = sbi->s_es;
437  repeat:
438         gdp = NULL;
439         i = 0;
440  
441         if (S_ISDIR(mode)) {
442                 avefreei = le32_to_cpu(es->s_free_inodes_count) /
443 -                       sb->u.ext3_sb.s_groups_count;
444 +                       sbi->s_groups_count;
445                 if (!gdp) {
446 -                       for (j = 0; j < sb->u.ext3_sb.s_groups_count; j++) {
447 +                       for (j = 0; j < sbi->s_groups_count; j++) {
448                                 struct buffer_head *temp_buffer;
449                                 tmp = ext3_get_group_desc (sb, j, &temp_buffer);
450                                 if (tmp &&
451 @@ -350,7 +354,7 @@ repeat:
452                 /*
453                  * Try to place the inode in its parent directory
454                  */
455 -               i = dir->u.ext3_i.i_block_group;
456 +               i = EXT3_I(dir)->i_block_group;
457                 tmp = ext3_get_group_desc (sb, i, &bh2);
458                 if (tmp && le16_to_cpu(tmp->bg_free_inodes_count))
459                         gdp = tmp;
460 @@ -360,10 +364,10 @@ repeat:
461                          * Use a quadratic hash to find a group with a
462                          * free inode
463                          */
464 -                       for (j = 1; j < sb->u.ext3_sb.s_groups_count; j <<= 1) {
465 +                       for (j = 1; j < sbi->s_groups_count; j <<= 1) {
466                                 i += j;
467 -                               if (i >= sb->u.ext3_sb.s_groups_count)
468 -                                       i -= sb->u.ext3_sb.s_groups_count;
469 +                               if (i >= sbi->s_groups_count)
470 +                                       i -= sbi->s_groups_count;
471                                 tmp = ext3_get_group_desc (sb, i, &bh2);
472                                 if (tmp &&
473                                     le16_to_cpu(tmp->bg_free_inodes_count)) {
474 @@ -376,9 +380,9 @@ repeat:
475                         /*
476                          * That failed: try linear search for a free inode
477                          */
478 -                       i = dir->u.ext3_i.i_block_group + 1;
479 -                       for (j = 2; j < sb->u.ext3_sb.s_groups_count; j++) {
480 -                               if (++i >= sb->u.ext3_sb.s_groups_count)
481 +                       i = EXT3_I(dir)->i_block_group + 1;
482 +                       for (j = 2; j < sbi->s_groups_count; j++) {
483 +                               if (++i >= sbi->s_groups_count)
484                                         i = 0;
485                                 tmp = ext3_get_group_desc (sb, i, &bh2);
486                                 if (tmp &&
487 @@ -399,11 +403,11 @@ repeat:
488         if (bitmap_nr < 0)
489                 goto fail;
490  
491 -       bh = sb->u.ext3_sb.s_inode_bitmap[bitmap_nr];
492 +       bh = sbi->s_inode_bitmap[bitmap_nr];
493  
494         if ((j = ext3_find_first_zero_bit ((unsigned long *) bh->b_data,
495 -                                     EXT3_INODES_PER_GROUP(sb))) <
496 -           EXT3_INODES_PER_GROUP(sb)) {
497 +                                     sbi->s_inodes_per_group)) <
498 +           sbi->s_inodes_per_group) {
499                 BUFFER_TRACE(bh, "get_write_access");
500                 err = ext3_journal_get_write_access(handle, bh);
501                 if (err) goto fail;
502 @@ -436,8 +440,8 @@ repeat:
503                 }
504                 goto repeat;
505         }
506 -       j += i * EXT3_INODES_PER_GROUP(sb) + 1;
507 -       if (j < EXT3_FIRST_INO(sb) || j > le32_to_cpu(es->s_inodes_count)) {
508 +       j += i * sbi->s_inodes_per_group + 1;
509 +       if (j < sbi->s_first_ino || j > le32_to_cpu(es->s_inodes_count)) {
510                 ext3_error (sb, "ext3_new_inode",
511                             "reserved inode or inode > inodes count - "
512                             "block_group = %d,inode=%d", i, j);
513 @@ -457,13 +461,13 @@ repeat:
514         err = ext3_journal_dirty_metadata(handle, bh2);
515         if (err) goto fail;
516         
517 -       BUFFER_TRACE(sb->u.ext3_sb.s_sbh, "get_write_access");
518 -       err = ext3_journal_get_write_access(handle, sb->u.ext3_sb.s_sbh);
519 +       BUFFER_TRACE(sbi->s_sbh, "get_write_access");
520 +       err = ext3_journal_get_write_access(handle, sbi->s_sbh);
521         if (err) goto fail;
522         es->s_free_inodes_count =
523                 cpu_to_le32(le32_to_cpu(es->s_free_inodes_count) - 1);
524 -       BUFFER_TRACE(sb->u.ext3_sb.s_sbh, "call ext3_journal_dirty_metadata");
525 -       err = ext3_journal_dirty_metadata(handle, sb->u.ext3_sb.s_sbh);
526 +       BUFFER_TRACE(sbi->s_sbh, "call ext3_journal_dirty_metadata");
527 +       err = ext3_journal_dirty_metadata(handle, sbi->s_sbh);
528         sb->s_dirt = 1;
529         if (err) goto fail;
530  
531 @@ -483,31 +487,31 @@ repeat:
532         inode->i_blksize = PAGE_SIZE;
533         inode->i_blocks = 0;
534         inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
535 -       inode->u.ext3_i.i_flags = dir->u.ext3_i.i_flags & ~EXT3_INDEX_FL;
536 +       ei->i_flags = EXT3_I(dir)->i_flags & ~EXT3_INDEX_FL;
537         if (S_ISLNK(mode))
538 -               inode->u.ext3_i.i_flags &= ~(EXT3_IMMUTABLE_FL|EXT3_APPEND_FL);
539 +               ei->i_flags &= ~(EXT3_IMMUTABLE_FL|EXT3_APPEND_FL);
540  #ifdef EXT3_FRAGMENTS
541 -       inode->u.ext3_i.i_faddr = 0;
542 -       inode->u.ext3_i.i_frag_no = 0;
543 -       inode->u.ext3_i.i_frag_size = 0;
544 +       ei->i_faddr = 0;
545 +       ei->i_frag_no = 0;
546 +       ei->i_frag_size = 0;
547  #endif
548 -       inode->u.ext3_i.i_file_acl = 0;
549 -       inode->u.ext3_i.i_dir_acl = 0;
550 -       inode->u.ext3_i.i_dtime = 0;
551 -       INIT_LIST_HEAD(&inode->u.ext3_i.i_orphan);
552 +       ei->i_file_acl = 0;
553 +       ei->i_dir_acl = 0;
554 +       ei->i_dtime = 0;
555 +       INIT_LIST_HEAD(&ei->i_orphan);
556  #ifdef EXT3_PREALLOCATE
557 -       inode->u.ext3_i.i_prealloc_count = 0;
558 +       ei->i_prealloc_count = 0;
559  #endif
560 -       inode->u.ext3_i.i_block_group = i;
561 +       ei->i_block_group = i;
562         
563 -       if (inode->u.ext3_i.i_flags & EXT3_SYNC_FL)
564 +       if (ei->i_flags & EXT3_SYNC_FL)
565                 inode->i_flags |= S_SYNC;
566         if (IS_SYNC(inode))
567                 handle->h_sync = 1;
568         insert_inode_hash(inode);
569 -       inode->i_generation = sb->u.ext3_sb.s_next_generation++;
570 +       inode->i_generation = sbi->s_next_generation++;
571  
572 -       inode->u.ext3_i.i_state = EXT3_STATE_NEW;
573 +       ei->i_state = EXT3_STATE_NEW;
574         err = ext3_mark_inode_dirty(handle, inode);
575         if (err) goto fail;
576         
577 @@ -585,19 +589,19 @@ struct inode *ext3_orphan_get (struct su
578  
579  unsigned long ext3_count_free_inodes (struct super_block * sb)
580  {
581 +       struct ext3_sb_info *sbi = EXT3_SB(sb);
582 +       struct ext3_super_block *es = sbi->s_es;
583  #ifdef EXT3FS_DEBUG
584 -       struct ext3_super_block * es;
585         unsigned long desc_count, bitmap_count, x;
586         int bitmap_nr;
587         struct ext3_group_desc * gdp;
588         int i;
589  
590         lock_super (sb);
591 -       es = sb->u.ext3_sb.s_es;
592         desc_count = 0;
593         bitmap_count = 0;
594         gdp = NULL;
595 -       for (i = 0; i < sb->u.ext3_sb.s_groups_count; i++) {
596 +       for (i = 0; i < sbi->s_groups_count; i++) {
597                 gdp = ext3_get_group_desc (sb, i, NULL);
598                 if (!gdp)
599                         continue;
600 @@ -606,8 +610,8 @@ unsigned long ext3_count_free_inodes (st
601                 if (bitmap_nr < 0)
602                         continue;
603  
604 -               x = ext3_count_free (sb->u.ext3_sb.s_inode_bitmap[bitmap_nr],
605 -                                    EXT3_INODES_PER_GROUP(sb) / 8);
606 +               x = ext3_count_free(sbi->s_inode_bitmap[bitmap_nr],
607 +                                   sbi->s_inodes_per_group / 8);
608                 printk ("group %d: stored = %d, counted = %lu\n",
609                         i, le16_to_cpu(gdp->bg_free_inodes_count), x);
610                 bitmap_count += x;
611 @@ -617,7 +621,7 @@ unsigned long ext3_count_free_inodes (st
612         unlock_super (sb);
613         return desc_count;
614  #else
615 -       return le32_to_cpu(sb->u.ext3_sb.s_es->s_free_inodes_count);
616 +       return le32_to_cpu(es->s_free_inodes_count);
617  #endif
618  }
619  
620 @@ -626,16 +630,18 @@ unsigned long ext3_count_free_inodes (st
621  void ext3_check_inodes_bitmap (struct super_block * sb)
622  {
623         struct ext3_super_block * es;
624 +       struct ext3_sb_info *sbi;
625         unsigned long desc_count, bitmap_count, x;
626         int bitmap_nr;
627         struct ext3_group_desc * gdp;
628         int i;
629  
630 -       es = sb->u.ext3_sb.s_es;
631 +       sbi = EXT3_SB(sb);
632 +       es = sbi->s_es;
633         desc_count = 0;
634         bitmap_count = 0;
635         gdp = NULL;
636 -       for (i = 0; i < sb->u.ext3_sb.s_groups_count; i++) {
637 +       for (i = 0; i < sbi->s_groups_count; i++) {
638                 gdp = ext3_get_group_desc (sb, i, NULL);
639                 if (!gdp)
640                         continue;
641 @@ -644,7 +650,7 @@ void ext3_check_inodes_bitmap (struct su
642                 if (bitmap_nr < 0)
643                         continue;
644  
645 -               x = ext3_count_free (sb->u.ext3_sb.s_inode_bitmap[bitmap_nr],
646 +               x = ext3_count_free (sbi->s_inode_bitmap[bitmap_nr],
647                                      EXT3_INODES_PER_GROUP(sb) / 8);
648                 if (le16_to_cpu(gdp->bg_free_inodes_count) != x)
649                         ext3_error (sb, "ext3_check_inodes_bitmap",
650 --- ./fs/ext3/inode.c.orig      Fri Apr 12 10:27:49 2002
651 +++ ./fs/ext3/inode.c   Tue May  7 15:41:23 2002
652 @@ -196,7 +196,7 @@ void ext3_delete_inode (struct inode * i
653          * (Well, we could do this if we need to, but heck - it works)
654          */
655         ext3_orphan_del(handle, inode);
656 -       inode->u.ext3_i.i_dtime = CURRENT_TIME;
657 +       EXT3_I(inode)->i_dtime = CURRENT_TIME;
658  
659         /* 
660          * One subtle ordering requirement: if anything has gone wrong
661 @@ -220,13 +220,14 @@ no_delete:
662  void ext3_discard_prealloc (struct inode * inode)
663  {
664  #ifdef EXT3_PREALLOCATE
665 +       struct ext3_inode_info *ei = EXT3_I(inode);
666         lock_kernel();
667         /* Writer: ->i_prealloc* */
668 -       if (inode->u.ext3_i.i_prealloc_count) {
669 -               unsigned short total = inode->u.ext3_i.i_prealloc_count;
670 -               unsigned long block = inode->u.ext3_i.i_prealloc_block;
671 -               inode->u.ext3_i.i_prealloc_count = 0;
672 -               inode->u.ext3_i.i_prealloc_block = 0;
673 +       if (ei->i_prealloc_count) {
674 +               unsigned short total = ei->i_prealloc_count;
675 +               unsigned long block = ei->i_prealloc_block;
676 +               ei->i_prealloc_count = 0;
677 +               ei->i_prealloc_block = 0;
678                 /* Writer: end */
679                 ext3_free_blocks (inode, block, total);
680         }
681 @@ -243,13 +244,15 @@ static int ext3_alloc_block (handle_t *h
682         unsigned long result;
683  
684  #ifdef EXT3_PREALLOCATE
685 +       struct ext3_inode_info *ei = EXT3_I(inode);
686 +
687         /* Writer: ->i_prealloc* */
688 -       if (inode->u.ext3_i.i_prealloc_count &&
689 -           (goal == inode->u.ext3_i.i_prealloc_block ||
690 -            goal + 1 == inode->u.ext3_i.i_prealloc_block))
691 +       if (ei->i_prealloc_count &&
692 +           (goal == ei->i_prealloc_block ||
693 +            goal + 1 == ei->i_prealloc_block))
694         {
695 -               result = inode->u.ext3_i.i_prealloc_block++;
696 -               inode->u.ext3_i.i_prealloc_count--;
697 +               result = ei->i_prealloc_block++;
698 +               ei->i_prealloc_count--;
699                 /* Writer: end */
700                 ext3_debug ("preallocation hit (%lu/%lu).\n",
701                             ++alloc_hits, ++alloc_attempts);
702 @@ -259,8 +262,8 @@ static int ext3_alloc_block (handle_t *h
703                             alloc_hits, ++alloc_attempts);
704                 if (S_ISREG(inode->i_mode))
705                         result = ext3_new_block (inode, goal, 
706 -                                &inode->u.ext3_i.i_prealloc_count,
707 -                                &inode->u.ext3_i.i_prealloc_block, err);
708 +                                &ei->i_prealloc_count,
709 +                                &ei->i_prealloc_block, err);
710                 else
711                         result = ext3_new_block (inode, goal, 0, 0, err);
712                 /*
713 @@ -394,7 +397,7 @@ static Indirect *ext3_get_branch(struct 
714  
715         *err = 0;
716         /* i_data is not going away, no lock needed */
717 -       add_chain (chain, NULL, inode->u.ext3_i.i_data + *offsets);
718 +       add_chain (chain, NULL, EXT3_I(inode)->i_data + *offsets);
719         if (!p->key)
720                 goto no_block;
721         while (--depth) {
722 @@ -437,7 +440,8 @@ no_block:
723  
724  static inline unsigned long ext3_find_near(struct inode *inode, Indirect *ind)
725  {
726 -       u32 *start = ind->bh ? (u32*) ind->bh->b_data : inode->u.ext3_i.i_data;
727 +       struct ext3_inode_info *ei = EXT3_I(inode);
728 +       u32 *start = ind->bh ? (u32*) ind->bh->b_data : ei->i_data;
729         u32 *p;
730  
731         /* Try to find previous block */
732 @@ -453,9 +456,8 @@ static inline unsigned long ext3_find_ne
733          * It is going to be refered from inode itself? OK, just put it into
734          * the same cylinder group then.
735          */
736 -       return (inode->u.ext3_i.i_block_group * 
737 -               EXT3_BLOCKS_PER_GROUP(inode->i_sb)) +
738 -              le32_to_cpu(inode->i_sb->u.ext3_sb.s_es->s_first_data_block);
739 +       return (ei->i_block_group * EXT3_BLOCKS_PER_GROUP(inode->i_sb)) +
740 +              le32_to_cpu(EXT3_SB(inode->i_sb)->s_es->s_first_data_block);
741  }
742  
743  /**
744 @@ -474,14 +477,15 @@
745  static int ext3_find_goal(struct inode *inode, long block, Indirect chain[4],
746                           Indirect *partial, unsigned long *goal)
747  {
748 +       struct ext3_inode_info *ei = EXT3_I(inode);
749         /* Writer: ->i_next_alloc* */
750 -       if (block == inode->u.ext3_i.i_next_alloc_block + 1) {
751 -               inode->u.ext3_i.i_next_alloc_block++;
752 -               inode->u.ext3_i.i_next_alloc_goal++;
753 +       if (block == ei->i_next_alloc_block + 1) {
754 +               ei->i_next_alloc_block++;
755 +               ei->i_next_alloc_goal++;
756         }
757  #ifdef SEARCH_FROM_ZERO
758 -       inode->u.ext3_i.i_next_alloc_block = 0;
759 -       inode->u.ext3_i.i_next_alloc_goal = 0;
760 +       ei->i_next_alloc_block = 0;
761 +       ei->i_next_alloc_goal = 0;
762  #endif
763         /* Writer: end */
764         /* Reader: pointers, ->i_next_alloc* */
765 @@ -490,8 +493,8 @@ static int ext3_find_goal(struct inode *
766                  * try the heuristic for sequential allocation,
767                  * failing that at least try to get decent locality.
768                  */
769 -               if (block == inode->u.ext3_i.i_next_alloc_block)
770 -                       *goal = inode->u.ext3_i.i_next_alloc_goal;
771 +               if (block == ei->i_next_alloc_block)
772 +                       *goal = ei->i_next_alloc_goal;
773                 if (!*goal)
774                         *goal = ext3_find_near(inode, partial);
775  #ifdef SEARCH_FROM_ZERO
776 @@ -619,6 +621,7 @@
777  {
778         int i;
779         int err = 0;
780 +       struct ext3_inode_info *ei = EXT3_I(inode);
781  
782         /*
783          * If we're splicing into a [td]indirect block (as opposed to the
784 @@ -641,11 +644,11 @@ static int ext3_splice_branch(handle_t *
785         /* That's it */
786  
787         *where->p = where->key;
788 -       inode->u.ext3_i.i_next_alloc_block = block;
789 -       inode->u.ext3_i.i_next_alloc_goal = le32_to_cpu(where[num-1].key);
790 +       ei->i_next_alloc_block = block;
791 +       ei->i_next_alloc_goal = le32_to_cpu(where[num-1].key);
792  #ifdef SEARCH_FROM_ZERO
793 -       inode->u.ext3_i.i_next_alloc_block = 0;
794 -       inode->u.ext3_i.i_next_alloc_goal = 0;
795 +       ei->i_next_alloc_block = 0;
796 +       ei->i_next_alloc_goal = 0;
797  #endif
798         /* Writer: end */
799  
800 @@ -729,6 +732,7 @@
801         unsigned long goal;
802         int left;
803         int depth = ext3_block_to_path(inode, iblock, offsets);
804 +       struct ext3_inode_info *ei = EXT3_I(inode);
805         loff_t new_size;
806  
807         J_ASSERT(handle != NULL || create == 0);
808 @@ -782,7 +785,7 @@ out:
809         /*
810          * Block out ext3_truncate while we alter the tree
811          */
812 -       down_read(&inode->u.ext3_i.truncate_sem);
813 +       down_read(&ei->truncate_sem);
814         err = ext3_alloc_branch(handle, inode, left, goal,
815                                         offsets+(partial-chain), partial);
816  
817 @@ -794,7 +797,7 @@ out:
818         if (!err)
819                 err = ext3_splice_branch(handle, inode, iblock, chain,
820                                          partial, left);
821 -       up_read(&inode->u.ext3_i.truncate_sem);
822 +       up_read(&ei->truncate_sem);
823         if (err == -EAGAIN)
824                 goto changed;
825         if (err)
826 @@ -807,8 +810,8 @@ out:
827          * truncate is in progress.  It is racy between multiple parallel
828          * instances of get_block, but we have the BKL.
829          */
830 -       if (new_size > inode->u.ext3_i.i_disksize)
831 -               inode->u.ext3_i.i_disksize = new_size;
832 +       if (new_size > ei->i_disksize)
833 +               ei->i_disksize = new_size;
834  
835         bh_result->b_state |= (1UL << BH_New);
836         goto got_it;
837 @@ -921,7 +924,7 @@ struct buffer_head *ext3_bread(handle_t 
838                 struct buffer_head *tmp_bh;
839  
840                 for (i = 1;
841 -                    inode->u.ext3_i.i_prealloc_count &&
842 +                    EXT3_I(inode)->i_prealloc_count &&
843                      i < EXT3_SB(inode->i_sb)->s_es->s_prealloc_dir_blocks;
844                      i++) {
845                         /*
846 @@ -1131,8 +1134,8 @@ static int ext3_commit_write(struct file
847                         kunmap(page);
848                 }
849         }
850 -       if (inode->i_size > inode->u.ext3_i.i_disksize) {
851 -               inode->u.ext3_i.i_disksize = inode->i_size;
852 +       if (inode->i_size > EXT3_I(inode)->i_disksize) {
853 +               EXT3_I(inode)->i_disksize = inode->i_size;
854                 ret2 = ext3_mark_inode_dirty(handle, inode);
855                 if (!ret) 
856                         ret = ret2;
857 @@ -1832,7 +1835,8 @@ static void ext3_free_branches(handle_t 
858  void ext3_truncate(struct inode * inode)
859  {
860         handle_t *handle;
861 -       u32 *i_data = inode->u.ext3_i.i_data;
862 +       struct ext3_inode_info *ei = EXT3_I(inode);
863 +       u32 *i_data = EXT3_I(inode)->i_data;
864         int addr_per_block = EXT3_ADDR_PER_BLOCK(inode->i_sb);
865         int offsets[4];
866         Indirect chain[4];
867 @@ -1884,13 +1887,13 @@ void ext3_truncate(struct inode * inode)
868          * on-disk inode. We do this via i_disksize, which is the value which
869          * ext3 *really* writes onto the disk inode.
870          */
871 -       inode->u.ext3_i.i_disksize = inode->i_size;
872 +       ei->i_disksize = inode->i_size;
873  
874         /*
875          * From here we block out all ext3_get_block() callers who want to
876          * modify the block allocation tree.
877          */
878 -       down_write(&inode->u.ext3_i.truncate_sem);
879 +       down_write(&ei->truncate_sem);
880  
881         if (n == 1) {           /* direct blocks */
882                 ext3_free_data(handle, inode, NULL, i_data+offsets[0],
883 @@ -1954,7 +1957,7 @@ do_indirects:
884                 case EXT3_TIND_BLOCK:
885                         ;
886         }
887 -       up_write(&inode->u.ext3_i.truncate_sem);
888 +       up_write(&ei->truncate_sem);
889         inode->i_mtime = inode->i_ctime = CURRENT_TIME;
890         ext3_mark_inode_dirty(handle, inode);
891  
892 @@ -1983,6 +1986,8 @@ out_stop:
893  
894  int ext3_get_inode_loc (struct inode *inode, struct ext3_iloc *iloc)
895  {
896 +       struct super_block *sb = inode->i_sb;
897 +       struct ext3_sb_info *sbi = EXT3_SB(sb);
898         struct buffer_head *bh = 0;
899         unsigned long block;
900         unsigned long block_group;
901 @@ -1997,23 +2010,19 @@ int ext3_get_inode_loc (struct inode *in
902                 inode->i_ino != EXT3_JOURNAL_INO &&
903 -               inode->i_ino < EXT3_FIRST_INO(inode->i_sb)) ||
904 -               inode->i_ino > le32_to_cpu(
905 -                       inode->i_sb->u.ext3_sb.s_es->s_inodes_count)) {
906 -               ext3_error (inode->i_sb, "ext3_get_inode_loc",
907 -                           "bad inode number: %lu", inode->i_ino);
908 +               inode->i_ino < EXT3_FIRST_INO(sb)) ||
909 +               inode->i_ino > le32_to_cpu(sbi->s_es->s_inodes_count)) {
910 +               ext3_error (sb, __FUNCTION__, "bad inode #%lu", inode->i_ino);
911                 goto bad_inode;
912         }
913 -       block_group = (inode->i_ino - 1) / EXT3_INODES_PER_GROUP(inode->i_sb);
914 -       if (block_group >= inode->i_sb->u.ext3_sb.s_groups_count) {
915 -               ext3_error (inode->i_sb, "ext3_get_inode_loc",
916 -                           "group >= groups count");
917 +       block_group = (inode->i_ino - 1) / sbi->s_inodes_per_group;
918 +       if (block_group >= sbi->s_groups_count) {
919 +               ext3_error(sb, __FUNCTION__, "group >= groups count");
920                 goto bad_inode;
921         }
922 -       group_desc = block_group >> EXT3_DESC_PER_BLOCK_BITS(inode->i_sb);
923 -       desc = block_group & (EXT3_DESC_PER_BLOCK(inode->i_sb) - 1);
924 -       bh = inode->i_sb->u.ext3_sb.s_group_desc[group_desc];
925 +       group_desc = block_group >> sbi->s_desc_per_block_bits;
926 +       desc = block_group & (sbi->s_desc_per_block - 1);
927 +       bh = sbi->s_group_desc[group_desc];
928         if (!bh) {
929 -               ext3_error (inode->i_sb, "ext3_get_inode_loc",
930 -                           "Descriptor not loaded");
931 +               ext3_error(sb, __FUNCTION__, "Descriptor not loaded");
932                 goto bad_inode;
933         }
934  
935 @@ -2021,17 +2022,17 @@ int ext3_get_inode_loc (struct inode *in
936         /*
937          * Figure out the offset within the block group inode table
938          */
939 -       offset = ((inode->i_ino - 1) % EXT3_INODES_PER_GROUP(inode->i_sb)) *
940 -               EXT3_INODE_SIZE(inode->i_sb);
941 +       offset = ((inode->i_ino - 1) % sbi->s_inodes_per_group) *
942 +               sbi->s_inode_size;
943         block = le32_to_cpu(gdp[desc].bg_inode_table) +
944 -               (offset >> EXT3_BLOCK_SIZE_BITS(inode->i_sb));
945 -       if (!(bh = sb_bread(inode->i_sb, block))) {
946 -               ext3_error (inode->i_sb, "ext3_get_inode_loc",
947 +               (offset >> EXT3_BLOCK_SIZE_BITS(sb));
948 +       if (!(bh = sb_bread(sb, block))) {
949 +               ext3_error (sb, __FUNCTION__,
950                             "unable to read inode block - "
951                             "inode=%lu, block=%lu", inode->i_ino, block);
952                 goto bad_inode;
953         }
954 -       offset &= (EXT3_BLOCK_SIZE(inode->i_sb) - 1);
955 +       offset &= (EXT3_BLOCK_SIZE(sb) - 1);
956  
957         iloc->bh = bh;
958         iloc->raw_inode = (struct ext3_inode *) (bh->b_data + offset);
959 @@ -2047,6 +2048,7 @@ void ext3_read_inode(struct inode * inod
960  {
961         struct ext3_iloc iloc;
962         struct ext3_inode *raw_inode;
963 +       struct ext3_inode_info *ei = EXT3_I(inode);
964         struct buffer_head *bh;
965         int block;
966         
967 @@ -2054,7 +2056,7 @@ void ext3_read_inode(struct inode * inod
968                 goto bad_inode;
969         bh = iloc.bh;
970         raw_inode = iloc.raw_inode;
971 -       init_rwsem(&inode->u.ext3_i.truncate_sem);
972 +       init_rwsem(&ei->truncate_sem);
973         inode->i_mode = le16_to_cpu(raw_inode->i_mode);
974         inode->i_uid = (uid_t)le16_to_cpu(raw_inode->i_uid_low);
975         inode->i_gid = (gid_t)le16_to_cpu(raw_inode->i_gid_low);
976 @@ -2067,7 +2069,7 @@ void ext3_read_inode(struct inode * inod
977         inode->i_atime = le32_to_cpu(raw_inode->i_atime);
978         inode->i_ctime = le32_to_cpu(raw_inode->i_ctime);
979         inode->i_mtime = le32_to_cpu(raw_inode->i_mtime);
980 -       inode->u.ext3_i.i_dtime = le32_to_cpu(raw_inode->i_dtime);
981 +       ei->i_dtime = le32_to_cpu(raw_inode->i_dtime);
982         /* We now have enough fields to check if the inode was active or not.
983          * This is needed because nfsd might try to access dead inodes
984          * the test is that same one that e2fsck uses
985 @@ -2075,7 +2077,7 @@ void ext3_read_inode(struct inode * inod
986          */
987         if (inode->i_nlink == 0) {
988                 if (inode->i_mode == 0 ||
989 -                   !(inode->i_sb->u.ext3_sb.s_mount_state & EXT3_ORPHAN_FS)) {
990 +                   !(EXT3_SB(inode->i_sb)->s_mount_state & EXT3_ORPHAN_FS)) {
991                         /* this inode is deleted */
992                         brelse (bh);
993                         goto bad_inode;
994 @@ -2090,33 +2092,33 @@ void ext3_read_inode(struct inode * inod
995                                          * size */  
996         inode->i_blocks = le32_to_cpu(raw_inode->i_blocks);
997         inode->i_version = ++event;
998 -       inode->u.ext3_i.i_flags = le32_to_cpu(raw_inode->i_flags);
999 +       ei->i_flags = le32_to_cpu(raw_inode->i_flags);
1000  #ifdef EXT3_FRAGMENTS
1001 -       inode->u.ext3_i.i_faddr = le32_to_cpu(raw_inode->i_faddr);
1002 -       inode->u.ext3_i.i_frag_no = raw_inode->i_frag;
1003 -       inode->u.ext3_i.i_frag_size = raw_inode->i_fsize;
1004 +       ei->i_faddr = le32_to_cpu(raw_inode->i_faddr);
1005 +       ei->i_frag_no = raw_inode->i_frag;
1006 +       ei->i_frag_size = raw_inode->i_fsize;
1007  #endif
1008 -       inode->u.ext3_i.i_file_acl = le32_to_cpu(raw_inode->i_file_acl);
1009 +       ei->i_file_acl = le32_to_cpu(raw_inode->i_file_acl);
1010         if (!S_ISREG(inode->i_mode)) {
1011 -               inode->u.ext3_i.i_dir_acl = le32_to_cpu(raw_inode->i_dir_acl);
1012 +               ei->i_dir_acl = le32_to_cpu(raw_inode->i_dir_acl);
1013         } else {
1014                 inode->i_size |=
1015                         ((__u64)le32_to_cpu(raw_inode->i_size_high)) << 32;
1016         }
1017 -       inode->u.ext3_i.i_disksize = inode->i_size;
1018 +       ei->i_disksize = inode->i_size;
1019         inode->i_generation = le32_to_cpu(raw_inode->i_generation);
1020  #ifdef EXT3_PREALLOCATE
1021 -       inode->u.ext3_i.i_prealloc_count = 0;
1022 +       ei->i_prealloc_count = 0;
1023  #endif
1024 -       inode->u.ext3_i.i_block_group = iloc.block_group;
1025 +       ei->i_block_group = iloc.block_group;
1026  
1027         /*
1028          * NOTE! The in-memory inode i_data array is in little-endian order
1029          * even on big-endian machines: we do NOT byteswap the block numbers!
1030          */
1031         for (block = 0; block < EXT3_N_BLOCKS; block++)
1032 -               inode->u.ext3_i.i_data[block] = iloc.raw_inode->i_block[block];
1033 -       INIT_LIST_HEAD(&inode->u.ext3_i.i_orphan);
1034 +               ei->i_data[block] = iloc.raw_inode->i_block[block];
1035 +       INIT_LIST_HEAD(&ei->i_orphan);
1036  
1037         brelse (iloc.bh);
1038  
1039 @@ -2143,17 +2145,17 @@ void ext3_read_inode(struct inode * inod
1040         /* inode->i_attr_flags = 0;                             unused */
1041 -       if (inode->u.ext3_i.i_flags & EXT3_SYNC_FL) {
1042 +       if (ei->i_flags & EXT3_SYNC_FL) {
1043                 /* inode->i_attr_flags |= ATTR_FLAG_SYNCRONOUS; unused */
1044                 inode->i_flags |= S_SYNC;
1045         }
1046 -       if (inode->u.ext3_i.i_flags & EXT3_APPEND_FL) {
1047 +       if (ei->i_flags & EXT3_APPEND_FL) {
1048                 /* inode->i_attr_flags |= ATTR_FLAG_APPEND;     unused */
1049                 inode->i_flags |= S_APPEND;
1050         }
1051 -       if (inode->u.ext3_i.i_flags & EXT3_IMMUTABLE_FL) {
1052 +       if (ei->i_flags & EXT3_IMMUTABLE_FL) {
1053                 /* inode->i_attr_flags |= ATTR_FLAG_IMMUTABLE;  unused */
1054                 inode->i_flags |= S_IMMUTABLE;
1055         }
1056 -       if (inode->u.ext3_i.i_flags & EXT3_NOATIME_FL) {
1057 +       if (ei->i_flags & EXT3_NOATIME_FL) {
1058                 /* inode->i_attr_flags |= ATTR_FLAG_NOATIME;    unused */
1059                 inode->i_flags |= S_NOATIME;
1060         }
1061 @@ -2175,6 +2177,7 @@ static int ext3_do_update_inode(handle_t
1062                                 struct ext3_iloc *iloc)
1063  {
1064         struct ext3_inode *raw_inode = iloc->raw_inode;
1065 +       struct ext3_inode_info *ei = EXT3_I(inode);
1066         struct buffer_head *bh = iloc->bh;
1067         int err = 0, rc, block;
1068  
1069 @@ -2192,7 +2195,7 @@ static int ext3_do_update_inode(handle_t
1070   * Fix up interoperability with old kernels. Otherwise, old inodes get
1071   * re-used with the upper 16 bits of the uid/gid intact
1072   */
1073 -               if(!inode->u.ext3_i.i_dtime) {
1074 +               if(!ei->i_dtime) {
1075                         raw_inode->i_uid_high =
1076                                 cpu_to_le16(high_16_bits(inode->i_uid));
1077                         raw_inode->i_gid_high =
1078 @@ -2210,34 +2213,33 @@ static int ext3_do_update_inode(handle_t
1079                 raw_inode->i_gid_high = 0;
1080         }
1081         raw_inode->i_links_count = cpu_to_le16(inode->i_nlink);
1082 -       raw_inode->i_size = cpu_to_le32(inode->u.ext3_i.i_disksize);
1083 +       raw_inode->i_size = cpu_to_le32(ei->i_disksize);
1084         raw_inode->i_atime = cpu_to_le32(inode->i_atime);
1085         raw_inode->i_ctime = cpu_to_le32(inode->i_ctime);
1086         raw_inode->i_mtime = cpu_to_le32(inode->i_mtime);
1087         raw_inode->i_blocks = cpu_to_le32(inode->i_blocks);
1088 -       raw_inode->i_dtime = cpu_to_le32(inode->u.ext3_i.i_dtime);
1089 -       raw_inode->i_flags = cpu_to_le32(inode->u.ext3_i.i_flags);
1090 +       raw_inode->i_dtime = cpu_to_le32(ei->i_dtime);
1091 +       raw_inode->i_flags = cpu_to_le32(ei->i_flags);
1092  #ifdef EXT3_FRAGMENTS
1093 -       raw_inode->i_faddr = cpu_to_le32(inode->u.ext3_i.i_faddr);
1094 -       raw_inode->i_frag = inode->u.ext3_i.i_frag_no;
1095 -       raw_inode->i_fsize = inode->u.ext3_i.i_frag_size;
1096 +       raw_inode->i_faddr = cpu_to_le32(ei->i_faddr);
1097 +       raw_inode->i_frag = ei->i_frag_no;
1098 +       raw_inode->i_fsize = ei->i_frag_size;
1099  #else
1100         /* If we are not tracking these fields in the in-memory inode,
1101          * then preserve them on disk, but still initialise them to zero
1102          * for new inodes. */
1103 -       if (EXT3_I(inode)->i_state & EXT3_STATE_NEW) {
1104 +       if (ei->i_state & EXT3_STATE_NEW) {
1105                 raw_inode->i_faddr = 0;
1106                 raw_inode->i_frag = 0;
1107                 raw_inode->i_fsize = 0;
1108         }
1109  #endif
1110 -       raw_inode->i_file_acl = cpu_to_le32(inode->u.ext3_i.i_file_acl);
1111 +       raw_inode->i_file_acl = cpu_to_le32(ei->i_file_acl);
1112         if (!S_ISREG(inode->i_mode)) {
1113 -               raw_inode->i_dir_acl = cpu_to_le32(inode->u.ext3_i.i_dir_acl);
1114 +               raw_inode->i_dir_acl = cpu_to_le32(ei->i_dir_acl);
1115         } else {
1116 -               raw_inode->i_size_high =
1117 -                       cpu_to_le32(inode->u.ext3_i.i_disksize >> 32);
1118 -               if (inode->u.ext3_i.i_disksize > 0x7fffffffULL) {
1119 +               raw_inode->i_size_high = cpu_to_le32(ei->i_disksize >> 32);
1120 +               if (ei->i_disksize > MAX_NON_LFS) {
1121                         struct super_block *sb = inode->i_sb;
1122                         if (!EXT3_HAS_RO_COMPAT_FEATURE(sb,
1123                                         EXT3_FEATURE_RO_COMPAT_LARGE_FILE) ||
1124 @@ -2247,7 +2249,7 @@ static int ext3_do_update_inode(handle_t
1125                                 * created, add a flag to the superblock.
1126                                 */
1127                                 err = ext3_journal_get_write_access(handle,
1128 -                                               sb->u.ext3_sb.s_sbh);
1129 +                                               EXT3_SB(sb)->s_sbh);
1130                                 if (err)
1131                                         goto out_brelse;
1132                                 ext3_update_dynamic_rev(sb);
1133 @@ -2256,7 +2258,7 @@ static int ext3_do_update_inode(handle_t
1134                                 sb->s_dirt = 1;
1135                                 handle->h_sync = 1;
1136                                 err = ext3_journal_dirty_metadata(handle,
1137 -                                               sb->u.ext3_sb.s_sbh);
1138 +                                               EXT3_SB(sb)->s_sbh);
1139                         }
1140                 }
1141         }
1142 @@ -2265,13 +2267,13 @@ static int ext3_do_update_inode(handle_t
1143                 raw_inode->i_block[0] =
1144                         cpu_to_le32(kdev_t_to_nr(inode->i_rdev));
1145         else for (block = 0; block < EXT3_N_BLOCKS; block++)
1146 -               raw_inode->i_block[block] = inode->u.ext3_i.i_data[block];
1147 +               raw_inode->i_block[block] = ei->i_data[block];
1148  
1149         BUFFER_TRACE(bh, "call ext3_journal_dirty_metadata");
1150         rc = ext3_journal_dirty_metadata(handle, bh);
1151         if (!err)
1152                 err = rc;
1153 -       EXT3_I(inode)->i_state &= ~EXT3_STATE_NEW;
1154 +       ei->i_state &= ~EXT3_STATE_NEW;
1155  
1156  out_brelse:
1157         brelse (bh);
1158 @@ -2379,7 +2381,7 @@ int ext3_setattr(struct dentry *dentry, 
1159                 }
1160                 
1161                 error = ext3_orphan_add(handle, inode);
1162 -               inode->u.ext3_i.i_disksize = attr->ia_size;
1163 +               EXT3_I(inode)->i_disksize = attr->ia_size;
1164                 rc = ext3_mark_inode_dirty(handle, inode);
1165                 if (!error)
1166                         error = rc;
1167 @@ -2622,9 +2624,9 @@ int ext3_change_inode_journal_flag(struc
1168          */
1169  
1170         if (val)
1171 -               inode->u.ext3_i.i_flags |= EXT3_JOURNAL_DATA_FL;
1172 +               EXT3_I(inode)->i_flags |= EXT3_JOURNAL_DATA_FL;
1173         else
1174 -               inode->u.ext3_i.i_flags &= ~EXT3_JOURNAL_DATA_FL;
1175 +               EXT3_I(inode)->i_flags &= ~EXT3_JOURNAL_DATA_FL;
1176  
1177         journal_unlock_updates(journal);
1178  
1179 --- ./fs/ext3/ioctl.c.orig      Fri Apr 12 10:27:49 2002
1180 +++ ./fs/ext3/ioctl.c   Tue May  7 15:20:52 2002
1181 @@ -18,13 +18,14 @@
1182  int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd,
1183                 unsigned long arg)
1184  {
1185 +       struct ext3_inode_info *ei = EXT3_I(inode);
1186         unsigned int flags;
1187  
1188         ext3_debug ("cmd = %u, arg = %lu\n", cmd, arg);
1189  
1190         switch (cmd) {
1191         case EXT3_IOC_GETFLAGS:
1192 -               flags = inode->u.ext3_i.i_flags & EXT3_FL_USER_VISIBLE;
1193 +               flags = ei->i_flags & EXT3_FL_USER_VISIBLE;
1194                 return put_user(flags, (int *) arg);
1195         case EXT3_IOC_SETFLAGS: {
1196                 handle_t *handle = NULL;
1197 @@ -42,7 +42,7 @@ int ext3_ioctl (struct inode * inode, st
1198                 if (get_user(flags, (int *) arg))
1199                         return -EFAULT;
1200  
1201 -               oldflags = inode->u.ext3_i.i_flags;
1202 +               oldflags = ei->i_flags;
1203  
1204                 /* The JOURNAL_DATA flag is modifiable only by root */
1205                 jflag = flags & EXT3_JOURNAL_DATA_FL;
1206 @@ -79,7 +79,7 @@ int ext3_ioctl (struct inode * inode, st
1207                 
1208                 flags = flags & EXT3_FL_USER_MODIFIABLE;
1209                 flags |= oldflags & ~EXT3_FL_USER_MODIFIABLE;
1210 -               inode->u.ext3_i.i_flags = flags;
1211 +               ei->i_flags = flags;
1212  
1213                 if (flags & EXT3_SYNC_FL)
1214                         inode->i_flags |= S_SYNC;
1215 @@ -155,12 +155,12 @@ flags_err:
1216                         int ret = 0;
1217  
1218                         set_current_state(TASK_INTERRUPTIBLE);
1219 -                       add_wait_queue(&sb->u.ext3_sb.ro_wait_queue, &wait);
1220 -                       if (timer_pending(&sb->u.ext3_sb.turn_ro_timer)) {
1221 +                       add_wait_queue(&EXT3_SB(sb)->ro_wait_queue, &wait);
1222 +                       if (timer_pending(&EXT3_SB(sb)->turn_ro_timer)) {
1223                                 schedule();
1224                                 ret = 1;
1225                         }
1226 -                       remove_wait_queue(&sb->u.ext3_sb.ro_wait_queue, &wait);
1227 +                       remove_wait_queue(&EXT3_SB(sb)->ro_wait_queue, &wait);
1228                         return ret;
1229                 }
1230  #endif
1231 --- ./fs/ext3/namei.c.orig      Fri Apr 12 10:27:49 2002
1232 +++ ./fs/ext3/namei.c   Tue May  7 16:05:51 2002
1233 @@ -636,7 +636,7 @@ static struct buffer_head * ext3_find_en
1234         }
1235         
1236         nblocks = dir->i_size >> EXT3_BLOCK_SIZE_BITS(sb);
1237 -       start = dir->u.ext3_i.i_dir_start_lookup;
1238 +       start = EXT3_I(dir)->i_dir_start_lookup;
1239         if (start >= nblocks)
1240                 start = 0;
1241         block = start;
1242 @@ -677,7 +677,7 @@ restart:
1243                 i = search_dirblock(bh, dir, dentry,
1244                             block << EXT3_BLOCK_SIZE_BITS(sb), res_dir);
1245                 if (i == 1) {
1246 -                       dir->u.ext3_i.i_dir_start_lookup = block;
1247 +                       EXT3_I(dir)->i_dir_start_lookup = block;
1248                         ret = bh;
1249                         goto cleanup_and_exit;
1250                 } else {
1251 @@ -1419,7 +1419,7 @@ int ext3_orphan_add(handle_t *handle, st
1252         int err = 0, rc;
1253         
1254         lock_super(sb);
1255 -       if (!list_empty(&inode->u.ext3_i.i_orphan))
1256 +       if (!list_empty(&EXT3_I(inode)->i_orphan))
1257                 goto out_unlock;
1258  
1259         /* Orphan handling is only valid for files with data blocks
1260 @@ -1430,8 +1430,8 @@ int ext3_orphan_add(handle_t *handle, st
1261         J_ASSERT ((S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
1262                 S_ISLNK(inode->i_mode)) || inode->i_nlink == 0);
1263  
1264 -       BUFFER_TRACE(sb->u.ext3_sb.s_sbh, "get_write_access");
1265 -       err = ext3_journal_get_write_access(handle, sb->u.ext3_sb.s_sbh);
1266 +       BUFFER_TRACE(EXT3_SB(sb)->s_sbh, "get_write_access");
1267 +       err = ext3_journal_get_write_access(handle, EXT3_SB(sb)->s_sbh);
1268         if (err)
1269                 goto out_unlock;
1270         
1271 @@ -1442,7 +1442,7 @@ int ext3_orphan_add(handle_t *handle, st
1272         /* Insert this inode at the head of the on-disk orphan list... */
1273         NEXT_ORPHAN(inode) = le32_to_cpu(EXT3_SB(sb)->s_es->s_last_orphan);
1274         EXT3_SB(sb)->s_es->s_last_orphan = cpu_to_le32(inode->i_ino);
1275 -       err = ext3_journal_dirty_metadata(handle, sb->u.ext3_sb.s_sbh);
1276 +       err = ext3_journal_dirty_metadata(handle, EXT3_SB(sb)->s_sbh);
1277         rc = ext3_mark_iloc_dirty(handle, inode, &iloc);
1278         if (!err)
1279                 err = rc;
1280 @@ -1456,7 +1456,7 @@ int ext3_orphan_add(handle_t *handle, st
1281          * This is safe: on error we're going to ignore the orphan list
1282          * anyway on the next recovery. */
1283         if (!err)
1284 -               list_add(&inode->u.ext3_i.i_orphan, &EXT3_SB(sb)->s_orphan);
1285 +               list_add(&EXT3_I(inode)->i_orphan, &EXT3_SB(sb)->s_orphan);
1286  
1287         jbd_debug(4, "superblock will point to %ld\n", inode->i_ino);
1288         jbd_debug(4, "orphan inode %ld will point to %d\n",
1289 @@ -714,25 +770,25 @@
1290  int ext3_orphan_del(handle_t *handle, struct inode *inode)
1291  {
1292         struct list_head *prev;
1293 +       struct ext3_inode_info *ei = EXT3_I(inode);
1294         struct ext3_sb_info *sbi;
1295         unsigned long ino_next;
1296         struct ext3_iloc iloc;
1297         int err = 0;
1298  
1299         lock_super(inode->i_sb);
1300 -       if (list_empty(&inode->u.ext3_i.i_orphan)) {
1301 +       if (list_empty(&ei->i_orphan)) {
1302                 unlock_super(inode->i_sb);
1303                 return 0;
1304         }
1305  
1306         ino_next = NEXT_ORPHAN(inode);
1307 -       prev = inode->u.ext3_i.i_orphan.prev;
1308 +       prev = ei->i_orphan.prev;
1309         sbi = EXT3_SB(inode->i_sb);
1310  
1311         jbd_debug(4, "remove inode %lu from orphan list\n", inode->i_ino);
1312  
1313 -       list_del(&inode->u.ext3_i.i_orphan);
1314 -       INIT_LIST_HEAD(&inode->u.ext3_i.i_orphan);
1315 +       list_del_init(&ei->i_orphan);
1316  
1317         /* If we're on an error path, we may not have a valid
1318          * transaction handle with which to update the orphan list on
1319 @@ -1520,8 +1520,7 @@ int ext3_orphan_del(handle_t *handle, st
1320                 err = ext3_journal_dirty_metadata(handle, sbi->s_sbh);
1321         } else {
1322                 struct ext3_iloc iloc2;
1323 -               struct inode *i_prev =
1324 -                       list_entry(prev, struct inode, u.ext3_i.i_orphan);
1325 +               struct inode *i_prev = orphan_list_entry(prev);
1326  
1327                 jbd_debug(4, "orphan inode %lu will point to %lu\n",
1328                           i_prev->i_ino, ino_next);
1329 @@ -1695,10 +1695,10 @@ static int ext3_symlink (struct inode * 
1330                         goto out_no_entry;
1331         } else {
1332                 inode->i_op = &ext3_fast_symlink_inode_operations;
1333 -               memcpy((char*)&inode->u.ext3_i.i_data,symname,l);
1334 +               memcpy((char*)&EXT3_I(inode)->i_data,symname,l);
1335                 inode->i_size = l-1;
1336         }
1337 -       inode->u.ext3_i.i_disksize = inode->i_size;
1338 +       EXT3_I(inode)->i_disksize = inode->i_size;
1339         err = ext3_add_nondir(handle, dentry, inode);
1340         ext3_mark_inode_dirty(handle, inode);
1341  out_stop:
1342 --- ./fs/ext3/super.c.orig      Fri Apr 12 10:27:49 2002
1343 +++ ./fs/ext3/super.c   Tue May  7 16:05:44 2002
1344 @@ -121,7 +121,7 @@ static int ext3_error_behaviour(struct s
1345         /* If no overrides were specified on the mount, then fall back
1346          * to the default behaviour set in the filesystem's superblock
1347          * on disk. */
1348 -       switch (le16_to_cpu(sb->u.ext3_sb.s_es->s_errors)) {
1349 +       switch (le16_to_cpu(EXT3_SB(sb)->s_es->s_errors)) {
1350         case EXT3_ERRORS_PANIC:
1351                 return EXT3_ERRORS_PANIC;
1352         case EXT3_ERRORS_RO:
1353 @@ -269,9 +269,9 @@ void ext3_abort (struct super_block * sb
1354                 return;
1355         
1356         printk (KERN_CRIT "Remounting filesystem read-only\n");
1357 -       sb->u.ext3_sb.s_mount_state |= EXT3_ERROR_FS;
1358 +       EXT3_SB(sb)->s_mount_state |= EXT3_ERROR_FS;
1359         sb->s_flags |= MS_RDONLY;
1360 -       sb->u.ext3_sb.s_mount_opt |= EXT3_MOUNT_ABORT;
1361 +       EXT3_SB(sb)->s_mount_opt |= EXT3_MOUNT_ABORT;
1362         journal_abort(EXT3_SB(sb)->s_journal, -EIO);
1363  }
1364  
1365 @@ -377,8 +377,6 @@ static int ext3_blkdev_remove(struct ext3
1366         return ret;
1367  }
1368  
1369 -#define orphan_list_entry(l) list_entry((l), struct inode, u.ext3_i.i_orphan)
1370 -
1371  static void dump_orphan_list(struct super_block *sb, struct ext3_sb_info *sbi)
1372  {
1373         struct list_head *l;
1374 @@ -818,7 +818,7 @@ static void ext3_orphan_cleanup (struct 
1375                 sb->s_flags &= ~MS_RDONLY;
1376         }
1377  
1378 -       if (sb->u.ext3_sb.s_mount_state & EXT3_ERROR_FS) {
1379 +       if (EXT3_SB(sb)->s_mount_state & EXT3_ERROR_FS) {
1380                 if (es->s_last_orphan)
1381                         jbd_debug(1, "Errors on filesystem, "
1382                                   "clearing orphan list.\n");
1383 @@ -1463,12 +1463,14 @@ static void ext3_commit_super (struct su
1384                                struct ext3_super_block * es,
1385                                int sync)
1386  {
1387 +       struct buffer_head *sbh = EXT3_SB(sb)->s_sbh;
1388 +
1389         es->s_wtime = cpu_to_le32(CURRENT_TIME);
1390 -       BUFFER_TRACE(sb->u.ext3_sb.s_sbh, "marking dirty");
1391 -       mark_buffer_dirty(sb->u.ext3_sb.s_sbh);
1392 +       BUFFER_TRACE(sbh, "marking dirty");
1393 +       mark_buffer_dirty(sbh);
1394         if (sync) {
1395 -               ll_rw_block(WRITE, 1, &sb->u.ext3_sb.s_sbh);
1396 -               wait_on_buffer(sb->u.ext3_sb.s_sbh);
1397 +               ll_rw_block(WRITE, 1, &sbh);
1398 +               wait_on_buffer(sbh);
1399         }
1400  }
1401  
1402 @@ -1519,7 +1521,7 @@ static void ext3_clear_journal_err(struc
1403                 ext3_warning(sb, __FUNCTION__, "Marking fs in need of "
1404                              "filesystem check.");
1405                 
1406 -               sb->u.ext3_sb.s_mount_state |= EXT3_ERROR_FS;
1407 +               EXT3_SB(sb)->s_mount_state |= EXT3_ERROR_FS;
1408                 es->s_state |= cpu_to_le16(EXT3_ERROR_FS);
1409                 ext3_commit_super (sb, es, 1);
1410  
1411 --- ./fs/ext3/symlink.c.orig    Fri Apr 12 10:27:49 2002
1412 +++ ./fs/ext3/symlink.c Tue May  7 15:25:39 2002
1413 @@ -23,13 +23,13 @@
1414  
1415  static int ext3_readlink(struct dentry *dentry, char *buffer, int buflen)
1416  {
1417 -       char *s = (char *)dentry->d_inode->u.ext3_i.i_data;
1418 -       return vfs_readlink(dentry, buffer, buflen, s);
1419 +       struct ext3_inode_info *ei = EXT3_I(dentry->d_inode);
1420 +       return vfs_readlink(dentry, buffer, buflen, (char *)ei->i_data);
1421  }
1422  
1423  static int ext3_follow_link(struct dentry *dentry, struct nameidata *nd)
1424  {
1425 -       char *s = (char *)dentry->d_inode->u.ext3_i.i_data;
1426 -       return vfs_follow_link(nd, s);
1427 +       struct ext3_inode_info *ei = EXT3_I(dentry->d_inode);
1428 +       return vfs_follow_link(nd, (char*)ei->i_data);
1429  }
1430  
1431 --- ./include/linux/ext3_fs.h.orig      Tue Apr 16 14:27:25 2002
1432 +++ ./include/linux/ext3_fs.h   Tue May  7 16:47:36 2002
1433 @@ -84,22 +84,25 @@
1434  #define EXT3_MIN_BLOCK_SIZE            1024
1435  #define        EXT3_MAX_BLOCK_SIZE             4096
1436  #define EXT3_MIN_BLOCK_LOG_SIZE                  10
1437 +
1438  #ifdef __KERNEL__
1439 -# define EXT3_BLOCK_SIZE(s)            ((s)->s_blocksize)
1440 -#else
1441 -# define EXT3_BLOCK_SIZE(s)            (EXT3_MIN_BLOCK_SIZE << (s)->s_log_block_size)
1442 -#endif
1443 -#define        EXT3_ADDR_PER_BLOCK(s)          (EXT3_BLOCK_SIZE(s) / sizeof (__u32))
1444 -#ifdef __KERNEL__
1445 -# define EXT3_BLOCK_SIZE_BITS(s)       ((s)->s_blocksize_bits)
1446 -#else
1447 -# define EXT3_BLOCK_SIZE_BITS(s)       ((s)->s_log_block_size + 10)
1448 -#endif
1449 -#ifdef __KERNEL__
1450 -#define        EXT3_ADDR_PER_BLOCK_BITS(s)     ((s)->u.ext3_sb.s_addr_per_block_bits)
1451 -#define EXT3_INODE_SIZE(s)             ((s)->u.ext3_sb.s_inode_size)
1452 -#define EXT3_FIRST_INO(s)              ((s)->u.ext3_sb.s_first_ino)
1453 +#define EXT3_SB(sb)    (&((sb)->u.ext3_sb))
1454 +#define EXT3_I(inode)  (&((inode)->u.ext3_i))
1455 +
1456 +#define EXT3_BLOCK_SIZE(s)             ((s)->s_blocksize)
1457 +#define EXT3_BLOCK_SIZE_BITS(s)                ((s)->s_blocksize_bits)
1458 +#define        EXT3_ADDR_PER_BLOCK_BITS(s)     (EXT3_SB(s)->s_addr_per_block_bits)
1459 +#define EXT3_INODE_SIZE(s)             (EXT3_SB(s)->s_inode_size)
1460 +#define EXT3_FIRST_INO(s)              (EXT3_SB(s)->s_first_ino)
1461  #else
1462 +
1463 +/* Assume that user mode programs are passing in an ext3fs superblock, not
1464 + * a kernel struct super_block.  This will allow us to call the feature-test
1465 + * macros from user land. */
1466 +#define EXT3_SB(sb)    (sb)
1467 +
1468 +#define EXT3_BLOCK_SIZE(s)     (EXT3_MIN_BLOCK_SIZE << (s)->s_log_block_size)
1469 +#define EXT3_BLOCK_SIZE_BITS(s)        ((s)->s_log_block_size + 10)
1470  #define EXT3_INODE_SIZE(s)     (((s)->s_rev_level == EXT3_GOOD_OLD_REV) ? \
1471                                  EXT3_GOOD_OLD_INODE_SIZE : \
1472                                  (s)->s_inode_size)
1473 @@ -108,6 +110,7 @@
1474                                  EXT3_GOOD_OLD_FIRST_INO : \
1475                                  (s)->s_first_ino)
1476  #endif
1477 +#define EXT3_ADDR_PER_BLOCK(s) (EXT3_BLOCK_SIZE(s) / sizeof (__u32))
1478  
1479  /*
1480   * Macro-instructions used to manage fragments
1481 @@ -116,8 +120,8 @@
1482  #define        EXT3_MAX_FRAG_SIZE              4096
1483  #define EXT3_MIN_FRAG_LOG_SIZE           10
1484  #ifdef __KERNEL__
1485 -# define EXT3_FRAG_SIZE(s)             ((s)->u.ext3_sb.s_frag_size)
1486 -# define EXT3_FRAGS_PER_BLOCK(s)       ((s)->u.ext3_sb.s_frags_per_block)
1487 +# define EXT3_FRAG_SIZE(s)             (EXT3_SB(s)->s_frag_size)
1488 +# define EXT3_FRAGS_PER_BLOCK(s)       (EXT3_SB(s)->s_frags_per_block)
1489  #else
1490  # define EXT3_FRAG_SIZE(s)             (EXT3_MIN_FRAG_SIZE << (s)->s_log_frag_size)
1491  # define EXT3_FRAGS_PER_BLOCK(s)       (EXT3_BLOCK_SIZE(s) / EXT3_FRAG_SIZE(s))
1492 @@ -163,15 +167,13 @@
1493  /*
1494   * Macro-instructions used to manage group descriptors
1495   */
1496 +# define EXT3_BLOCKS_PER_GROUP(s)      (EXT3_SB(s)->s_blocks_per_group)
1497 +# define EXT3_INODES_PER_GROUP(s)      (EXT3_SB(s)->s_inodes_per_group)
1498  #ifdef __KERNEL__
1499 -# define EXT3_BLOCKS_PER_GROUP(s)      ((s)->u.ext3_sb.s_blocks_per_group)
1500 -# define EXT3_DESC_PER_BLOCK(s)                ((s)->u.ext3_sb.s_desc_per_block)
1501 -# define EXT3_INODES_PER_GROUP(s)      ((s)->u.ext3_sb.s_inodes_per_group)
1502 -# define EXT3_DESC_PER_BLOCK_BITS(s)   ((s)->u.ext3_sb.s_desc_per_block_bits)
1503 +# define EXT3_DESC_PER_BLOCK(s)                (EXT3_SB(s)->s_desc_per_block)
1504 +# define EXT3_DESC_PER_BLOCK_BITS(s)   (EXT3_SB(s)->s_desc_per_block_bits)
1505  #else
1506 -# define EXT3_BLOCKS_PER_GROUP(s)      ((s)->s_blocks_per_group)
1507  # define EXT3_DESC_PER_BLOCK(s)                (EXT3_BLOCK_SIZE(s) / sizeof (struct ext3_group_desc))
1508 -# define EXT3_INODES_PER_GROUP(s)      ((s)->s_inodes_per_group)
1509  #endif
1510  
1511  /*
1512 @@ -344,7 +347,7 @@
1513  #ifndef _LINUX_EXT2_FS_H
1514  #define clear_opt(o, opt)              o &= ~EXT3_MOUNT_##opt
1515  #define set_opt(o, opt)                        o |= EXT3_MOUNT_##opt
1516 -#define test_opt(sb, opt)              ((sb)->u.ext3_sb.s_mount_opt & \
1517 +#define test_opt(sb, opt)              (EXT3_SB(sb)->s_mount_opt & \
1518                                          EXT3_MOUNT_##opt)
1519  #else
1520  #define EXT2_MOUNT_NOLOAD              EXT3_MOUNT_NOLOAD
1521 @@ -441,17 +443,11 @@
1522  /*EC*/ __u32   s_reserved[197];        /* Padding to the end of the block */
1523  };
1524  
1525 -#ifdef __KERNEL__
1526 -#define EXT3_SB(sb)    (&((sb)->u.ext3_sb))
1527 -#define EXT3_I(inode)  (&((inode)->u.ext3_i))
1528 -#else
1529 -/* Assume that user mode programs are passing in an ext3fs superblock, not
1530 - * a kernel struct super_block.  This will allow us to call the feature-test
1531 - * macros from user land. */
1532 -#define EXT3_SB(sb)    (sb)
1533 -#endif
1534 -
1535 -#define NEXT_ORPHAN(inode) (inode)->u.ext3_i.i_dtime
1536 +#define NEXT_ORPHAN(inode) EXT3_I(inode)->i_dtime
1537 +static inline struct inode *orphan_list_entry(struct list_head *l)
1538 +{
1539 +       return list_entry(l, struct inode, u.ext3_i.i_orphan);
1540 +}
1541  
1542  /*
1543   * Codes for operating systems
1544 --- ./include/linux/ext3_jbd.h.orig     Tue May  7 14:44:08 2002
1545 +++ ./include/linux/ext3_jbd.h  Tue May  7 14:44:43 2002
1546 @@ -291,7 +291,7 @@
1547                 return 1;
1548         if (test_opt(inode->i_sb, DATA_FLAGS) == EXT3_MOUNT_JOURNAL_DATA)
1549                 return 1;
1550 -       if (inode->u.ext3_i.i_flags & EXT3_JOURNAL_DATA_FL)
1551 +       if (EXT3_I(inode)->i_flags & EXT3_JOURNAL_DATA_FL)
1552                 return 1;
1553         return 0;
1554  }