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