Whamcloud - gitweb
file llobdstat.pl was initially added on branch b_devel.
[fs/lustre-release.git] / lustre / kernel_patches / patches / ext3-2.4.18-ino_sb_macro.patch
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,7 +320,9 @@ 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 @@ -328,9 +332,9 @@ struct inode * ext3_new_inode (handle_t 
437  
438         if (S_ISDIR(mode)) {
439                 avefreei = le32_to_cpu(es->s_free_inodes_count) /
440 -                       sb->u.ext3_sb.s_groups_count;
441 +                       sbi->s_groups_count;
442                 if (!gdp) {
443 -                       for (j = 0; j < sb->u.ext3_sb.s_groups_count; j++) {
444 +                       for (j = 0; j < sbi->s_groups_count; j++) {
445                                 struct buffer_head *temp_buffer;
446                                 tmp = ext3_get_group_desc (sb, j, &temp_buffer);
447                                 if (tmp &&
448 @@ -350,7 +354,7 @@ repeat:
449                 /*
450                  * Try to place the inode in its parent directory
451                  */
452 -               i = dir->u.ext3_i.i_block_group;
453 +               i = EXT3_I(dir)->i_block_group;
454                 tmp = ext3_get_group_desc (sb, i, &bh2);
455                 if (tmp && le16_to_cpu(tmp->bg_free_inodes_count))
456                         gdp = tmp;
457 @@ -360,10 +364,10 @@ repeat:
458                          * Use a quadratic hash to find a group with a
459                          * free inode
460                          */
461 -                       for (j = 1; j < sb->u.ext3_sb.s_groups_count; j <<= 1) {
462 +                       for (j = 1; j < sbi->s_groups_count; j <<= 1) {
463                                 i += j;
464 -                               if (i >= sb->u.ext3_sb.s_groups_count)
465 -                                       i -= sb->u.ext3_sb.s_groups_count;
466 +                               if (i >= sbi->s_groups_count)
467 +                                       i -= sbi->s_groups_count;
468                                 tmp = ext3_get_group_desc (sb, i, &bh2);
469                                 if (tmp &&
470                                     le16_to_cpu(tmp->bg_free_inodes_count)) {
471 @@ -376,9 +380,9 @@ repeat:
472                         /*
473                          * That failed: try linear search for a free inode
474                          */
475 -                       i = dir->u.ext3_i.i_block_group + 1;
476 -                       for (j = 2; j < sb->u.ext3_sb.s_groups_count; j++) {
477 -                               if (++i >= sb->u.ext3_sb.s_groups_count)
478 +                       i = EXT3_I(dir)->i_block_group + 1;
479 +                       for (j = 2; j < sbi->s_groups_count; j++) {
480 +                               if (++i >= sbi->s_groups_count)
481                                         i = 0;
482                                 tmp = ext3_get_group_desc (sb, i, &bh2);
483                                 if (tmp &&
484 @@ -399,11 +403,11 @@ repeat:
485         if (bitmap_nr < 0)
486                 goto fail;
487  
488 -       bh = sb->u.ext3_sb.s_inode_bitmap[bitmap_nr];
489 +       bh = sbi->s_inode_bitmap[bitmap_nr];
490  
491         if ((j = ext3_find_first_zero_bit ((unsigned long *) bh->b_data,
492 -                                     EXT3_INODES_PER_GROUP(sb))) <
493 -           EXT3_INODES_PER_GROUP(sb)) {
494 +                                     sbi->s_inodes_per_group)) <
495 +           sbi->s_inodes_per_group) {
496                 BUFFER_TRACE(bh, "get_write_access");
497                 err = ext3_journal_get_write_access(handle, bh);
498                 if (err) goto fail;
499 @@ -457,13 +461,13 @@ repeat:
500         err = ext3_journal_dirty_metadata(handle, bh2);
501         if (err) goto fail;
502         
503 -       BUFFER_TRACE(sb->u.ext3_sb.s_sbh, "get_write_access");
504 -       err = ext3_journal_get_write_access(handle, sb->u.ext3_sb.s_sbh);
505 +       BUFFER_TRACE(sbi->s_sbh, "get_write_access");
506 +       err = ext3_journal_get_write_access(handle, sbi->s_sbh);
507         if (err) goto fail;
508         es->s_free_inodes_count =
509                 cpu_to_le32(le32_to_cpu(es->s_free_inodes_count) - 1);
510 -       BUFFER_TRACE(sb->u.ext3_sb.s_sbh, "call ext3_journal_dirty_metadata");
511 -       err = ext3_journal_dirty_metadata(handle, sb->u.ext3_sb.s_sbh);
512 +       BUFFER_TRACE(sbi->s_sbh, "call ext3_journal_dirty_metadata");
513 +       err = ext3_journal_dirty_metadata(handle, sbi->s_sbh);
514         sb->s_dirt = 1;
515         if (err) goto fail;
516  
517 @@ -483,31 +487,31 @@ repeat:
518         inode->i_blksize = PAGE_SIZE;
519         inode->i_blocks = 0;
520         inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
521 -       inode->u.ext3_i.i_flags = dir->u.ext3_i.i_flags & ~EXT3_INDEX_FL;
522 +       ei->i_flags = EXT3_I(dir)->i_flags & ~EXT3_INDEX_FL;
523         if (S_ISLNK(mode))
524 -               inode->u.ext3_i.i_flags &= ~(EXT3_IMMUTABLE_FL|EXT3_APPEND_FL);
525 +               ei->i_flags &= ~(EXT3_IMMUTABLE_FL|EXT3_APPEND_FL);
526  #ifdef EXT3_FRAGMENTS
527 -       inode->u.ext3_i.i_faddr = 0;
528 -       inode->u.ext3_i.i_frag_no = 0;
529 -       inode->u.ext3_i.i_frag_size = 0;
530 +       ei->i_faddr = 0;
531 +       ei->i_frag_no = 0;
532 +       ei->i_frag_size = 0;
533  #endif
534 -       inode->u.ext3_i.i_file_acl = 0;
535 -       inode->u.ext3_i.i_dir_acl = 0;
536 -       inode->u.ext3_i.i_dtime = 0;
537 -       INIT_LIST_HEAD(&inode->u.ext3_i.i_orphan);
538 +       ei->i_file_acl = 0;
539 +       ei->i_dir_acl = 0;
540 +       ei->i_dtime = 0;
541 +       INIT_LIST_HEAD(&ei->i_orphan);
542  #ifdef EXT3_PREALLOCATE
543 -       inode->u.ext3_i.i_prealloc_count = 0;
544 +       ei->i_prealloc_count = 0;
545  #endif
546 -       inode->u.ext3_i.i_block_group = i;
547 +       ei->i_block_group = i;
548         
549 -       if (inode->u.ext3_i.i_flags & EXT3_SYNC_FL)
550 +       if (ei->i_flags & EXT3_SYNC_FL)
551                 inode->i_flags |= S_SYNC;
552         if (IS_SYNC(inode))
553                 handle->h_sync = 1;
554         insert_inode_hash(inode);
555 -       inode->i_generation = sb->u.ext3_sb.s_next_generation++;
556 +       inode->i_generation = sbi->s_next_generation++;
557  
558 -       inode->u.ext3_i.i_state = EXT3_STATE_NEW;
559 +       ei->i_state = EXT3_STATE_NEW;
560         err = ext3_mark_inode_dirty(handle, inode);
561         if (err) goto fail;
562         
563 @@ -585,19 +589,19 @@ struct inode *ext3_orphan_get (struct su
564  
565  unsigned long ext3_count_free_inodes (struct super_block * sb)
566  {
567 +       struct ext3_sb_info *sbi = EXT3_SB(sb);
568 +       struct ext3_super_block *es = sbi->s_es;
569  #ifdef EXT3FS_DEBUG
570 -       struct ext3_super_block * es;
571         unsigned long desc_count, bitmap_count, x;
572         int bitmap_nr;
573         struct ext3_group_desc * gdp;
574         int i;
575  
576         lock_super (sb);
577 -       es = sb->u.ext3_sb.s_es;
578         desc_count = 0;
579         bitmap_count = 0;
580         gdp = NULL;
581 -       for (i = 0; i < sb->u.ext3_sb.s_groups_count; i++) {
582 +       for (i = 0; i < sbi->s_groups_count; i++) {
583                 gdp = ext3_get_group_desc (sb, i, NULL);
584                 if (!gdp)
585                         continue;
586 @@ -606,8 +610,8 @@ unsigned long ext3_count_free_inodes (st
587                 if (bitmap_nr < 0)
588                         continue;
589  
590 -               x = ext3_count_free (sb->u.ext3_sb.s_inode_bitmap[bitmap_nr],
591 -                                    EXT3_INODES_PER_GROUP(sb) / 8);
592 +               x = ext3_count_free(sbi->s_inode_bitmap[bitmap_nr],
593 +                                   sbi->s_inodes_per_group / 8);
594                 printk ("group %d: stored = %d, counted = %lu\n",
595                         i, le16_to_cpu(gdp->bg_free_inodes_count), x);
596                 bitmap_count += x;
597 @@ -617,7 +621,7 @@ unsigned long ext3_count_free_inodes (st
598         unlock_super (sb);
599         return desc_count;
600  #else
601 -       return le32_to_cpu(sb->u.ext3_sb.s_es->s_free_inodes_count);
602 +       return le32_to_cpu(es->s_free_inodes_count);
603  #endif
604  }
605  
606 @@ -626,16 +630,18 @@ unsigned long ext3_count_free_inodes (st
607  void ext3_check_inodes_bitmap (struct super_block * sb)
608  {
609         struct ext3_super_block * es;
610 +       struct ext3_sb_info *sbi;
611         unsigned long desc_count, bitmap_count, x;
612         int bitmap_nr;
613         struct ext3_group_desc * gdp;
614         int i;
615  
616 -       es = sb->u.ext3_sb.s_es;
617 +       sbi = EXT3_SB(sb);
618 +       es = sbi->s_es;
619         desc_count = 0;
620         bitmap_count = 0;
621         gdp = NULL;
622 -       for (i = 0; i < sb->u.ext3_sb.s_groups_count; i++) {
623 +       for (i = 0; i < sbi->s_groups_count; i++) {
624                 gdp = ext3_get_group_desc (sb, i, NULL);
625                 if (!gdp)
626                         continue;
627 @@ -644,7 +650,7 @@ void ext3_check_inodes_bitmap (struct su
628                 if (bitmap_nr < 0)
629                         continue;
630  
631 -               x = ext3_count_free (sb->u.ext3_sb.s_inode_bitmap[bitmap_nr],
632 +               x = ext3_count_free (sbi->s_inode_bitmap[bitmap_nr],
633                                      EXT3_INODES_PER_GROUP(sb) / 8);
634                 if (le16_to_cpu(gdp->bg_free_inodes_count) != x)
635                         ext3_error (sb, "ext3_check_inodes_bitmap",
636 --- ./fs/ext3/inode.c.orig      Fri Apr 12 10:27:49 2002
637 +++ ./fs/ext3/inode.c   Tue May  7 15:41:23 2002
638 @@ -196,7 +196,7 @@ void ext3_delete_inode (struct inode * i
639          * (Well, we could do this if we need to, but heck - it works)
640          */
641         ext3_orphan_del(handle, inode);
642 -       inode->u.ext3_i.i_dtime = CURRENT_TIME;
643 +       EXT3_I(inode)->i_dtime = CURRENT_TIME;
644  
645         /* 
646          * One subtle ordering requirement: if anything has gone wrong
647 @@ -220,13 +220,14 @@ no_delete:
648  void ext3_discard_prealloc (struct inode * inode)
649  {
650  #ifdef EXT3_PREALLOCATE
651 +       struct ext3_inode_info *ei = EXT3_I(inode);
652         lock_kernel();
653         /* Writer: ->i_prealloc* */
654 -       if (inode->u.ext3_i.i_prealloc_count) {
655 -               unsigned short total = inode->u.ext3_i.i_prealloc_count;
656 -               unsigned long block = inode->u.ext3_i.i_prealloc_block;
657 -               inode->u.ext3_i.i_prealloc_count = 0;
658 -               inode->u.ext3_i.i_prealloc_block = 0;
659 +       if (ei->i_prealloc_count) {
660 +               unsigned short total = ei->i_prealloc_count;
661 +               unsigned long block = ei->i_prealloc_block;
662 +               ei->i_prealloc_count = 0;
663 +               ei->i_prealloc_block = 0;
664                 /* Writer: end */
665                 ext3_free_blocks (inode, block, total);
666         }
667 @@ -243,13 +244,15 @@ static int ext3_alloc_block (handle_t *h
668         unsigned long result;
669  
670  #ifdef EXT3_PREALLOCATE
671 +       struct ext3_inode_info *ei = EXT3_I(inode);
672 +
673         /* Writer: ->i_prealloc* */
674 -       if (inode->u.ext3_i.i_prealloc_count &&
675 -           (goal == inode->u.ext3_i.i_prealloc_block ||
676 -            goal + 1 == inode->u.ext3_i.i_prealloc_block))
677 +       if (ei->i_prealloc_count &&
678 +           (goal == ei->i_prealloc_block ||
679 +            goal + 1 == ei->i_prealloc_block))
680         {
681 -               result = inode->u.ext3_i.i_prealloc_block++;
682 -               inode->u.ext3_i.i_prealloc_count--;
683 +               result = ei->i_prealloc_block++;
684 +               ei->i_prealloc_count--;
685                 /* Writer: end */
686                 ext3_debug ("preallocation hit (%lu/%lu).\n",
687                             ++alloc_hits, ++alloc_attempts);
688 @@ -259,8 +262,8 @@ static int ext3_alloc_block (handle_t *h
689                             alloc_hits, ++alloc_attempts);
690                 if (S_ISREG(inode->i_mode))
691                         result = ext3_new_block (inode, goal, 
692 -                                &inode->u.ext3_i.i_prealloc_count,
693 -                                &inode->u.ext3_i.i_prealloc_block, err);
694 +                                &ei->i_prealloc_count,
695 +                                &ei->i_prealloc_block, err);
696                 else
697                         result = ext3_new_block (inode, goal, 0, 0, err);
698                 /*
699 @@ -394,7 +397,7 @@ static Indirect *ext3_get_branch(struct 
700  
701         *err = 0;
702         /* i_data is not going away, no lock needed */
703 -       add_chain (chain, NULL, inode->u.ext3_i.i_data + *offsets);
704 +       add_chain (chain, NULL, EXT3_I(inode)->i_data + *offsets);
705         if (!p->key)
706                 goto no_block;
707         while (--depth) {
708 @@ -437,7 +440,8 @@ no_block:
709  
710  static inline unsigned long ext3_find_near(struct inode *inode, Indirect *ind)
711  {
712 -       u32 *start = ind->bh ? (u32*) ind->bh->b_data : inode->u.ext3_i.i_data;
713 +       struct ext3_inode_info *ei = EXT3_I(inode);
714 +       u32 *start = ind->bh ? (u32*) ind->bh->b_data : ei->i_data;
715         u32 *p;
716  
717         /* Try to find previous block */
718 @@ -453,9 +456,8 @@ static inline unsigned long ext3_find_ne
719          * It is going to be refered from inode itself? OK, just put it into
720          * the same cylinder group then.
721          */
722 -       return (inode->u.ext3_i.i_block_group * 
723 -               EXT3_BLOCKS_PER_GROUP(inode->i_sb)) +
724 -              le32_to_cpu(inode->i_sb->u.ext3_sb.s_es->s_first_data_block);
725 +       return (ei->i_block_group * EXT3_BLOCKS_PER_GROUP(inode->i_sb)) +
726 +              le32_to_cpu(EXT3_SB(inode->i_sb)->s_es->s_first_data_block);
727  }
728  
729  /**
730 @@ -474,14 +477,15 @@
731  static int ext3_find_goal(struct inode *inode, long block, Indirect chain[4],
732                           Indirect *partial, unsigned long *goal)
733  {
734 +       struct ext3_inode_info *ei = EXT3_I(inode);
735         /* Writer: ->i_next_alloc* */
736 -       if (block == inode->u.ext3_i.i_next_alloc_block + 1) {
737 -               inode->u.ext3_i.i_next_alloc_block++;
738 -               inode->u.ext3_i.i_next_alloc_goal++;
739 +       if (block == ei->i_next_alloc_block + 1) {
740 +               ei->i_next_alloc_block++;
741 +               ei->i_next_alloc_goal++;
742         }
743  #ifdef SEARCH_FROM_ZERO
744 -       inode->u.ext3_i.i_next_alloc_block = 0;
745 -       inode->u.ext3_i.i_next_alloc_goal = 0;
746 +       ei->i_next_alloc_block = 0;
747 +       ei->i_next_alloc_goal = 0;
748  #endif
749         /* Writer: end */
750         /* Reader: pointers, ->i_next_alloc* */
751 @@ -490,8 +493,8 @@ static int ext3_find_goal(struct inode *
752                  * try the heuristic for sequential allocation,
753                  * failing that at least try to get decent locality.
754                  */
755 -               if (block == inode->u.ext3_i.i_next_alloc_block)
756 -                       *goal = inode->u.ext3_i.i_next_alloc_goal;
757 +               if (block == ei->i_next_alloc_block)
758 +                       *goal = ei->i_next_alloc_goal;
759                 if (!*goal)
760                         *goal = ext3_find_near(inode, partial);
761  #ifdef SEARCH_FROM_ZERO
762 @@ -619,6 +621,7 @@
763  {
764         int i;
765         int err = 0;
766 +       struct ext3_inode_info *ei = EXT3_I(inode);
767  
768         /*
769          * If we're splicing into a [td]indirect block (as opposed to the
770 @@ -641,11 +644,11 @@ static int ext3_splice_branch(handle_t *
771         /* That's it */
772  
773         *where->p = where->key;
774 -       inode->u.ext3_i.i_next_alloc_block = block;
775 -       inode->u.ext3_i.i_next_alloc_goal = le32_to_cpu(where[num-1].key);
776 +       ei->i_next_alloc_block = block;
777 +       ei->i_next_alloc_goal = le32_to_cpu(where[num-1].key);
778  #ifdef SEARCH_FROM_ZERO
779 -       inode->u.ext3_i.i_next_alloc_block = 0;
780 -       inode->u.ext3_i.i_next_alloc_goal = 0;
781 +       ei->i_next_alloc_block = 0;
782 +       ei->i_next_alloc_goal = 0;
783  #endif
784         /* Writer: end */
785  
786 @@ -729,6 +732,7 @@
787         unsigned long goal;
788         int left;
789         int depth = ext3_block_to_path(inode, iblock, offsets);
790 +       struct ext3_inode_info *ei = EXT3_I(inode);
791         loff_t new_size;
792  
793         J_ASSERT(handle != NULL || create == 0);
794 @@ -782,7 +785,7 @@ out:
795         /*
796          * Block out ext3_truncate while we alter the tree
797          */
798 -       down_read(&inode->u.ext3_i.truncate_sem);
799 +       down_read(&ei->truncate_sem);
800         err = ext3_alloc_branch(handle, inode, left, goal,
801                                         offsets+(partial-chain), partial);
802  
803 @@ -794,7 +797,7 @@ out:
804         if (!err)
805                 err = ext3_splice_branch(handle, inode, iblock, chain,
806                                          partial, left);
807 -       up_read(&inode->u.ext3_i.truncate_sem);
808 +       up_read(&ei->truncate_sem);
809         if (err == -EAGAIN)
810                 goto changed;
811         if (err)
812 @@ -807,8 +810,8 @@ out:
813          * truncate is in progress.  It is racy between multiple parallel
814          * instances of get_block, but we have the BKL.
815          */
816 -       if (new_size > inode->u.ext3_i.i_disksize)
817 -               inode->u.ext3_i.i_disksize = new_size;
818 +       if (new_size > ei->i_disksize)
819 +               ei->i_disksize = new_size;
820  
821         bh_result->b_state |= (1UL << BH_New);
822         goto got_it;
823 @@ -921,7 +924,7 @@ struct buffer_head *ext3_bread(handle_t 
824                 struct buffer_head *tmp_bh;
825  
826                 for (i = 1;
827 -                    inode->u.ext3_i.i_prealloc_count &&
828 +                    EXT3_I(inode)->i_prealloc_count &&
829                      i < EXT3_SB(inode->i_sb)->s_es->s_prealloc_dir_blocks;
830                      i++) {
831                         /*
832 @@ -1131,8 +1134,8 @@ static int ext3_commit_write(struct file
833                         kunmap(page);
834                 }
835         }
836 -       if (inode->i_size > inode->u.ext3_i.i_disksize) {
837 -               inode->u.ext3_i.i_disksize = inode->i_size;
838 +       if (inode->i_size > EXT3_I(inode)->i_disksize) {
839 +               EXT3_I(inode)->i_disksize = inode->i_size;
840                 ret2 = ext3_mark_inode_dirty(handle, inode);
841                 if (!ret) 
842                         ret = ret2;
843 @@ -1832,7 +1835,8 @@ static void ext3_free_branches(handle_t 
844  void ext3_truncate(struct inode * inode)
845  {
846         handle_t *handle;
847 -       u32 *i_data = inode->u.ext3_i.i_data;
848 +       struct ext3_inode_info *ei = EXT3_I(inode);
849 +       u32 *i_data = EXT3_I(inode)->i_data;
850         int addr_per_block = EXT3_ADDR_PER_BLOCK(inode->i_sb);
851         int offsets[4];
852         Indirect chain[4];
853 @@ -1884,13 +1887,13 @@ void ext3_truncate(struct inode * inode)
854          * on-disk inode. We do this via i_disksize, which is the value which
855          * ext3 *really* writes onto the disk inode.
856          */
857 -       inode->u.ext3_i.i_disksize = inode->i_size;
858 +       ei->i_disksize = inode->i_size;
859  
860         /*
861          * From here we block out all ext3_get_block() callers who want to
862          * modify the block allocation tree.
863          */
864 -       down_write(&inode->u.ext3_i.truncate_sem);
865 +       down_write(&ei->truncate_sem);
866  
867         if (n == 1) {           /* direct blocks */
868                 ext3_free_data(handle, inode, NULL, i_data+offsets[0],
869 @@ -1954,7 +1957,7 @@ do_indirects:
870                 case EXT3_TIND_BLOCK:
871                         ;
872         }
873 -       up_write(&inode->u.ext3_i.truncate_sem);
874 +       up_write(&ei->truncate_sem);
875         inode->i_mtime = inode->i_ctime = CURRENT_TIME;
876         ext3_mark_inode_dirty(handle, inode);
877  
878 @@ -1983,6 +1986,8 @@ out_stop:
879  
880  int ext3_get_inode_loc (struct inode *inode, struct ext3_iloc *iloc)
881  {
882 +       struct super_block *sb = inode->i_sb;
883 +       struct ext3_sb_info *sbi = EXT3_SB(sb);
884         struct buffer_head *bh = 0;
885         unsigned long block;
886         unsigned long block_group;
887 @@ -1997,23 +2010,19 @@ int ext3_get_inode_loc (struct inode *in
888                 inode->i_ino != EXT3_JOURNAL_INO &&
889 -               inode->i_ino < EXT3_FIRST_INO(inode->i_sb)) ||
890 -               inode->i_ino > le32_to_cpu(
891 -                       inode->i_sb->u.ext3_sb.s_es->s_inodes_count)) {
892 -               ext3_error (inode->i_sb, "ext3_get_inode_loc",
893 -                           "bad inode number: %lu", inode->i_ino);
894 +               inode->i_ino < EXT3_FIRST_INO(sb)) ||
895 +               inode->i_ino > le32_to_cpu(sbi->s_es->s_inodes_count)) {
896 +               ext3_error (sb, __FUNCTION__, "bad inode #%lu", inode->i_ino);
897                 goto bad_inode;
898         }
899 -       block_group = (inode->i_ino - 1) / EXT3_INODES_PER_GROUP(inode->i_sb);
900 -       if (block_group >= inode->i_sb->u.ext3_sb.s_groups_count) {
901 -               ext3_error (inode->i_sb, "ext3_get_inode_loc",
902 -                           "group >= groups count");
903 +       block_group = (inode->i_ino - 1) / sbi->s_inodes_per_group;
904 +       if (block_group >= sbi->s_groups_count) {
905 +               ext3_error(sb, __FUNCTION__, "group >= groups count");
906                 goto bad_inode;
907         }
908 -       group_desc = block_group >> EXT3_DESC_PER_BLOCK_BITS(inode->i_sb);
909 -       desc = block_group & (EXT3_DESC_PER_BLOCK(inode->i_sb) - 1);
910 -       bh = inode->i_sb->u.ext3_sb.s_group_desc[group_desc];
911 +       group_desc = block_group >> sbi->s_desc_per_block_bits;
912 +       desc = block_group & (sbi->s_desc_per_block - 1);
913 +       bh = sbi->s_group_desc[group_desc];
914         if (!bh) {
915 -               ext3_error (inode->i_sb, "ext3_get_inode_loc",
916 -                           "Descriptor not loaded");
917 +               ext3_error(sb, __FUNCTION__, "Descriptor not loaded");
918                 goto bad_inode;
919         }
920  
921 @@ -2021,17 +2022,17 @@ int ext3_get_inode_loc (struct inode *in
922         /*
923          * Figure out the offset within the block group inode table
924          */
925 -       offset = ((inode->i_ino - 1) % EXT3_INODES_PER_GROUP(inode->i_sb)) *
926 -               EXT3_INODE_SIZE(inode->i_sb);
927 +       offset = ((inode->i_ino - 1) % sbi->s_inodes_per_group) *
928 +               sbi->s_inode_size;
929         block = le32_to_cpu(gdp[desc].bg_inode_table) +
930 -               (offset >> EXT3_BLOCK_SIZE_BITS(inode->i_sb));
931 -       if (!(bh = sb_bread(inode->i_sb, block))) {
932 -               ext3_error (inode->i_sb, "ext3_get_inode_loc",
933 +               (offset >> EXT3_BLOCK_SIZE_BITS(sb));
934 +       if (!(bh = sb_bread(sb, block))) {
935 +               ext3_error (sb, __FUNCTION__,
936                             "unable to read inode block - "
937                             "inode=%lu, block=%lu", inode->i_ino, block);
938                 goto bad_inode;
939         }
940 -       offset &= (EXT3_BLOCK_SIZE(inode->i_sb) - 1);
941 +       offset &= (EXT3_BLOCK_SIZE(sb) - 1);
942  
943         iloc->bh = bh;
944         iloc->raw_inode = (struct ext3_inode *) (bh->b_data + offset);
945 @@ -2047,6 +2048,7 @@ void ext3_read_inode(struct inode * inod
946  {
947         struct ext3_iloc iloc;
948         struct ext3_inode *raw_inode;
949 +       struct ext3_inode_info *ei = EXT3_I(inode);
950         struct buffer_head *bh;
951         int block;
952         
953 @@ -2054,7 +2056,7 @@ void ext3_read_inode(struct inode * inod
954                 goto bad_inode;
955         bh = iloc.bh;
956         raw_inode = iloc.raw_inode;
957 -       init_rwsem(&inode->u.ext3_i.truncate_sem);
958 +       init_rwsem(&ei->truncate_sem);
959         inode->i_mode = le16_to_cpu(raw_inode->i_mode);
960         inode->i_uid = (uid_t)le16_to_cpu(raw_inode->i_uid_low);
961         inode->i_gid = (gid_t)le16_to_cpu(raw_inode->i_gid_low);
962 @@ -2067,7 +2069,7 @@ void ext3_read_inode(struct inode * inod
963         inode->i_atime = le32_to_cpu(raw_inode->i_atime);
964         inode->i_ctime = le32_to_cpu(raw_inode->i_ctime);
965         inode->i_mtime = le32_to_cpu(raw_inode->i_mtime);
966 -       inode->u.ext3_i.i_dtime = le32_to_cpu(raw_inode->i_dtime);
967 +       ei->i_dtime = le32_to_cpu(raw_inode->i_dtime);
968         /* We now have enough fields to check if the inode was active or not.
969          * This is needed because nfsd might try to access dead inodes
970          * the test is that same one that e2fsck uses
971 @@ -2075,7 +2077,7 @@ void ext3_read_inode(struct inode * inod
972          */
973         if (inode->i_nlink == 0) {
974                 if (inode->i_mode == 0 ||
975 -                   !(inode->i_sb->u.ext3_sb.s_mount_state & EXT3_ORPHAN_FS)) {
976 +                   !(EXT3_SB(inode->i_sb)->s_mount_state & EXT3_ORPHAN_FS)) {
977                         /* this inode is deleted */
978                         brelse (bh);
979                         goto bad_inode;
980 @@ -2090,33 +2092,33 @@ void ext3_read_inode(struct inode * inod
981                                          * size */  
982         inode->i_blocks = le32_to_cpu(raw_inode->i_blocks);
983         inode->i_version = ++event;
984 -       inode->u.ext3_i.i_flags = le32_to_cpu(raw_inode->i_flags);
985 +       ei->i_flags = le32_to_cpu(raw_inode->i_flags);
986  #ifdef EXT3_FRAGMENTS
987 -       inode->u.ext3_i.i_faddr = le32_to_cpu(raw_inode->i_faddr);
988 -       inode->u.ext3_i.i_frag_no = raw_inode->i_frag;
989 -       inode->u.ext3_i.i_frag_size = raw_inode->i_fsize;
990 +       ei->i_faddr = le32_to_cpu(raw_inode->i_faddr);
991 +       ei->i_frag_no = raw_inode->i_frag;
992 +       ei->i_frag_size = raw_inode->i_fsize;
993  #endif
994 -       inode->u.ext3_i.i_file_acl = le32_to_cpu(raw_inode->i_file_acl);
995 +       ei->i_file_acl = le32_to_cpu(raw_inode->i_file_acl);
996         if (!S_ISREG(inode->i_mode)) {
997 -               inode->u.ext3_i.i_dir_acl = le32_to_cpu(raw_inode->i_dir_acl);
998 +               ei->i_dir_acl = le32_to_cpu(raw_inode->i_dir_acl);
999         } else {
1000                 inode->i_size |=
1001                         ((__u64)le32_to_cpu(raw_inode->i_size_high)) << 32;
1002         }
1003 -       inode->u.ext3_i.i_disksize = inode->i_size;
1004 +       ei->i_disksize = inode->i_size;
1005         inode->i_generation = le32_to_cpu(raw_inode->i_generation);
1006  #ifdef EXT3_PREALLOCATE
1007 -       inode->u.ext3_i.i_prealloc_count = 0;
1008 +       ei->i_prealloc_count = 0;
1009  #endif
1010 -       inode->u.ext3_i.i_block_group = iloc.block_group;
1011 +       ei->i_block_group = iloc.block_group;
1012  
1013         /*
1014          * NOTE! The in-memory inode i_data array is in little-endian order
1015          * even on big-endian machines: we do NOT byteswap the block numbers!
1016          */
1017         for (block = 0; block < EXT3_N_BLOCKS; block++)
1018 -               inode->u.ext3_i.i_data[block] = iloc.raw_inode->i_block[block];
1019 -       INIT_LIST_HEAD(&inode->u.ext3_i.i_orphan);
1020 +               ei->i_data[block] = iloc.raw_inode->i_block[block];
1021 +       INIT_LIST_HEAD(&ei->i_orphan);
1022  
1023         brelse (iloc.bh);
1024  
1025 @@ -2143,17 +2145,17 @@ void ext3_read_inode(struct inode * inod
1026         /* inode->i_attr_flags = 0;                             unused */
1027 -       if (inode->u.ext3_i.i_flags & EXT3_SYNC_FL) {
1028 +       if (ei->i_flags & EXT3_SYNC_FL) {
1029                 /* inode->i_attr_flags |= ATTR_FLAG_SYNCRONOUS; unused */
1030                 inode->i_flags |= S_SYNC;
1031         }
1032 -       if (inode->u.ext3_i.i_flags & EXT3_APPEND_FL) {
1033 +       if (ei->i_flags & EXT3_APPEND_FL) {
1034                 /* inode->i_attr_flags |= ATTR_FLAG_APPEND;     unused */
1035                 inode->i_flags |= S_APPEND;
1036         }
1037 -       if (inode->u.ext3_i.i_flags & EXT3_IMMUTABLE_FL) {
1038 +       if (ei->i_flags & EXT3_IMMUTABLE_FL) {
1039                 /* inode->i_attr_flags |= ATTR_FLAG_IMMUTABLE;  unused */
1040                 inode->i_flags |= S_IMMUTABLE;
1041         }
1042 -       if (inode->u.ext3_i.i_flags & EXT3_NOATIME_FL) {
1043 +       if (ei->i_flags & EXT3_NOATIME_FL) {
1044                 /* inode->i_attr_flags |= ATTR_FLAG_NOATIME;    unused */
1045                 inode->i_flags |= S_NOATIME;
1046         }
1047 @@ -2175,6 +2177,7 @@ static int ext3_do_update_inode(handle_t
1048                                 struct ext3_iloc *iloc)
1049  {
1050         struct ext3_inode *raw_inode = iloc->raw_inode;
1051 +       struct ext3_inode_info *ei = EXT3_I(inode);
1052         struct buffer_head *bh = iloc->bh;
1053         int err = 0, rc, block;
1054  
1055 @@ -2192,7 +2195,7 @@ static int ext3_do_update_inode(handle_t
1056   * Fix up interoperability with old kernels. Otherwise, old inodes get
1057   * re-used with the upper 16 bits of the uid/gid intact
1058   */
1059 -               if(!inode->u.ext3_i.i_dtime) {
1060 +               if(!ei->i_dtime) {
1061                         raw_inode->i_uid_high =
1062                                 cpu_to_le16(high_16_bits(inode->i_uid));
1063                         raw_inode->i_gid_high =
1064 @@ -2210,34 +2213,33 @@ static int ext3_do_update_inode(handle_t
1065                 raw_inode->i_gid_high = 0;
1066         }
1067         raw_inode->i_links_count = cpu_to_le16(inode->i_nlink);
1068 -       raw_inode->i_size = cpu_to_le32(inode->u.ext3_i.i_disksize);
1069 +       raw_inode->i_size = cpu_to_le32(ei->i_disksize);
1070         raw_inode->i_atime = cpu_to_le32(inode->i_atime);
1071         raw_inode->i_ctime = cpu_to_le32(inode->i_ctime);
1072         raw_inode->i_mtime = cpu_to_le32(inode->i_mtime);
1073         raw_inode->i_blocks = cpu_to_le32(inode->i_blocks);
1074 -       raw_inode->i_dtime = cpu_to_le32(inode->u.ext3_i.i_dtime);
1075 -       raw_inode->i_flags = cpu_to_le32(inode->u.ext3_i.i_flags);
1076 +       raw_inode->i_dtime = cpu_to_le32(ei->i_dtime);
1077 +       raw_inode->i_flags = cpu_to_le32(ei->i_flags);
1078  #ifdef EXT3_FRAGMENTS
1079 -       raw_inode->i_faddr = cpu_to_le32(inode->u.ext3_i.i_faddr);
1080 -       raw_inode->i_frag = inode->u.ext3_i.i_frag_no;
1081 -       raw_inode->i_fsize = inode->u.ext3_i.i_frag_size;
1082 +       raw_inode->i_faddr = cpu_to_le32(ei->i_faddr);
1083 +       raw_inode->i_frag = ei->i_frag_no;
1084 +       raw_inode->i_fsize = ei->i_frag_size;
1085  #else
1086         /* If we are not tracking these fields in the in-memory inode,
1087          * then preserve them on disk, but still initialise them to zero
1088          * for new inodes. */
1089 -       if (EXT3_I(inode)->i_state & EXT3_STATE_NEW) {
1090 +       if (ei->i_state & EXT3_STATE_NEW) {
1091                 raw_inode->i_faddr = 0;
1092                 raw_inode->i_frag = 0;
1093                 raw_inode->i_fsize = 0;
1094         }
1095  #endif
1096 -       raw_inode->i_file_acl = cpu_to_le32(inode->u.ext3_i.i_file_acl);
1097 +       raw_inode->i_file_acl = cpu_to_le32(ei->i_file_acl);
1098         if (!S_ISREG(inode->i_mode)) {
1099 -               raw_inode->i_dir_acl = cpu_to_le32(inode->u.ext3_i.i_dir_acl);
1100 +               raw_inode->i_dir_acl = cpu_to_le32(ei->i_dir_acl);
1101         } else {
1102 -               raw_inode->i_size_high =
1103 -                       cpu_to_le32(inode->u.ext3_i.i_disksize >> 32);
1104 -               if (inode->u.ext3_i.i_disksize > 0x7fffffffULL) {
1105 +               raw_inode->i_size_high = cpu_to_le32(ei->i_disksize >> 32);
1106 +               if (ei->i_disksize > MAX_NON_LFS) {
1107                         struct super_block *sb = inode->i_sb;
1108                         if (!EXT3_HAS_RO_COMPAT_FEATURE(sb,
1109                                         EXT3_FEATURE_RO_COMPAT_LARGE_FILE) ||
1110 @@ -2247,7 +2249,7 @@ static int ext3_do_update_inode(handle_t
1111                                 * created, add a flag to the superblock.
1112                                 */
1113                                 err = ext3_journal_get_write_access(handle,
1114 -                                               sb->u.ext3_sb.s_sbh);
1115 +                                               EXT3_SB(sb)->s_sbh);
1116                                 if (err)
1117                                         goto out_brelse;
1118                                 ext3_update_dynamic_rev(sb);
1119 @@ -2256,7 +2258,7 @@ static int ext3_do_update_inode(handle_t
1120                                 sb->s_dirt = 1;
1121                                 handle->h_sync = 1;
1122                                 err = ext3_journal_dirty_metadata(handle,
1123 -                                               sb->u.ext3_sb.s_sbh);
1124 +                                               EXT3_SB(sb)->s_sbh);
1125                         }
1126                 }
1127         }
1128 @@ -2265,13 +2267,13 @@ static int ext3_do_update_inode(handle_t
1129                 raw_inode->i_block[0] =
1130                         cpu_to_le32(kdev_t_to_nr(inode->i_rdev));
1131         else for (block = 0; block < EXT3_N_BLOCKS; block++)
1132 -               raw_inode->i_block[block] = inode->u.ext3_i.i_data[block];
1133 +               raw_inode->i_block[block] = ei->i_data[block];
1134  
1135         BUFFER_TRACE(bh, "call ext3_journal_dirty_metadata");
1136         rc = ext3_journal_dirty_metadata(handle, bh);
1137         if (!err)
1138                 err = rc;
1139 -       EXT3_I(inode)->i_state &= ~EXT3_STATE_NEW;
1140 +       ei->i_state &= ~EXT3_STATE_NEW;
1141  
1142  out_brelse:
1143         brelse (bh);
1144 @@ -2379,7 +2381,7 @@ int ext3_setattr(struct dentry *dentry, 
1145                 }
1146                 
1147                 error = ext3_orphan_add(handle, inode);
1148 -               inode->u.ext3_i.i_disksize = attr->ia_size;
1149 +               EXT3_I(inode)->i_disksize = attr->ia_size;
1150                 rc = ext3_mark_inode_dirty(handle, inode);
1151                 if (!error)
1152                         error = rc;
1153 @@ -2622,9 +2624,9 @@ int ext3_change_inode_journal_flag(struc
1154          */
1155  
1156         if (val)
1157 -               inode->u.ext3_i.i_flags |= EXT3_JOURNAL_DATA_FL;
1158 +               EXT3_I(inode)->i_flags |= EXT3_JOURNAL_DATA_FL;
1159         else
1160 -               inode->u.ext3_i.i_flags &= ~EXT3_JOURNAL_DATA_FL;
1161 +               EXT3_I(inode)->i_flags &= ~EXT3_JOURNAL_DATA_FL;
1162  
1163         journal_unlock_updates(journal);
1164  
1165 --- ./fs/ext3/ioctl.c.orig      Fri Apr 12 10:27:49 2002
1166 +++ ./fs/ext3/ioctl.c   Tue May  7 15:20:52 2002
1167 @@ -18,13 +18,14 @@
1168  int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd,
1169                 unsigned long arg)
1170  {
1171 +       struct ext3_inode_info *ei = EXT3_I(inode);
1172         unsigned int flags;
1173  
1174         ext3_debug ("cmd = %u, arg = %lu\n", cmd, arg);
1175  
1176         switch (cmd) {
1177         case EXT3_IOC_GETFLAGS:
1178 -               flags = inode->u.ext3_i.i_flags & EXT3_FL_USER_VISIBLE;
1179 +               flags = ei->i_flags & EXT3_FL_USER_VISIBLE;
1180                 return put_user(flags, (int *) arg);
1181         case EXT3_IOC_SETFLAGS: {
1182                 handle_t *handle = NULL;
1183 @@ -42,7 +42,7 @@ int ext3_ioctl (struct inode * inode, st
1184                 if (get_user(flags, (int *) arg))
1185                         return -EFAULT;
1186  
1187 -               oldflags = inode->u.ext3_i.i_flags;
1188 +               oldflags = ei->i_flags;
1189  
1190                 /* The JOURNAL_DATA flag is modifiable only by root */
1191                 jflag = flags & EXT3_JOURNAL_DATA_FL;
1192 @@ -79,7 +79,7 @@ int ext3_ioctl (struct inode * inode, st
1193                 
1194                 flags = flags & EXT3_FL_USER_MODIFIABLE;
1195                 flags |= oldflags & ~EXT3_FL_USER_MODIFIABLE;
1196 -               inode->u.ext3_i.i_flags = flags;
1197 +               ei->i_flags = flags;
1198  
1199                 if (flags & EXT3_SYNC_FL)
1200                         inode->i_flags |= S_SYNC;
1201 @@ -155,12 +155,12 @@ flags_err:
1202                         int ret = 0;
1203  
1204                         set_current_state(TASK_INTERRUPTIBLE);
1205 -                       add_wait_queue(&sb->u.ext3_sb.ro_wait_queue, &wait);
1206 -                       if (timer_pending(&sb->u.ext3_sb.turn_ro_timer)) {
1207 +                       add_wait_queue(&EXT3_SB(sb)->ro_wait_queue, &wait);
1208 +                       if (timer_pending(&EXT3_SB(sb)->turn_ro_timer)) {
1209                                 schedule();
1210                                 ret = 1;
1211                         }
1212 -                       remove_wait_queue(&sb->u.ext3_sb.ro_wait_queue, &wait);
1213 +                       remove_wait_queue(&EXT3_SB(sb)->ro_wait_queue, &wait);
1214                         return ret;
1215                 }
1216  #endif
1217 --- ./fs/ext3/namei.c.orig      Fri Apr 12 10:27:49 2002
1218 +++ ./fs/ext3/namei.c   Tue May  7 16:05:51 2002
1219 @@ -636,7 +636,7 @@ static struct buffer_head * ext3_find_en
1220         }
1221         
1222         nblocks = dir->i_size >> EXT3_BLOCK_SIZE_BITS(sb);
1223 -       start = dir->u.ext3_i.i_dir_start_lookup;
1224 +       start = EXT3_I(dir)->i_dir_start_lookup;
1225         if (start >= nblocks)
1226                 start = 0;
1227         block = start;
1228 @@ -677,7 +677,7 @@ restart:
1229                 i = search_dirblock(bh, dir, dentry,
1230                             block << EXT3_BLOCK_SIZE_BITS(sb), res_dir);
1231                 if (i == 1) {
1232 -                       dir->u.ext3_i.i_dir_start_lookup = block;
1233 +                       EXT3_I(dir)->i_dir_start_lookup = block;
1234                         ret = bh;
1235                         goto cleanup_and_exit;
1236                 } else {
1237 @@ -1419,7 +1419,7 @@ int ext3_orphan_add(handle_t *handle, st
1238         int err = 0, rc;
1239         
1240         lock_super(sb);
1241 -       if (!list_empty(&inode->u.ext3_i.i_orphan))
1242 +       if (!list_empty(&EXT3_I(inode)->i_orphan))
1243                 goto out_unlock;
1244  
1245         /* Orphan handling is only valid for files with data blocks
1246 @@ -1430,8 +1430,8 @@ int ext3_orphan_add(handle_t *handle, st
1247         J_ASSERT ((S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
1248                 S_ISLNK(inode->i_mode)) || inode->i_nlink == 0);
1249  
1250 -       BUFFER_TRACE(sb->u.ext3_sb.s_sbh, "get_write_access");
1251 -       err = ext3_journal_get_write_access(handle, sb->u.ext3_sb.s_sbh);
1252 +       BUFFER_TRACE(EXT3_SB(sb)->s_sbh, "get_write_access");
1253 +       err = ext3_journal_get_write_access(handle, EXT3_SB(sb)->s_sbh);
1254         if (err)
1255                 goto out_unlock;
1256         
1257 @@ -1442,7 +1442,7 @@ int ext3_orphan_add(handle_t *handle, st
1258         /* Insert this inode at the head of the on-disk orphan list... */
1259         NEXT_ORPHAN(inode) = le32_to_cpu(EXT3_SB(sb)->s_es->s_last_orphan);
1260         EXT3_SB(sb)->s_es->s_last_orphan = cpu_to_le32(inode->i_ino);
1261 -       err = ext3_journal_dirty_metadata(handle, sb->u.ext3_sb.s_sbh);
1262 +       err = ext3_journal_dirty_metadata(handle, EXT3_SB(sb)->s_sbh);
1263         rc = ext3_mark_iloc_dirty(handle, inode, &iloc);
1264         if (!err)
1265                 err = rc;
1266 @@ -1456,7 +1456,7 @@ int ext3_orphan_add(handle_t *handle, st
1267          * This is safe: on error we're going to ignore the orphan list
1268          * anyway on the next recovery. */
1269         if (!err)
1270 -               list_add(&inode->u.ext3_i.i_orphan, &EXT3_SB(sb)->s_orphan);
1271 +               list_add(&EXT3_I(inode)->i_orphan, &EXT3_SB(sb)->s_orphan);
1272  
1273         jbd_debug(4, "superblock will point to %ld\n", inode->i_ino);
1274         jbd_debug(4, "orphan inode %ld will point to %d\n",
1275 @@ -714,25 +770,25 @@
1276  int ext3_orphan_del(handle_t *handle, struct inode *inode)
1277  {
1278         struct list_head *prev;
1279 +       struct ext3_inode_info *ei = EXT3_I(inode);
1280         struct ext3_sb_info *sbi;
1281         unsigned long ino_next;
1282         struct ext3_iloc iloc;
1283         int err = 0;
1284  
1285         lock_super(inode->i_sb);
1286 -       if (list_empty(&inode->u.ext3_i.i_orphan)) {
1287 +       if (list_empty(&ei->i_orphan)) {
1288                 unlock_super(inode->i_sb);
1289                 return 0;
1290         }
1291  
1292         ino_next = NEXT_ORPHAN(inode);
1293 -       prev = inode->u.ext3_i.i_orphan.prev;
1294 +       prev = ei->i_orphan.prev;
1295         sbi = EXT3_SB(inode->i_sb);
1296  
1297         jbd_debug(4, "remove inode %lu from orphan list\n", inode->i_ino);
1298  
1299 -       list_del(&inode->u.ext3_i.i_orphan);
1300 -       INIT_LIST_HEAD(&inode->u.ext3_i.i_orphan);
1301 +       list_del_init(&ei->i_orphan);
1302  
1303         /* If we're on an error path, we may not have a valid
1304          * transaction handle with which to update the orphan list on
1305 @@ -1520,8 +1520,7 @@ int ext3_orphan_del(handle_t *handle, st
1306                 err = ext3_journal_dirty_metadata(handle, sbi->s_sbh);
1307         } else {
1308                 struct ext3_iloc iloc2;
1309 -               struct inode *i_prev =
1310 -                       list_entry(prev, struct inode, u.ext3_i.i_orphan);
1311 +               struct inode *i_prev = orphan_list_entry(prev);
1312  
1313                 jbd_debug(4, "orphan inode %lu will point to %lu\n",
1314                           i_prev->i_ino, ino_next);
1315 @@ -1695,10 +1695,10 @@ static int ext3_symlink (struct inode * 
1316                         goto out_no_entry;
1317         } else {
1318                 inode->i_op = &ext3_fast_symlink_inode_operations;
1319 -               memcpy((char*)&inode->u.ext3_i.i_data,symname,l);
1320 +               memcpy((char*)&EXT3_I(inode)->i_data,symname,l);
1321                 inode->i_size = l-1;
1322         }
1323 -       inode->u.ext3_i.i_disksize = inode->i_size;
1324 +       EXT3_I(inode)->i_disksize = inode->i_size;
1325         err = ext3_add_nondir(handle, dentry, inode);
1326         ext3_mark_inode_dirty(handle, inode);
1327  out_stop:
1328 --- ./fs/ext3/super.c.orig      Fri Apr 12 10:27:49 2002
1329 +++ ./fs/ext3/super.c   Tue May  7 16:05:44 2002
1330 @@ -121,7 +121,7 @@ static int ext3_error_behaviour(struct s
1331         /* If no overrides were specified on the mount, then fall back
1332          * to the default behaviour set in the filesystem's superblock
1333          * on disk. */
1334 -       switch (le16_to_cpu(sb->u.ext3_sb.s_es->s_errors)) {
1335 +       switch (le16_to_cpu(EXT3_SB(sb)->s_es->s_errors)) {
1336         case EXT3_ERRORS_PANIC:
1337                 return EXT3_ERRORS_PANIC;
1338         case EXT3_ERRORS_RO:
1339 @@ -269,9 +269,9 @@ void ext3_abort (struct super_block * sb
1340                 return;
1341         
1342         printk (KERN_CRIT "Remounting filesystem read-only\n");
1343 -       sb->u.ext3_sb.s_mount_state |= EXT3_ERROR_FS;
1344 +       EXT3_SB(sb)->s_mount_state |= EXT3_ERROR_FS;
1345         sb->s_flags |= MS_RDONLY;
1346 -       sb->u.ext3_sb.s_mount_opt |= EXT3_MOUNT_ABORT;
1347 +       EXT3_SB(sb)->s_mount_opt |= EXT3_MOUNT_ABORT;
1348         journal_abort(EXT3_SB(sb)->s_journal, -EIO);
1349  }
1350  
1351 @@ -377,8 +377,6 @@ static int ext3_blkdev_remove(struct ext3
1352         return ret;
1353  }
1354  
1355 -#define orphan_list_entry(l) list_entry((l), struct inode, u.ext3_i.i_orphan)
1356 -
1357  static void dump_orphan_list(struct super_block *sb, struct ext3_sb_info *sbi)
1358  {
1359         struct list_head *l;
1360 @@ -818,7 +818,7 @@ static void ext3_orphan_cleanup (struct 
1361                 sb->s_flags &= ~MS_RDONLY;
1362         }
1363  
1364 -       if (sb->u.ext3_sb.s_mount_state & EXT3_ERROR_FS) {
1365 +       if (EXT3_SB(sb)->s_mount_state & EXT3_ERROR_FS) {
1366                 if (es->s_last_orphan)
1367                         jbd_debug(1, "Errors on filesystem, "
1368                                   "clearing orphan list.\n");
1369 @@ -1463,12 +1463,14 @@ static void ext3_commit_super (struct su
1370                                struct ext3_super_block * es,
1371                                int sync)
1372  {
1373 +       struct buffer_head *sbh = EXT3_SB(sb)->s_sbh;
1374 +
1375         es->s_wtime = cpu_to_le32(CURRENT_TIME);
1376 -       BUFFER_TRACE(sb->u.ext3_sb.s_sbh, "marking dirty");
1377 -       mark_buffer_dirty(sb->u.ext3_sb.s_sbh);
1378 +       BUFFER_TRACE(sbh, "marking dirty");
1379 +       mark_buffer_dirty(sbh);
1380         if (sync) {
1381 -               ll_rw_block(WRITE, 1, &sb->u.ext3_sb.s_sbh);
1382 -               wait_on_buffer(sb->u.ext3_sb.s_sbh);
1383 +               ll_rw_block(WRITE, 1, &sbh);
1384 +               wait_on_buffer(sbh);
1385         }
1386  }
1387  
1388 @@ -1519,7 +1521,7 @@ static void ext3_clear_journal_err(struc
1389                 ext3_warning(sb, __FUNCTION__, "Marking fs in need of "
1390                              "filesystem check.");
1391                 
1392 -               sb->u.ext3_sb.s_mount_state |= EXT3_ERROR_FS;
1393 +               EXT3_SB(sb)->s_mount_state |= EXT3_ERROR_FS;
1394                 es->s_state |= cpu_to_le16(EXT3_ERROR_FS);
1395                 ext3_commit_super (sb, es, 1);
1396  
1397 --- ./fs/ext3/symlink.c.orig    Fri Apr 12 10:27:49 2002
1398 +++ ./fs/ext3/symlink.c Tue May  7 15:25:39 2002
1399 @@ -23,13 +23,13 @@
1400  
1401  static int ext3_readlink(struct dentry *dentry, char *buffer, int buflen)
1402  {
1403 -       char *s = (char *)dentry->d_inode->u.ext3_i.i_data;
1404 -       return vfs_readlink(dentry, buffer, buflen, s);
1405 +       struct ext3_inode_info *ei = EXT3_I(dentry->d_inode);
1406 +       return vfs_readlink(dentry, buffer, buflen, (char *)ei->i_data);
1407  }
1408  
1409  static int ext3_follow_link(struct dentry *dentry, struct nameidata *nd)
1410  {
1411 -       char *s = (char *)dentry->d_inode->u.ext3_i.i_data;
1412 -       return vfs_follow_link(nd, s);
1413 +       struct ext3_inode_info *ei = EXT3_I(dentry->d_inode);
1414 +       return vfs_follow_link(nd, (char*)ei->i_data);
1415  }
1416  
1417 --- ./include/linux/ext3_fs.h.orig      Tue Apr 16 14:27:25 2002
1418 +++ ./include/linux/ext3_fs.h   Tue May  7 16:47:36 2002
1419 @@ -84,22 +84,25 @@
1420  #define EXT3_MIN_BLOCK_SIZE            1024
1421  #define        EXT3_MAX_BLOCK_SIZE             4096
1422  #define EXT3_MIN_BLOCK_LOG_SIZE                  10
1423 +
1424  #ifdef __KERNEL__
1425 -# define EXT3_BLOCK_SIZE(s)            ((s)->s_blocksize)
1426 -#else
1427 -# define EXT3_BLOCK_SIZE(s)            (EXT3_MIN_BLOCK_SIZE << (s)->s_log_block_size)
1428 -#endif
1429 -#define        EXT3_ADDR_PER_BLOCK(s)          (EXT3_BLOCK_SIZE(s) / sizeof (__u32))
1430 -#ifdef __KERNEL__
1431 -# define EXT3_BLOCK_SIZE_BITS(s)       ((s)->s_blocksize_bits)
1432 -#else
1433 -# define EXT3_BLOCK_SIZE_BITS(s)       ((s)->s_log_block_size + 10)
1434 -#endif
1435 -#ifdef __KERNEL__
1436 -#define        EXT3_ADDR_PER_BLOCK_BITS(s)     ((s)->u.ext3_sb.s_addr_per_block_bits)
1437 -#define EXT3_INODE_SIZE(s)             ((s)->u.ext3_sb.s_inode_size)
1438 -#define EXT3_FIRST_INO(s)              ((s)->u.ext3_sb.s_first_ino)
1439 +#define EXT3_SB(sb)    (&((sb)->u.ext3_sb))
1440 +#define EXT3_I(inode)  (&((inode)->u.ext3_i))
1441 +
1442 +#define EXT3_BLOCK_SIZE(s)             ((s)->s_blocksize)
1443 +#define EXT3_BLOCK_SIZE_BITS(s)                ((s)->s_blocksize_bits)
1444 +#define        EXT3_ADDR_PER_BLOCK_BITS(s)     (EXT3_SB(s)->s_addr_per_block_bits)
1445 +#define EXT3_INODE_SIZE(s)             (EXT3_SB(s)->s_inode_size)
1446 +#define EXT3_FIRST_INO(s)              (EXT3_SB(s)->s_first_ino)
1447  #else
1448 +
1449 +/* Assume that user mode programs are passing in an ext3fs superblock, not
1450 + * a kernel struct super_block.  This will allow us to call the feature-test
1451 + * macros from user land. */
1452 +#define EXT3_SB(sb)    (sb)
1453 +
1454 +#define EXT3_BLOCK_SIZE(s)     (EXT3_MIN_BLOCK_SIZE << (s)->s_log_block_size)
1455 +#define EXT3_BLOCK_SIZE_BITS(s)        ((s)->s_log_block_size + 10)
1456  #define EXT3_INODE_SIZE(s)     (((s)->s_rev_level == EXT3_GOOD_OLD_REV) ? \
1457                                  EXT3_GOOD_OLD_INODE_SIZE : \
1458                                  (s)->s_inode_size)
1459 @@ -108,6 +110,7 @@
1460                                  EXT3_GOOD_OLD_FIRST_INO : \
1461                                  (s)->s_first_ino)
1462  #endif
1463 +#define EXT3_ADDR_PER_BLOCK(s) (EXT3_BLOCK_SIZE(s) / sizeof (__u32))
1464  
1465  /*
1466   * Macro-instructions used to manage fragments
1467 @@ -116,8 +120,8 @@
1468  #define        EXT3_MAX_FRAG_SIZE              4096
1469  #define EXT3_MIN_FRAG_LOG_SIZE           10
1470  #ifdef __KERNEL__
1471 -# define EXT3_FRAG_SIZE(s)             ((s)->u.ext3_sb.s_frag_size)
1472 -# define EXT3_FRAGS_PER_BLOCK(s)       ((s)->u.ext3_sb.s_frags_per_block)
1473 +# define EXT3_FRAG_SIZE(s)             (EXT3_SB(s)->s_frag_size)
1474 +# define EXT3_FRAGS_PER_BLOCK(s)       (EXT3_SB(s)->s_frags_per_block)
1475  #else
1476  # define EXT3_FRAG_SIZE(s)             (EXT3_MIN_FRAG_SIZE << (s)->s_log_frag_size)
1477  # define EXT3_FRAGS_PER_BLOCK(s)       (EXT3_BLOCK_SIZE(s) / EXT3_FRAG_SIZE(s))
1478 @@ -163,15 +167,13 @@
1479  /*
1480   * Macro-instructions used to manage group descriptors
1481   */
1482 +# define EXT3_BLOCKS_PER_GROUP(s)      (EXT3_SB(s)->s_blocks_per_group)
1483 +# define EXT3_INODES_PER_GROUP(s)      (EXT3_SB(s)->s_inodes_per_group)
1484  #ifdef __KERNEL__
1485 -# define EXT3_BLOCKS_PER_GROUP(s)      ((s)->u.ext3_sb.s_blocks_per_group)
1486 -# define EXT3_DESC_PER_BLOCK(s)                ((s)->u.ext3_sb.s_desc_per_block)
1487 -# define EXT3_INODES_PER_GROUP(s)      ((s)->u.ext3_sb.s_inodes_per_group)
1488 -# define EXT3_DESC_PER_BLOCK_BITS(s)   ((s)->u.ext3_sb.s_desc_per_block_bits)
1489 +# define EXT3_DESC_PER_BLOCK(s)                (EXT3_SB(s)->s_desc_per_block)
1490 +# define EXT3_DESC_PER_BLOCK_BITS(s)   (EXT3_SB(s)->s_desc_per_block_bits)
1491  #else
1492 -# define EXT3_BLOCKS_PER_GROUP(s)      ((s)->s_blocks_per_group)
1493  # define EXT3_DESC_PER_BLOCK(s)                (EXT3_BLOCK_SIZE(s) / sizeof (struct ext3_group_desc))
1494 -# define EXT3_INODES_PER_GROUP(s)      ((s)->s_inodes_per_group)
1495  #endif
1496  
1497  /*
1498 @@ -344,7 +347,7 @@
1499  #ifndef _LINUX_EXT2_FS_H
1500  #define clear_opt(o, opt)              o &= ~EXT3_MOUNT_##opt
1501  #define set_opt(o, opt)                        o |= EXT3_MOUNT_##opt
1502 -#define test_opt(sb, opt)              ((sb)->u.ext3_sb.s_mount_opt & \
1503 +#define test_opt(sb, opt)              (EXT3_SB(sb)->s_mount_opt & \
1504                                          EXT3_MOUNT_##opt)
1505  #else
1506  #define EXT2_MOUNT_NOLOAD              EXT3_MOUNT_NOLOAD
1507 @@ -441,17 +443,11 @@
1508  /*EC*/ __u32   s_reserved[197];        /* Padding to the end of the block */
1509  };
1510  
1511 -#ifdef __KERNEL__
1512 -#define EXT3_SB(sb)    (&((sb)->u.ext3_sb))
1513 -#define EXT3_I(inode)  (&((inode)->u.ext3_i))
1514 -#else
1515 -/* Assume that user mode programs are passing in an ext3fs superblock, not
1516 - * a kernel struct super_block.  This will allow us to call the feature-test
1517 - * macros from user land. */
1518 -#define EXT3_SB(sb)    (sb)
1519 -#endif
1520 -
1521 -#define NEXT_ORPHAN(inode) (inode)->u.ext3_i.i_dtime
1522 +#define NEXT_ORPHAN(inode) EXT3_I(inode)->i_dtime
1523 +static inline struct inode *orphan_list_entry(struct list_head *l)
1524 +{
1525 +       return list_entry(l, struct inode, u.ext3_i.i_orphan);
1526 +}
1527  
1528  /*
1529   * Codes for operating systems
1530 --- ./include/linux/ext3_jbd.h.orig     Tue May  7 14:44:08 2002
1531 +++ ./include/linux/ext3_jbd.h  Tue May  7 14:44:43 2002
1532 @@ -291,7 +291,7 @@
1533                 return 1;
1534         if (test_opt(inode->i_sb, DATA_FLAGS) == EXT3_MOUNT_JOURNAL_DATA)
1535                 return 1;
1536 -       if (inode->u.ext3_i.i_flags & EXT3_JOURNAL_DATA_FL)
1537 +       if (EXT3_I(inode)->i_flags & EXT3_JOURNAL_DATA_FL)
1538                 return 1;
1539         return 0;
1540  }