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_
5 struct ext3_group_desc * gdp;
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);
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_
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;
32 - *bh = sb->u.ext3_sb.s_group_desc[group_desc];
33 + *bh = EXT3_SB(sb)->s_group_desc[group_desc];
37 @@ -104,8 +104,8 @@ static int read_block_bitmap (struct sup
38 * this group. The IO will be retried next time.
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;
48 @@ -128,16 +128,17 @@ static int __load_block_bitmap (struct s
50 unsigned long block_bitmap_number;
51 struct buffer_head * block_bitmap;
52 + struct ext3_sb_info *sbi = EXT3_SB(sb);
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);
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] ==
70 ext3_error (sb, "__load_block_bitmap",
71 @@ -149,21 +150,20 @@ static int __load_block_bitmap (struct s
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++)
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];
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;
103 * There's still one special case here --- if block_bitmap == 0
104 @@ -173,17 +173,14 @@ static int __load_block_bitmap (struct s
106 retval = read_block_bitmap (sb, block_group, 0);
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++;
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;
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];
127 retval = read_block_bitmap (sb, block_group, 0);
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)
133 + struct ext3_sb_info *sbi = EXT3_SB(sb);
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?
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]) {
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?
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]) {
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.
166 - if (!sb->u.ext3_sb.s_block_bitmap[slot])
167 + if (!sbi->s_block_bitmap[slot])
171 @@ -275,8 +273,9 @@ void ext3_free_blocks (handle_t *handle,
175 - es = sb->u.ext3_sb.s_es;
176 - if (block < le32_to_cpu(es->s_first_data_block) ||
177 + es = EXT3_SB(sb)->s_es;
178 + if (block < le32_to_cpu(es->s_first_data_block) ||
179 + block + count < block ||
180 (block + count) > le32_to_cpu(es->s_blocks_count)) {
181 ext3_error (sb, "ext3_free_blocks",
182 "Freeing blocks not in datazone - "
183 @@ -304,22 +303,11 @@ do_more:
187 - bitmap_bh = sb->u.ext3_sb.s_block_bitmap[bitmap_nr];
188 + bitmap_bh = EXT3_SB(sb)->s_block_bitmap[bitmap_nr];
189 gdp = ext3_get_group_desc (sb, block_group, &gd_bh);
193 - if (in_range (le32_to_cpu(gdp->bg_block_bitmap), block, count) ||
194 - in_range (le32_to_cpu(gdp->bg_inode_bitmap), block, count) ||
195 - in_range (block, le32_to_cpu(gdp->bg_inode_table),
196 - sb->u.ext3_sb.s_itb_per_group) ||
197 - in_range (block + count - 1, le32_to_cpu(gdp->bg_inode_table),
198 - sb->u.ext3_sb.s_itb_per_group))
199 - ext3_error (sb, "ext3_free_blocks",
200 - "Freeing blocks in system zones - "
201 - "Block = %lu, count = %lu",
205 * We are about to start releasing blocks in the bitmap,
206 * so we need undo access.
207 @@ -340,19 +328,29 @@ do_more:
211 - BUFFER_TRACE(sb->u.ext3_sb.s_sbh, "get_write_access");
212 - err = ext3_journal_get_write_access(handle, sb->u.ext3_sb.s_sbh);
213 + BUFFER_TRACE(EXT3_SB(sb)->s_sbh, "get_write_access");
214 + err = ext3_journal_get_write_access(handle, EXT3_SB(sb)->s_sbh);
218 - for (i = 0; i < count; i++) {
219 + for (i = 0; i < count; i++, block++) {
220 + if (block == le32_to_cpu(gdp->bg_block_bitmap) ||
221 + block == le32_to_cpu(gdp->bg_inode_bitmap) ||
222 + in_range(block, le32_to_cpu(gdp->bg_inode_table),
223 + EXT3_SB(sb)->s_itb_per_group)) {
224 + ext3_error(sb, __FUNCTION__,
225 + "Freeing block in system zone - block = %lu",
231 * An HJ special. This is expensive...
233 #ifdef CONFIG_JBD_DEBUG
235 struct buffer_head *debug_bh;
236 - debug_bh = sb_get_hash_table(sb, block + i);
237 + debug_bh = sb_get_hash_table(sb, block);
239 BUFFER_TRACE(debug_bh, "Deleted!");
240 if (!bh2jh(bitmap_bh)->b_committed_data)
241 @@ -365,9 +363,8 @@ do_more:
243 BUFFER_TRACE(bitmap_bh, "clear bit");
244 if (!ext3_clear_bit (bit + i, bitmap_bh->b_data)) {
245 - ext3_error (sb, __FUNCTION__,
246 - "bit already cleared for block %lu",
248 + ext3_error(sb, __FUNCTION__,
249 + "bit already cleared for block %lu", block);
250 BUFFER_TRACE(bitmap_bh, "bit already cleared");
252 dquot_freed_blocks++;
253 @@ -410,12 +407,11 @@ do_more:
256 /* And the superblock */
257 - BUFFER_TRACE(sb->u.ext3_sb.s_sbh, "dirtied superblock");
258 - ret = ext3_journal_dirty_metadata(handle, sb->u.ext3_sb.s_sbh);
259 + BUFFER_TRACE(EXT3_SB(sb)->s_sbh, "dirtied superblock");
260 + ret = ext3_journal_dirty_metadata(handle, EXT3_SB(sb)->s_sbh);
263 if (overflow && !err) {
268 @@ -564,17 +560,18 @@ int ext3_new_block (handle_t *handle, st
272 - es = sb->u.ext3_sb.s_es;
273 + es = EXT3_SB(sb)->s_es;
274 if (le32_to_cpu(es->s_free_blocks_count) <=
275 le32_to_cpu(es->s_r_blocks_count) &&
276 - ((sb->u.ext3_sb.s_resuid != current->fsuid) &&
277 - (sb->u.ext3_sb.s_resgid == 0 ||
278 - !in_group_p (sb->u.ext3_sb.s_resgid)) &&
279 + ((EXT3_SB(sb)->s_resuid != current->fsuid) &&
280 + (EXT3_SB(sb)->s_resgid == 0 ||
281 + !in_group_p (EXT3_SB(sb)->s_resgid)) &&
282 !capable(CAP_SYS_RESOURCE)))
285 ext3_debug ("goal=%lu.\n", goal);
289 * First, test whether the goal block is free.
291 @@ -598,7 +595,7 @@ int ext3_new_block (handle_t *handle, st
295 - bh = sb->u.ext3_sb.s_block_bitmap[bitmap_nr];
296 + bh = EXT3_SB(sb)->s_block_bitmap[bitmap_nr];
298 ext3_debug ("goal is at %d:%d.\n", i, j);
300 @@ -621,9 +618,9 @@ int ext3_new_block (handle_t *handle, st
301 * Now search the rest of the groups. We assume that
302 * i and gdp correctly point to the last group visited.
304 - for (k = 0; k < sb->u.ext3_sb.s_groups_count; k++) {
305 + for (k = 0; k < EXT3_SB(sb)->s_groups_count; k++) {
307 - if (i >= sb->u.ext3_sb.s_groups_count)
308 + if (i >= EXT3_SB(sb)->s_groups_count)
310 gdp = ext3_get_group_desc (sb, i, &bh2);
312 @@ -635,7 +632,7 @@ int ext3_new_block (handle_t *handle, st
316 - bh = sb->u.ext3_sb.s_block_bitmap[bitmap_nr];
317 + bh = EXT3_SB(sb)->s_block_bitmap[bitmap_nr];
318 j = find_next_usable_block(-1, bh,
319 EXT3_BLOCKS_PER_GROUP(sb));
321 @@ -674,8 +671,8 @@ got_block:
322 fatal = ext3_journal_get_write_access(handle, bh2);
325 - BUFFER_TRACE(sb->u.ext3_sb.s_sbh, "get_write_access");
326 - fatal = ext3_journal_get_write_access(handle, sb->u.ext3_sb.s_sbh);
327 + BUFFER_TRACE(EXT3_SB(sb)->s_sbh, "get_write_access");
328 + fatal = ext3_journal_get_write_access(handle, EXT3_SB(sb)->s_sbh);
331 tmp = j + i * EXT3_BLOCKS_PER_GROUP(sb)
332 @@ -684,10 +681,21 @@ got_block:
333 if (tmp == le32_to_cpu(gdp->bg_block_bitmap) ||
334 tmp == le32_to_cpu(gdp->bg_inode_bitmap) ||
335 in_range (tmp, le32_to_cpu(gdp->bg_inode_table),
336 - sb->u.ext3_sb.s_itb_per_group))
337 - ext3_error (sb, "ext3_new_block",
338 - "Allocating block in system zone - "
339 - "block = %u", tmp);
340 + EXT3_SB(sb)->s_itb_per_group)) {
341 + ext3_error(sb, __FUNCTION__,
342 + "Allocating block in system zone - block = %u", tmp);
344 + /* Note: This will potentially use up one of the handle's
345 + * buffer credits. Normally we have way too many credits,
346 + * so that is OK. In _very_ rare cases it might not be OK.
347 + * We will trigger an assertion if we run out of credits,
348 + * and we will have to do a full fsck of the filesystem -
349 + * better than randomly corrupting filesystem metadata.
351 + ext3_set_bit(j, bh->b_data);
356 /* The superblock lock should guard against anybody else beating
357 * us to this point! */
358 @@ -796,7 +804,7 @@ got_block:
359 if (!fatal) fatal = err;
361 BUFFER_TRACE(bh, "journal_dirty_metadata for superblock");
362 - err = ext3_journal_dirty_metadata(handle, sb->u.ext3_sb.s_sbh);
363 + err = ext3_journal_dirty_metadata(handle, EXT3_SB(sb)->s_sbh);
364 if (!fatal) fatal = err;
367 @@ -829,11 +837,11 @@ unsigned long ext3_count_free_blocks (st
371 - es = sb->u.ext3_sb.s_es;
372 + es = EXT3_SB(sb)->s_es;
376 - for (i = 0; i < sb->u.ext3_sb.s_groups_count; i++) {
377 + for (i = 0; i < EXT3_SB(sb)->s_groups_count; i++) {
378 gdp = ext3_get_group_desc (sb, i, NULL);
381 @@ -842,7 +850,7 @@ unsigned long ext3_count_free_blocks (st
385 - x = ext3_count_free (sb->u.ext3_sb.s_block_bitmap[bitmap_nr],
386 + x = ext3_count_free (EXT3_SB(sb)->s_block_bitmap[bitmap_nr],
388 printk ("group %d: stored = %d, counted = %lu\n",
389 i, le16_to_cpu(gdp->bg_free_blocks_count), x);
390 @@ -853,7 +861,7 @@ unsigned long ext3_count_free_blocks (st
394 - return le32_to_cpu(sb->u.ext3_sb.s_es->s_free_blocks_count);
395 + return le32_to_cpu(EXT3_SB(sb)->s_es->s_free_blocks_count);
399 @@ -862,7 +870,7 @@ static inline int block_in_use (unsigned
402 return ext3_test_bit ((block -
403 - le32_to_cpu(sb->u.ext3_sb.s_es->s_first_data_block)) %
404 + le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block)) %
405 EXT3_BLOCKS_PER_GROUP(sb), map);
408 @@ -930,11 +938,11 @@ void ext3_check_blocks_bitmap (struct su
409 struct ext3_group_desc * gdp;
412 - es = sb->u.ext3_sb.s_es;
413 + es = EXT3_SB(sb)->s_es;
417 - for (i = 0; i < sb->u.ext3_sb.s_groups_count; i++) {
418 + for (i = 0; i < EXT3_SB(sb)->s_groups_count; i++) {
419 gdp = ext3_get_group_desc (sb, i, NULL);
422 @@ -968,7 +976,7 @@ void ext3_check_blocks_bitmap (struct su
423 "Inode bitmap for group %d is marked free",
426 - for (j = 0; j < sb->u.ext3_sb.s_itb_per_group; j++)
427 + for (j = 0; j < EXT3_SB(sb)->s_itb_per_group; j++)
428 if (!block_in_use (le32_to_cpu(gdp->bg_inode_table) + j,
430 ext3_error (sb, "ext3_check_blocks_bitmap",
431 --- ./fs/ext3/dir.c.orig Fri Apr 12 10:27:49 2002
432 +++ ./fs/ext3/dir.c Tue May 7 14:54:13 2002
433 @@ -52,7 +52,7 @@ int ext3_check_dir_entry (const char * f
434 else if (((char *) de - bh->b_data) + rlen > dir->i_sb->s_blocksize)
435 error_msg = "directory entry across blocks";
436 else if (le32_to_cpu(de->inode) >
437 - le32_to_cpu(dir->i_sb->u.ext3_sb.s_es->s_inodes_count))
438 + le32_to_cpu(EXT3_SB(dir->i_sb)->s_es->s_inodes_count))
439 error_msg = "inode out of bounds";
441 if (error_msg != NULL)
442 --- ./fs/ext3/ialloc.c.orig Fri Apr 12 10:27:49 2002
443 +++ ./fs/ext3/ialloc.c Tue May 7 15:39:26 2002
444 @@ -73,8 +73,8 @@ static int read_inode_bitmap (struct sup
445 * this group. The IO will be retried next time.
448 - sb->u.ext3_sb.s_inode_bitmap_number[bitmap_nr] = block_group;
449 - sb->u.ext3_sb.s_inode_bitmap[bitmap_nr] = bh;
450 + EXT3_SB(sb)->s_inode_bitmap_number[bitmap_nr] = block_group;
451 + EXT3_SB(sb)->s_inode_bitmap[bitmap_nr] = bh;
455 @@ -225,7 +225,7 @@ void ext3_free_inode (handle_t *handle,
459 - es = sb->u.ext3_sb.s_es;
460 + es = EXT3_SB(sb)->s_es;
461 if (ino < EXT3_FIRST_INO(sb) || ino > le32_to_cpu(es->s_inodes_count)) {
462 ext3_error (sb, "ext3_free_inode",
463 "reserved or nonexistent inode %lu", ino);
464 @@ -237,7 +237,7 @@ void ext3_free_inode (handle_t *handle,
468 - bh = sb->u.ext3_sb.s_inode_bitmap[bitmap_nr];
469 + bh = EXT3_SB(sb)->s_inode_bitmap[bitmap_nr];
471 BUFFER_TRACE(bh, "get_write_access");
472 fatal = ext3_journal_get_write_access(handle, bh);
473 @@ -255,8 +255,8 @@ void ext3_free_inode (handle_t *handle,
474 fatal = ext3_journal_get_write_access(handle, bh2);
475 if (fatal) goto error_return;
477 - BUFFER_TRACE(sb->u.ext3_sb.s_sbh, "get write access");
478 - fatal = ext3_journal_get_write_access(handle, sb->u.ext3_sb.s_sbh);
479 + BUFFER_TRACE(EXT3_SB(sb)->s_sbh, "get write access");
480 + fatal = ext3_journal_get_write_access(handle, EXT3_SB(sb)->s_sbh);
481 if (fatal) goto error_return;
484 @@ -271,9 +271,9 @@ void ext3_free_inode (handle_t *handle,
485 if (!fatal) fatal = err;
486 es->s_free_inodes_count =
487 cpu_to_le32(le32_to_cpu(es->s_free_inodes_count) + 1);
488 - BUFFER_TRACE(sb->u.ext3_sb.s_sbh,
489 + BUFFER_TRACE(EXT3_SB(sb)->s_sbh,
490 "call ext3_journal_dirty_metadata");
491 - err = ext3_journal_dirty_metadata(handle, sb->u.ext3_sb.s_sbh);
492 + err = ext3_journal_dirty_metadata(handle, EXT3_SB(sb)->s_sbh);
493 if (!fatal) fatal = err;
495 BUFFER_TRACE(bh, "call ext3_journal_dirty_metadata");
496 @@ -305,6 +305,8 @@ struct inode * ext3_new_inode (handle_t
498 struct inode * inode;
500 + struct ext3_inode_info *ei;
501 + struct ext3_sb_info *sbi;
502 struct ext3_group_desc * gdp;
503 struct ext3_group_desc * tmp;
504 struct ext3_super_block * es;
505 @@ -318,19 +320,21 @@ struct inode * ext3_new_inode (handle_t
506 inode = new_inode(sb);
508 return ERR_PTR(-ENOMEM);
509 - init_rwsem(&inode->u.ext3_i.truncate_sem);
511 + ei = EXT3_I(inode);
512 + init_rwsem(&ei->truncate_sem);
515 - es = sb->u.ext3_sb.s_es;
522 avefreei = le32_to_cpu(es->s_free_inodes_count) /
523 - sb->u.ext3_sb.s_groups_count;
524 + sbi->s_groups_count;
526 - for (j = 0; j < sb->u.ext3_sb.s_groups_count; j++) {
527 + for (j = 0; j < sbi->s_groups_count; j++) {
528 struct buffer_head *temp_buffer;
529 tmp = ext3_get_group_desc (sb, j, &temp_buffer);
531 @@ -350,7 +354,7 @@ repeat:
533 * Try to place the inode in its parent directory
535 - i = dir->u.ext3_i.i_block_group;
536 + i = EXT3_I(dir)->i_block_group;
537 tmp = ext3_get_group_desc (sb, i, &bh2);
538 if (tmp && le16_to_cpu(tmp->bg_free_inodes_count))
540 @@ -360,10 +364,10 @@ repeat:
541 * Use a quadratic hash to find a group with a
544 - for (j = 1; j < sb->u.ext3_sb.s_groups_count; j <<= 1) {
545 + for (j = 1; j < sbi->s_groups_count; j <<= 1) {
547 - if (i >= sb->u.ext3_sb.s_groups_count)
548 - i -= sb->u.ext3_sb.s_groups_count;
549 + if (i >= sbi->s_groups_count)
550 + i -= sbi->s_groups_count;
551 tmp = ext3_get_group_desc (sb, i, &bh2);
553 le16_to_cpu(tmp->bg_free_inodes_count)) {
554 @@ -376,9 +380,9 @@ repeat:
556 * That failed: try linear search for a free inode
558 - i = dir->u.ext3_i.i_block_group + 1;
559 - for (j = 2; j < sb->u.ext3_sb.s_groups_count; j++) {
560 - if (++i >= sb->u.ext3_sb.s_groups_count)
561 + i = EXT3_I(dir)->i_block_group + 1;
562 + for (j = 2; j < sbi->s_groups_count; j++) {
563 + if (++i >= sbi->s_groups_count)
565 tmp = ext3_get_group_desc (sb, i, &bh2);
567 @@ -399,11 +403,11 @@ repeat:
571 - bh = sb->u.ext3_sb.s_inode_bitmap[bitmap_nr];
572 + bh = sbi->s_inode_bitmap[bitmap_nr];
574 if ((j = ext3_find_first_zero_bit ((unsigned long *) bh->b_data,
575 - EXT3_INODES_PER_GROUP(sb))) <
576 - EXT3_INODES_PER_GROUP(sb)) {
577 + sbi->s_inodes_per_group)) <
578 + sbi->s_inodes_per_group) {
579 BUFFER_TRACE(bh, "get_write_access");
580 err = ext3_journal_get_write_access(handle, bh);
582 @@ -436,8 +440,8 @@ repeat:
586 - j += i * EXT3_INODES_PER_GROUP(sb) + 1;
587 - if (j < EXT3_FIRST_INO(sb) || j > le32_to_cpu(es->s_inodes_count)) {
588 + j += i * sbi->s_inodes_per_group + 1;
589 + if (j < sbi->s_first_ino || j > le32_to_cpu(es->s_inodes_count)) {
590 ext3_error (sb, "ext3_new_inode",
591 "reserved inode or inode > inodes count - "
592 "block_group = %d,inode=%d", i, j);
593 @@ -457,13 +461,13 @@ repeat:
594 err = ext3_journal_dirty_metadata(handle, bh2);
597 - BUFFER_TRACE(sb->u.ext3_sb.s_sbh, "get_write_access");
598 - err = ext3_journal_get_write_access(handle, sb->u.ext3_sb.s_sbh);
599 + BUFFER_TRACE(sbi->s_sbh, "get_write_access");
600 + err = ext3_journal_get_write_access(handle, sbi->s_sbh);
602 es->s_free_inodes_count =
603 cpu_to_le32(le32_to_cpu(es->s_free_inodes_count) - 1);
604 - BUFFER_TRACE(sb->u.ext3_sb.s_sbh, "call ext3_journal_dirty_metadata");
605 - err = ext3_journal_dirty_metadata(handle, sb->u.ext3_sb.s_sbh);
606 + BUFFER_TRACE(sbi->s_sbh, "call ext3_journal_dirty_metadata");
607 + err = ext3_journal_dirty_metadata(handle, sbi->s_sbh);
611 @@ -483,31 +487,31 @@ repeat:
612 inode->i_blksize = PAGE_SIZE;
614 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
615 - inode->u.ext3_i.i_flags = dir->u.ext3_i.i_flags & ~EXT3_INDEX_FL;
616 + ei->i_flags = EXT3_I(dir)->i_flags & ~EXT3_INDEX_FL;
618 - inode->u.ext3_i.i_flags &= ~(EXT3_IMMUTABLE_FL|EXT3_APPEND_FL);
619 + ei->i_flags &= ~(EXT3_IMMUTABLE_FL|EXT3_APPEND_FL);
620 #ifdef EXT3_FRAGMENTS
621 - inode->u.ext3_i.i_faddr = 0;
622 - inode->u.ext3_i.i_frag_no = 0;
623 - inode->u.ext3_i.i_frag_size = 0;
626 + ei->i_frag_size = 0;
628 - inode->u.ext3_i.i_file_acl = 0;
629 - inode->u.ext3_i.i_dir_acl = 0;
630 - inode->u.ext3_i.i_dtime = 0;
631 - INIT_LIST_HEAD(&inode->u.ext3_i.i_orphan);
632 + ei->i_file_acl = 0;
635 + INIT_LIST_HEAD(&ei->i_orphan);
636 #ifdef EXT3_PREALLOCATE
637 - inode->u.ext3_i.i_prealloc_count = 0;
638 + ei->i_prealloc_count = 0;
640 - inode->u.ext3_i.i_block_group = i;
641 + ei->i_block_group = i;
643 - if (inode->u.ext3_i.i_flags & EXT3_SYNC_FL)
644 + if (ei->i_flags & EXT3_SYNC_FL)
645 inode->i_flags |= S_SYNC;
648 insert_inode_hash(inode);
649 - inode->i_generation = sb->u.ext3_sb.s_next_generation++;
650 + inode->i_generation = sbi->s_next_generation++;
652 - inode->u.ext3_i.i_state = EXT3_STATE_NEW;
653 + ei->i_state = EXT3_STATE_NEW;
654 err = ext3_mark_inode_dirty(handle, inode);
657 @@ -585,19 +589,19 @@ struct inode *ext3_orphan_get (struct su
659 unsigned long ext3_count_free_inodes (struct super_block * sb)
661 + struct ext3_sb_info *sbi = EXT3_SB(sb);
662 + struct ext3_super_block *es = sbi->s_es;
664 - struct ext3_super_block * es;
665 unsigned long desc_count, bitmap_count, x;
667 struct ext3_group_desc * gdp;
671 - es = sb->u.ext3_sb.s_es;
675 - for (i = 0; i < sb->u.ext3_sb.s_groups_count; i++) {
676 + for (i = 0; i < sbi->s_groups_count; i++) {
677 gdp = ext3_get_group_desc (sb, i, NULL);
680 @@ -606,8 +610,8 @@ unsigned long ext3_count_free_inodes (st
684 - x = ext3_count_free (sb->u.ext3_sb.s_inode_bitmap[bitmap_nr],
685 - EXT3_INODES_PER_GROUP(sb) / 8);
686 + x = ext3_count_free(sbi->s_inode_bitmap[bitmap_nr],
687 + sbi->s_inodes_per_group / 8);
688 printk ("group %d: stored = %d, counted = %lu\n",
689 i, le16_to_cpu(gdp->bg_free_inodes_count), x);
691 @@ -617,7 +621,7 @@ unsigned long ext3_count_free_inodes (st
695 - return le32_to_cpu(sb->u.ext3_sb.s_es->s_free_inodes_count);
696 + return le32_to_cpu(es->s_free_inodes_count);
700 @@ -626,16 +630,18 @@ unsigned long ext3_count_free_inodes (st
701 void ext3_check_inodes_bitmap (struct super_block * sb)
703 struct ext3_super_block * es;
704 + struct ext3_sb_info *sbi;
705 unsigned long desc_count, bitmap_count, x;
707 struct ext3_group_desc * gdp;
710 - es = sb->u.ext3_sb.s_es;
716 - for (i = 0; i < sb->u.ext3_sb.s_groups_count; i++) {
717 + for (i = 0; i < sbi->s_groups_count; i++) {
718 gdp = ext3_get_group_desc (sb, i, NULL);
721 @@ -644,7 +650,7 @@ void ext3_check_inodes_bitmap (struct su
725 - x = ext3_count_free (sb->u.ext3_sb.s_inode_bitmap[bitmap_nr],
726 + x = ext3_count_free (sbi->s_inode_bitmap[bitmap_nr],
727 EXT3_INODES_PER_GROUP(sb) / 8);
728 if (le16_to_cpu(gdp->bg_free_inodes_count) != x)
729 ext3_error (sb, "ext3_check_inodes_bitmap",
730 --- ./fs/ext3/inode.c.orig Fri Apr 12 10:27:49 2002
731 +++ ./fs/ext3/inode.c Tue May 7 15:41:23 2002
732 @@ -196,7 +196,7 @@ void ext3_delete_inode (struct inode * i
733 * (Well, we could do this if we need to, but heck - it works)
735 ext3_orphan_del(handle, inode);
736 - inode->u.ext3_i.i_dtime = CURRENT_TIME;
737 + EXT3_I(inode)->i_dtime = CURRENT_TIME;
740 * One subtle ordering requirement: if anything has gone wrong
741 @@ -220,13 +220,14 @@ no_delete:
742 void ext3_discard_prealloc (struct inode * inode)
744 #ifdef EXT3_PREALLOCATE
745 + struct ext3_inode_info *ei = EXT3_I(inode);
747 /* Writer: ->i_prealloc* */
748 - if (inode->u.ext3_i.i_prealloc_count) {
749 - unsigned short total = inode->u.ext3_i.i_prealloc_count;
750 - unsigned long block = inode->u.ext3_i.i_prealloc_block;
751 - inode->u.ext3_i.i_prealloc_count = 0;
752 - inode->u.ext3_i.i_prealloc_block = 0;
753 + if (ei->i_prealloc_count) {
754 + unsigned short total = ei->i_prealloc_count;
755 + unsigned long block = ei->i_prealloc_block;
756 + ei->i_prealloc_count = 0;
757 + ei->i_prealloc_block = 0;
759 ext3_free_blocks (inode, block, total);
761 @@ -243,13 +244,15 @@ static int ext3_alloc_block (handle_t *h
762 unsigned long result;
764 #ifdef EXT3_PREALLOCATE
765 + struct ext3_inode_info *ei = EXT3_I(inode);
767 /* Writer: ->i_prealloc* */
768 - if (inode->u.ext3_i.i_prealloc_count &&
769 - (goal == inode->u.ext3_i.i_prealloc_block ||
770 - goal + 1 == inode->u.ext3_i.i_prealloc_block))
771 + if (ei->i_prealloc_count &&
772 + (goal == ei->i_prealloc_block ||
773 + goal + 1 == ei->i_prealloc_block))
775 - result = inode->u.ext3_i.i_prealloc_block++;
776 - inode->u.ext3_i.i_prealloc_count--;
777 + result = ei->i_prealloc_block++;
778 + ei->i_prealloc_count--;
780 ext3_debug ("preallocation hit (%lu/%lu).\n",
781 ++alloc_hits, ++alloc_attempts);
782 @@ -259,8 +262,8 @@ static int ext3_alloc_block (handle_t *h
783 alloc_hits, ++alloc_attempts);
784 if (S_ISREG(inode->i_mode))
785 result = ext3_new_block (inode, goal,
786 - &inode->u.ext3_i.i_prealloc_count,
787 - &inode->u.ext3_i.i_prealloc_block, err);
788 + &ei->i_prealloc_count,
789 + &ei->i_prealloc_block, err);
791 result = ext3_new_block (inode, goal, 0, 0, err);
793 @@ -394,7 +397,7 @@ static Indirect *ext3_get_branch(struct
796 /* i_data is not going away, no lock needed */
797 - add_chain (chain, NULL, inode->u.ext3_i.i_data + *offsets);
798 + add_chain (chain, NULL, EXT3_I(inode)->i_data + *offsets);
802 @@ -437,7 +440,8 @@ no_block:
804 static inline unsigned long ext3_find_near(struct inode *inode, Indirect *ind)
806 - u32 *start = ind->bh ? (u32*) ind->bh->b_data : inode->u.ext3_i.i_data;
807 + struct ext3_inode_info *ei = EXT3_I(inode);
808 + u32 *start = ind->bh ? (u32*) ind->bh->b_data : ei->i_data;
811 /* Try to find previous block */
812 @@ -453,9 +456,8 @@ static inline unsigned long ext3_find_ne
813 * It is going to be refered from inode itself? OK, just put it into
814 * the same cylinder group then.
816 - return (inode->u.ext3_i.i_block_group *
817 - EXT3_BLOCKS_PER_GROUP(inode->i_sb)) +
818 - le32_to_cpu(inode->i_sb->u.ext3_sb.s_es->s_first_data_block);
819 + return (ei->i_block_group * EXT3_BLOCKS_PER_GROUP(inode->i_sb)) +
820 + le32_to_cpu(EXT3_SB(inode->i_sb)->s_es->s_first_data_block);
824 @@ -474,14 +477,15 @@
825 static int ext3_find_goal(struct inode *inode, long block, Indirect chain[4],
826 Indirect *partial, unsigned long *goal)
828 + struct ext3_inode_info *ei = EXT3_I(inode);
829 /* Writer: ->i_next_alloc* */
830 - if (block == inode->u.ext3_i.i_next_alloc_block + 1) {
831 - inode->u.ext3_i.i_next_alloc_block++;
832 - inode->u.ext3_i.i_next_alloc_goal++;
833 + if (block == ei->i_next_alloc_block + 1) {
834 + ei->i_next_alloc_block++;
835 + ei->i_next_alloc_goal++;
837 #ifdef SEARCH_FROM_ZERO
838 - inode->u.ext3_i.i_next_alloc_block = 0;
839 - inode->u.ext3_i.i_next_alloc_goal = 0;
840 + ei->i_next_alloc_block = 0;
841 + ei->i_next_alloc_goal = 0;
844 /* Reader: pointers, ->i_next_alloc* */
845 @@ -490,8 +493,8 @@ static int ext3_find_goal(struct inode *
846 * try the heuristic for sequential allocation,
847 * failing that at least try to get decent locality.
849 - if (block == inode->u.ext3_i.i_next_alloc_block)
850 - *goal = inode->u.ext3_i.i_next_alloc_goal;
851 + if (block == ei->i_next_alloc_block)
852 + *goal = ei->i_next_alloc_goal;
854 *goal = ext3_find_near(inode, partial);
855 #ifdef SEARCH_FROM_ZERO
860 + struct ext3_inode_info *ei = EXT3_I(inode);
863 * If we're splicing into a [td]indirect block (as opposed to the
864 @@ -641,11 +644,11 @@ static int ext3_splice_branch(handle_t *
867 *where->p = where->key;
868 - inode->u.ext3_i.i_next_alloc_block = block;
869 - inode->u.ext3_i.i_next_alloc_goal = le32_to_cpu(where[num-1].key);
870 + ei->i_next_alloc_block = block;
871 + ei->i_next_alloc_goal = le32_to_cpu(where[num-1].key);
872 #ifdef SEARCH_FROM_ZERO
873 - inode->u.ext3_i.i_next_alloc_block = 0;
874 - inode->u.ext3_i.i_next_alloc_goal = 0;
875 + ei->i_next_alloc_block = 0;
876 + ei->i_next_alloc_goal = 0;
883 int depth = ext3_block_to_path(inode, iblock, offsets);
884 + struct ext3_inode_info *ei = EXT3_I(inode);
887 J_ASSERT(handle != NULL || create == 0);
888 @@ -782,7 +785,7 @@ out:
890 * Block out ext3_truncate while we alter the tree
892 - down_read(&inode->u.ext3_i.truncate_sem);
893 + down_read(&ei->truncate_sem);
894 err = ext3_alloc_branch(handle, inode, left, goal,
895 offsets+(partial-chain), partial);
897 @@ -794,7 +797,7 @@ out:
899 err = ext3_splice_branch(handle, inode, iblock, chain,
901 - up_read(&inode->u.ext3_i.truncate_sem);
902 + up_read(&ei->truncate_sem);
906 @@ -807,8 +810,8 @@ out:
907 * truncate is in progress. It is racy between multiple parallel
908 * instances of get_block, but we have the BKL.
910 - if (new_size > inode->u.ext3_i.i_disksize)
911 - inode->u.ext3_i.i_disksize = new_size;
912 + if (new_size > ei->i_disksize)
913 + ei->i_disksize = new_size;
915 bh_result->b_state |= (1UL << BH_New);
917 @@ -921,7 +924,7 @@ struct buffer_head *ext3_bread(handle_t
918 struct buffer_head *tmp_bh;
921 - inode->u.ext3_i.i_prealloc_count &&
922 + EXT3_I(inode)->i_prealloc_count &&
923 i < EXT3_SB(inode->i_sb)->s_es->s_prealloc_dir_blocks;
926 @@ -1015,8 +1018,8 @@ static int ext3_prepare_write(struct fil
927 unsigned from, unsigned to)
929 struct inode *inode = page->mapping->host;
930 - handle_t *handle = ext3_journal_current_handle();
931 int ret, needed_blocks = ext3_writepage_trans_blocks(inode);
935 handle = ext3_journal_start(inode, needed_blocks);
936 @@ -1131,8 +1134,8 @@ static int ext3_commit_write(struct file
940 - if (inode->i_size > inode->u.ext3_i.i_disksize) {
941 - inode->u.ext3_i.i_disksize = inode->i_size;
942 + if (inode->i_size > EXT3_I(inode)->i_disksize) {
943 + EXT3_I(inode)->i_disksize = inode->i_size;
944 ret2 = ext3_mark_inode_dirty(handle, inode);
947 @@ -1832,7 +1835,8 @@ static void ext3_free_branches(handle_t
948 void ext3_truncate(struct inode * inode)
951 - u32 *i_data = inode->u.ext3_i.i_data;
952 + struct ext3_inode_info *ei = EXT3_I(inode);
953 + u32 *i_data = EXT3_I(inode)->i_data;
954 int addr_per_block = EXT3_ADDR_PER_BLOCK(inode->i_sb);
957 @@ -1884,13 +1887,13 @@ void ext3_truncate(struct inode * inode)
958 * on-disk inode. We do this via i_disksize, which is the value which
959 * ext3 *really* writes onto the disk inode.
961 - inode->u.ext3_i.i_disksize = inode->i_size;
962 + ei->i_disksize = inode->i_size;
965 * From here we block out all ext3_get_block() callers who want to
966 * modify the block allocation tree.
968 - down_write(&inode->u.ext3_i.truncate_sem);
969 + down_write(&ei->truncate_sem);
971 if (n == 1) { /* direct blocks */
972 ext3_free_data(handle, inode, NULL, i_data+offsets[0],
973 @@ -1954,7 +1957,7 @@ do_indirects:
974 case EXT3_TIND_BLOCK:
977 - up_write(&inode->u.ext3_i.truncate_sem);
978 + up_write(&ei->truncate_sem);
979 inode->i_mtime = inode->i_ctime = CURRENT_TIME;
980 ext3_mark_inode_dirty(handle, inode);
982 @@ -1983,6 +1986,8 @@ out_stop:
984 int ext3_get_inode_loc (struct inode *inode, struct ext3_iloc *iloc)
986 + struct super_block *sb = inode->i_sb;
987 + struct ext3_sb_info *sbi = EXT3_SB(sb);
988 struct buffer_head *bh = 0;
990 unsigned long block_group;
991 @@ -1995,25 +2000,21 @@ int ext3_get_inode_loc (struct inode *in
992 inode->i_ino != EXT3_ACL_IDX_INO &&
993 inode->i_ino != EXT3_ACL_DATA_INO &&
994 inode->i_ino != EXT3_JOURNAL_INO &&
995 - inode->i_ino < EXT3_FIRST_INO(inode->i_sb)) ||
996 - inode->i_ino > le32_to_cpu(
997 - inode->i_sb->u.ext3_sb.s_es->s_inodes_count)) {
998 - ext3_error (inode->i_sb, "ext3_get_inode_loc",
999 - "bad inode number: %lu", inode->i_ino);
1000 + inode->i_ino < EXT3_FIRST_INO(sb)) ||
1001 + inode->i_ino > le32_to_cpu(sbi->s_es->s_inodes_count)) {
1002 + ext3_error (sb, __FUNCTION__, "bad inode #%lu", inode->i_ino);
1005 - block_group = (inode->i_ino - 1) / EXT3_INODES_PER_GROUP(inode->i_sb);
1006 - if (block_group >= inode->i_sb->u.ext3_sb.s_groups_count) {
1007 - ext3_error (inode->i_sb, "ext3_get_inode_loc",
1008 - "group >= groups count");
1009 + block_group = (inode->i_ino - 1) / sbi->s_inodes_per_group;
1010 + if (block_group >= sbi->s_groups_count) {
1011 + ext3_error(sb, __FUNCTION__, "group >= groups count");
1014 - group_desc = block_group >> EXT3_DESC_PER_BLOCK_BITS(inode->i_sb);
1015 - desc = block_group & (EXT3_DESC_PER_BLOCK(inode->i_sb) - 1);
1016 - bh = inode->i_sb->u.ext3_sb.s_group_desc[group_desc];
1017 + group_desc = block_group >> sbi->s_desc_per_block_bits;
1018 + desc = block_group & (sbi->s_desc_per_block - 1);
1019 + bh = sbi->s_group_desc[group_desc];
1021 - ext3_error (inode->i_sb, "ext3_get_inode_loc",
1022 - "Descriptor not loaded");
1023 + ext3_error(sb, __FUNCTION__, "Descriptor not loaded");
1027 @@ -2021,17 +2022,17 @@ int ext3_get_inode_loc (struct inode *in
1029 * Figure out the offset within the block group inode table
1031 - offset = ((inode->i_ino - 1) % EXT3_INODES_PER_GROUP(inode->i_sb)) *
1032 - EXT3_INODE_SIZE(inode->i_sb);
1033 + offset = ((inode->i_ino - 1) % sbi->s_inodes_per_group) *
1034 + sbi->s_inode_size;
1035 block = le32_to_cpu(gdp[desc].bg_inode_table) +
1036 - (offset >> EXT3_BLOCK_SIZE_BITS(inode->i_sb));
1037 - if (!(bh = sb_bread(inode->i_sb, block))) {
1038 - ext3_error (inode->i_sb, "ext3_get_inode_loc",
1039 + (offset >> EXT3_BLOCK_SIZE_BITS(sb));
1040 + if (!(bh = sb_bread(sb, block))) {
1041 + ext3_error (sb, __FUNCTION__,
1042 "unable to read inode block - "
1043 "inode=%lu, block=%lu", inode->i_ino, block);
1046 - offset &= (EXT3_BLOCK_SIZE(inode->i_sb) - 1);
1047 + offset &= (EXT3_BLOCK_SIZE(sb) - 1);
1050 iloc->raw_inode = (struct ext3_inode *) (bh->b_data + offset);
1051 @@ -2047,6 +2048,7 @@ void ext3_read_inode(struct inode * inod
1053 struct ext3_iloc iloc;
1054 struct ext3_inode *raw_inode;
1055 + struct ext3_inode_info *ei = EXT3_I(inode);
1056 struct buffer_head *bh;
1059 @@ -2054,7 +2056,7 @@ void ext3_read_inode(struct inode * inod
1062 raw_inode = iloc.raw_inode;
1063 - init_rwsem(&inode->u.ext3_i.truncate_sem);
1064 + init_rwsem(&ei->truncate_sem);
1065 inode->i_mode = le16_to_cpu(raw_inode->i_mode);
1066 inode->i_uid = (uid_t)le16_to_cpu(raw_inode->i_uid_low);
1067 inode->i_gid = (gid_t)le16_to_cpu(raw_inode->i_gid_low);
1068 @@ -2067,7 +2069,7 @@ void ext3_read_inode(struct inode * inod
1069 inode->i_atime = le32_to_cpu(raw_inode->i_atime);
1070 inode->i_ctime = le32_to_cpu(raw_inode->i_ctime);
1071 inode->i_mtime = le32_to_cpu(raw_inode->i_mtime);
1072 - inode->u.ext3_i.i_dtime = le32_to_cpu(raw_inode->i_dtime);
1073 + ei->i_dtime = le32_to_cpu(raw_inode->i_dtime);
1074 /* We now have enough fields to check if the inode was active or not.
1075 * This is needed because nfsd might try to access dead inodes
1076 * the test is that same one that e2fsck uses
1077 @@ -2075,7 +2077,7 @@ void ext3_read_inode(struct inode * inod
1079 if (inode->i_nlink == 0) {
1080 if (inode->i_mode == 0 ||
1081 - !(inode->i_sb->u.ext3_sb.s_mount_state & EXT3_ORPHAN_FS)) {
1082 + !(EXT3_SB(inode->i_sb)->s_mount_state & EXT3_ORPHAN_FS)) {
1083 /* this inode is deleted */
1086 @@ -2090,33 +2092,33 @@ void ext3_read_inode(struct inode * inod
1088 inode->i_blocks = le32_to_cpu(raw_inode->i_blocks);
1089 inode->i_version = ++event;
1090 - inode->u.ext3_i.i_flags = le32_to_cpu(raw_inode->i_flags);
1091 + ei->i_flags = le32_to_cpu(raw_inode->i_flags);
1092 #ifdef EXT3_FRAGMENTS
1093 - inode->u.ext3_i.i_faddr = le32_to_cpu(raw_inode->i_faddr);
1094 - inode->u.ext3_i.i_frag_no = raw_inode->i_frag;
1095 - inode->u.ext3_i.i_frag_size = raw_inode->i_fsize;
1096 + ei->i_faddr = le32_to_cpu(raw_inode->i_faddr);
1097 + ei->i_frag_no = raw_inode->i_frag;
1098 + ei->i_frag_size = raw_inode->i_fsize;
1100 - inode->u.ext3_i.i_file_acl = le32_to_cpu(raw_inode->i_file_acl);
1101 + ei->i_file_acl = le32_to_cpu(raw_inode->i_file_acl);
1102 if (!S_ISREG(inode->i_mode)) {
1103 - inode->u.ext3_i.i_dir_acl = le32_to_cpu(raw_inode->i_dir_acl);
1104 + ei->i_dir_acl = le32_to_cpu(raw_inode->i_dir_acl);
1107 ((__u64)le32_to_cpu(raw_inode->i_size_high)) << 32;
1109 - inode->u.ext3_i.i_disksize = inode->i_size;
1110 + ei->i_disksize = inode->i_size;
1111 inode->i_generation = le32_to_cpu(raw_inode->i_generation);
1112 #ifdef EXT3_PREALLOCATE
1113 - inode->u.ext3_i.i_prealloc_count = 0;
1114 + ei->i_prealloc_count = 0;
1116 - inode->u.ext3_i.i_block_group = iloc.block_group;
1117 + ei->i_block_group = iloc.block_group;
1120 * NOTE! The in-memory inode i_data array is in little-endian order
1121 * even on big-endian machines: we do NOT byteswap the block numbers!
1123 for (block = 0; block < EXT3_N_BLOCKS; block++)
1124 - inode->u.ext3_i.i_data[block] = iloc.raw_inode->i_block[block];
1125 - INIT_LIST_HEAD(&inode->u.ext3_i.i_orphan);
1126 + ei->i_data[block] = iloc.raw_inode->i_block[block];
1127 + INIT_LIST_HEAD(&ei->i_orphan);
1131 @@ -2143,17 +2145,17 @@ void ext3_read_inode(struct inode * inod
1132 /* inode->i_attr_flags = 0; unused */
1133 - if (inode->u.ext3_i.i_flags & EXT3_SYNC_FL) {
1134 + if (ei->i_flags & EXT3_SYNC_FL) {
1135 /* inode->i_attr_flags |= ATTR_FLAG_SYNCRONOUS; unused */
1136 inode->i_flags |= S_SYNC;
1138 - if (inode->u.ext3_i.i_flags & EXT3_APPEND_FL) {
1139 + if (ei->i_flags & EXT3_APPEND_FL) {
1140 /* inode->i_attr_flags |= ATTR_FLAG_APPEND; unused */
1141 inode->i_flags |= S_APPEND;
1143 - if (inode->u.ext3_i.i_flags & EXT3_IMMUTABLE_FL) {
1144 + if (ei->i_flags & EXT3_IMMUTABLE_FL) {
1145 /* inode->i_attr_flags |= ATTR_FLAG_IMMUTABLE; unused */
1146 inode->i_flags |= S_IMMUTABLE;
1148 - if (inode->u.ext3_i.i_flags & EXT3_NOATIME_FL) {
1149 + if (ei->i_flags & EXT3_NOATIME_FL) {
1150 /* inode->i_attr_flags |= ATTR_FLAG_NOATIME; unused */
1151 inode->i_flags |= S_NOATIME;
1153 @@ -2175,6 +2177,7 @@ static int ext3_do_update_inode(handle_t
1154 struct ext3_iloc *iloc)
1156 struct ext3_inode *raw_inode = iloc->raw_inode;
1157 + struct ext3_inode_info *ei = EXT3_I(inode);
1158 struct buffer_head *bh = iloc->bh;
1159 int err = 0, rc, block;
1161 @@ -2192,7 +2195,7 @@ static int ext3_do_update_inode(handle_t
1162 * Fix up interoperability with old kernels. Otherwise, old inodes get
1163 * re-used with the upper 16 bits of the uid/gid intact
1165 - if(!inode->u.ext3_i.i_dtime) {
1166 + if(!ei->i_dtime) {
1167 raw_inode->i_uid_high =
1168 cpu_to_le16(high_16_bits(inode->i_uid));
1169 raw_inode->i_gid_high =
1170 @@ -2210,34 +2213,33 @@ static int ext3_do_update_inode(handle_t
1171 raw_inode->i_gid_high = 0;
1173 raw_inode->i_links_count = cpu_to_le16(inode->i_nlink);
1174 - raw_inode->i_size = cpu_to_le32(inode->u.ext3_i.i_disksize);
1175 + raw_inode->i_size = cpu_to_le32(ei->i_disksize);
1176 raw_inode->i_atime = cpu_to_le32(inode->i_atime);
1177 raw_inode->i_ctime = cpu_to_le32(inode->i_ctime);
1178 raw_inode->i_mtime = cpu_to_le32(inode->i_mtime);
1179 raw_inode->i_blocks = cpu_to_le32(inode->i_blocks);
1180 - raw_inode->i_dtime = cpu_to_le32(inode->u.ext3_i.i_dtime);
1181 - raw_inode->i_flags = cpu_to_le32(inode->u.ext3_i.i_flags);
1182 + raw_inode->i_dtime = cpu_to_le32(ei->i_dtime);
1183 + raw_inode->i_flags = cpu_to_le32(ei->i_flags);
1184 #ifdef EXT3_FRAGMENTS
1185 - raw_inode->i_faddr = cpu_to_le32(inode->u.ext3_i.i_faddr);
1186 - raw_inode->i_frag = inode->u.ext3_i.i_frag_no;
1187 - raw_inode->i_fsize = inode->u.ext3_i.i_frag_size;
1188 + raw_inode->i_faddr = cpu_to_le32(ei->i_faddr);
1189 + raw_inode->i_frag = ei->i_frag_no;
1190 + raw_inode->i_fsize = ei->i_frag_size;
1192 /* If we are not tracking these fields in the in-memory inode,
1193 * then preserve them on disk, but still initialise them to zero
1194 * for new inodes. */
1195 - if (EXT3_I(inode)->i_state & EXT3_STATE_NEW) {
1196 + if (ei->i_state & EXT3_STATE_NEW) {
1197 raw_inode->i_faddr = 0;
1198 raw_inode->i_frag = 0;
1199 raw_inode->i_fsize = 0;
1202 - raw_inode->i_file_acl = cpu_to_le32(inode->u.ext3_i.i_file_acl);
1203 + raw_inode->i_file_acl = cpu_to_le32(ei->i_file_acl);
1204 if (!S_ISREG(inode->i_mode)) {
1205 - raw_inode->i_dir_acl = cpu_to_le32(inode->u.ext3_i.i_dir_acl);
1206 + raw_inode->i_dir_acl = cpu_to_le32(ei->i_dir_acl);
1208 - raw_inode->i_size_high =
1209 - cpu_to_le32(inode->u.ext3_i.i_disksize >> 32);
1210 - if (inode->u.ext3_i.i_disksize > 0x7fffffffULL) {
1211 + raw_inode->i_size_high = cpu_to_le32(ei->i_disksize >> 32);
1212 + if (ei->i_disksize > MAX_NON_LFS) {
1213 struct super_block *sb = inode->i_sb;
1214 if (!EXT3_HAS_RO_COMPAT_FEATURE(sb,
1215 EXT3_FEATURE_RO_COMPAT_LARGE_FILE) ||
1216 @@ -2247,7 +2249,7 @@ static int ext3_do_update_inode(handle_t
1217 * created, add a flag to the superblock.
1219 err = ext3_journal_get_write_access(handle,
1220 - sb->u.ext3_sb.s_sbh);
1221 + EXT3_SB(sb)->s_sbh);
1224 ext3_update_dynamic_rev(sb);
1225 @@ -2256,7 +2258,7 @@ static int ext3_do_update_inode(handle_t
1228 err = ext3_journal_dirty_metadata(handle,
1229 - sb->u.ext3_sb.s_sbh);
1230 + EXT3_SB(sb)->s_sbh);
1234 @@ -2265,13 +2267,13 @@ static int ext3_do_update_inode(handle_t
1235 raw_inode->i_block[0] =
1236 cpu_to_le32(kdev_t_to_nr(inode->i_rdev));
1237 else for (block = 0; block < EXT3_N_BLOCKS; block++)
1238 - raw_inode->i_block[block] = inode->u.ext3_i.i_data[block];
1239 + raw_inode->i_block[block] = ei->i_data[block];
1241 BUFFER_TRACE(bh, "call ext3_journal_dirty_metadata");
1242 rc = ext3_journal_dirty_metadata(handle, bh);
1245 - EXT3_I(inode)->i_state &= ~EXT3_STATE_NEW;
1246 + ei->i_state &= ~EXT3_STATE_NEW;
1250 @@ -2379,7 +2381,7 @@ int ext3_setattr(struct dentry *dentry,
1253 error = ext3_orphan_add(handle, inode);
1254 - inode->u.ext3_i.i_disksize = attr->ia_size;
1255 + EXT3_I(inode)->i_disksize = attr->ia_size;
1256 rc = ext3_mark_inode_dirty(handle, inode);
1259 @@ -2622,9 +2624,9 @@ int ext3_change_inode_journal_flag(struc
1263 - inode->u.ext3_i.i_flags |= EXT3_JOURNAL_DATA_FL;
1264 + EXT3_I(inode)->i_flags |= EXT3_JOURNAL_DATA_FL;
1266 - inode->u.ext3_i.i_flags &= ~EXT3_JOURNAL_DATA_FL;
1267 + EXT3_I(inode)->i_flags &= ~EXT3_JOURNAL_DATA_FL;
1269 journal_unlock_updates(journal);
1271 --- ./fs/ext3/ioctl.c.orig Fri Apr 12 10:27:49 2002
1272 +++ ./fs/ext3/ioctl.c Tue May 7 15:20:52 2002
1274 int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd,
1277 + struct ext3_inode_info *ei = EXT3_I(inode);
1280 ext3_debug ("cmd = %u, arg = %lu\n", cmd, arg);
1283 case EXT3_IOC_GETFLAGS:
1284 - flags = inode->u.ext3_i.i_flags & EXT3_FL_USER_VISIBLE;
1285 + flags = ei->i_flags & EXT3_FL_USER_VISIBLE;
1286 return put_user(flags, (int *) arg);
1287 case EXT3_IOC_SETFLAGS: {
1288 handle_t *handle = NULL;
1289 @@ -42,7 +42,7 @@ int ext3_ioctl (struct inode * inode, st
1290 if (get_user(flags, (int *) arg))
1293 - oldflags = inode->u.ext3_i.i_flags;
1294 + oldflags = ei->i_flags;
1296 /* The JOURNAL_DATA flag is modifiable only by root */
1297 jflag = flags & EXT3_JOURNAL_DATA_FL;
1298 @@ -79,7 +79,7 @@ int ext3_ioctl (struct inode * inode, st
1300 flags = flags & EXT3_FL_USER_MODIFIABLE;
1301 flags |= oldflags & ~EXT3_FL_USER_MODIFIABLE;
1302 - inode->u.ext3_i.i_flags = flags;
1303 + ei->i_flags = flags;
1305 if (flags & EXT3_SYNC_FL)
1306 inode->i_flags |= S_SYNC;
1307 @@ -155,12 +155,12 @@ flags_err:
1310 set_current_state(TASK_INTERRUPTIBLE);
1311 - add_wait_queue(&sb->u.ext3_sb.ro_wait_queue, &wait);
1312 - if (timer_pending(&sb->u.ext3_sb.turn_ro_timer)) {
1313 + add_wait_queue(&EXT3_SB(sb)->ro_wait_queue, &wait);
1314 + if (timer_pending(&EXT3_SB(sb)->turn_ro_timer)) {
1318 - remove_wait_queue(&sb->u.ext3_sb.ro_wait_queue, &wait);
1319 + remove_wait_queue(&EXT3_SB(sb)->ro_wait_queue, &wait);
1323 --- ./fs/ext3/namei.c.orig Fri Apr 12 10:27:49 2002
1324 +++ ./fs/ext3/namei.c Tue May 7 16:05:51 2002
1325 @@ -636,7 +636,7 @@ static struct buffer_head * ext3_find_en
1328 nblocks = dir->i_size >> EXT3_BLOCK_SIZE_BITS(sb);
1329 - start = dir->u.ext3_i.i_dir_start_lookup;
1330 + start = EXT3_I(dir)->i_dir_start_lookup;
1331 if (start >= nblocks)
1334 @@ -677,7 +677,7 @@ restart:
1335 i = search_dirblock(bh, dir, dentry,
1336 block << EXT3_BLOCK_SIZE_BITS(sb), res_dir);
1338 - dir->u.ext3_i.i_dir_start_lookup = block;
1339 + EXT3_I(dir)->i_dir_start_lookup = block;
1341 goto cleanup_and_exit;
1343 @@ -1320,7 +1320,7 @@ static int ext3_mkdir(struct inode * dir
1347 - dir->u.ext3_i.i_flags &= ~EXT3_INDEX_FL;
1348 + EXT3_I(dir)->i_flags &= ~EXT3_INDEX_FL;
1349 ext3_mark_inode_dirty(handle, dir);
1350 d_instantiate(dentry, inode);
1352 @@ -1419,7 +1419,7 @@ int ext3_orphan_add(handle_t *handle, st
1356 - if (!list_empty(&inode->u.ext3_i.i_orphan))
1357 + if (!list_empty(&EXT3_I(inode)->i_orphan))
1360 /* Orphan handling is only valid for files with data blocks
1361 @@ -1430,8 +1430,8 @@ int ext3_orphan_add(handle_t *handle, st
1362 J_ASSERT ((S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
1363 S_ISLNK(inode->i_mode)) || inode->i_nlink == 0);
1365 - BUFFER_TRACE(sb->u.ext3_sb.s_sbh, "get_write_access");
1366 - err = ext3_journal_get_write_access(handle, sb->u.ext3_sb.s_sbh);
1367 + BUFFER_TRACE(EXT3_SB(sb)->s_sbh, "get_write_access");
1368 + err = ext3_journal_get_write_access(handle, EXT3_SB(sb)->s_sbh);
1372 @@ -1442,7 +1442,7 @@ int ext3_orphan_add(handle_t *handle, st
1373 /* Insert this inode at the head of the on-disk orphan list... */
1374 NEXT_ORPHAN(inode) = le32_to_cpu(EXT3_SB(sb)->s_es->s_last_orphan);
1375 EXT3_SB(sb)->s_es->s_last_orphan = cpu_to_le32(inode->i_ino);
1376 - err = ext3_journal_dirty_metadata(handle, sb->u.ext3_sb.s_sbh);
1377 + err = ext3_journal_dirty_metadata(handle, EXT3_SB(sb)->s_sbh);
1378 rc = ext3_mark_iloc_dirty(handle, inode, &iloc);
1381 @@ -1456,7 +1456,7 @@ int ext3_orphan_add(handle_t *handle, st
1382 * This is safe: on error we're going to ignore the orphan list
1383 * anyway on the next recovery. */
1385 - list_add(&inode->u.ext3_i.i_orphan, &EXT3_SB(sb)->s_orphan);
1386 + list_add(&EXT3_I(inode)->i_orphan, &EXT3_SB(sb)->s_orphan);
1388 jbd_debug(4, "superblock will point to %ld\n", inode->i_ino);
1389 jbd_debug(4, "orphan inode %ld will point to %d\n",
1390 @@ -714,25 +770,25 @@
1391 int ext3_orphan_del(handle_t *handle, struct inode *inode)
1393 struct list_head *prev;
1394 + struct ext3_inode_info *ei = EXT3_I(inode);
1395 struct ext3_sb_info *sbi;
1397 struct ext3_iloc iloc;
1400 lock_super(inode->i_sb);
1401 - if (list_empty(&inode->u.ext3_i.i_orphan)) {
1402 + if (list_empty(&ei->i_orphan)) {
1403 unlock_super(inode->i_sb);
1407 ino_next = NEXT_ORPHAN(inode);
1408 - prev = inode->u.ext3_i.i_orphan.prev;
1409 + prev = ei->i_orphan.prev;
1410 sbi = EXT3_SB(inode->i_sb);
1412 jbd_debug(4, "remove inode %ld from orphan list\n", inode->i_ino);
1414 - list_del(&inode->u.ext3_i.i_orphan);
1415 - INIT_LIST_HEAD(&inode->u.ext3_i.i_orphan);
1416 + list_del_init(&ei->i_orphan);
1418 /* If we're on an error path, we may not have a valid
1419 * transaction handle with which to update the orphan list on
1420 @@ -1520,9 +1520,8 @@ int ext3_orphan_del(handle_t *handle, st
1421 err = ext3_journal_dirty_metadata(handle, sbi->s_sbh);
1423 struct ext3_iloc iloc2;
1424 - struct inode *i_prev =
1425 - list_entry(prev, struct inode, u.ext3_i.i_orphan);
1427 + struct inode *i_prev = orphan_list_entry(prev);
1429 jbd_debug(4, "orphan inode %ld will point to %ld\n",
1430 i_prev->i_ino, ino_next);
1431 err = ext3_reserve_inode_write(handle, i_prev, &iloc2);
1432 @@ -1695,10 +1695,10 @@ static int ext3_symlink (struct inode *
1435 inode->i_op = &ext3_fast_symlink_inode_operations;
1436 - memcpy((char*)&inode->u.ext3_i.i_data,symname,l);
1437 + memcpy((char*)&EXT3_I(inode)->i_data,symname,l);
1438 inode->i_size = l-1;
1440 - inode->u.ext3_i.i_disksize = inode->i_size;
1441 + EXT3_I(inode)->i_disksize = inode->i_size;
1442 ext3_mark_inode_dirty(handle, inode);
1443 err = ext3_add_nondir(handle, dentry, inode);
1445 --- ./fs/ext3/super.c.orig Fri Apr 12 10:27:49 2002
1446 +++ ./fs/ext3/super.c Tue May 7 16:05:44 2002
1447 @@ -121,7 +121,7 @@ static int ext3_error_behaviour(struct s
1448 /* If no overrides were specified on the mount, then fall back
1449 * to the default behaviour set in the filesystem's superblock
1451 - switch (le16_to_cpu(sb->u.ext3_sb.s_es->s_errors)) {
1452 + switch (le16_to_cpu(EXT3_SB(sb)->s_es->s_errors)) {
1453 case EXT3_ERRORS_PANIC:
1454 return EXT3_ERRORS_PANIC;
1455 case EXT3_ERRORS_RO:
1456 @@ -269,9 +269,9 @@ void ext3_abort (struct super_block * sb
1459 printk (KERN_CRIT "Remounting filesystem read-only\n");
1460 - sb->u.ext3_sb.s_mount_state |= EXT3_ERROR_FS;
1461 + EXT3_SB(sb)->s_mount_state |= EXT3_ERROR_FS;
1462 sb->s_flags |= MS_RDONLY;
1463 - sb->u.ext3_sb.s_mount_opt |= EXT3_MOUNT_ABORT;
1464 + EXT3_SB(sb)->s_mount_opt |= EXT3_MOUNT_ABORT;
1465 journal_abort(EXT3_SB(sb)->s_journal, -EIO);
1468 @@ -377,8 +377,6 @@ static int ext3_blkdev_remove(struct ext3
1472 -#define orphan_list_entry(l) list_entry((l), struct inode, u.ext3_i.i_orphan)
1474 static void dump_orphan_list(struct super_block *sb, struct ext3_sb_info *sbi)
1476 struct list_head *l;
1477 @@ -818,7 +818,7 @@ static void ext3_orphan_cleanup (struct
1478 sb->s_flags &= ~MS_RDONLY;
1481 - if (sb->u.ext3_sb.s_mount_state & EXT3_ERROR_FS) {
1482 + if (EXT3_SB(sb)->s_mount_state & EXT3_ERROR_FS) {
1483 if (es->s_last_orphan)
1484 jbd_debug(1, "Errors on filesystem, "
1485 "clearing orphan list.\n");
1486 @@ -1463,12 +1463,14 @@ static void ext3_commit_super (struct su
1487 struct ext3_super_block * es,
1490 + struct buffer_head *sbh = EXT3_SB(sb)->s_sbh;
1492 es->s_wtime = cpu_to_le32(CURRENT_TIME);
1493 - BUFFER_TRACE(sb->u.ext3_sb.s_sbh, "marking dirty");
1494 - mark_buffer_dirty(sb->u.ext3_sb.s_sbh);
1495 + BUFFER_TRACE(sbh, "marking dirty");
1496 + mark_buffer_dirty(sbh);
1498 - ll_rw_block(WRITE, 1, &sb->u.ext3_sb.s_sbh);
1499 - wait_on_buffer(sb->u.ext3_sb.s_sbh);
1500 + ll_rw_block(WRITE, 1, &sbh);
1501 + wait_on_buffer(sbh);
1505 @@ -1519,7 +1521,7 @@ static void ext3_clear_journal_err(struc
1506 ext3_warning(sb, __FUNCTION__, "Marking fs in need of "
1507 "filesystem check.");
1509 - sb->u.ext3_sb.s_mount_state |= EXT3_ERROR_FS;
1510 + EXT3_SB(sb)->s_mount_state |= EXT3_ERROR_FS;
1511 es->s_state |= cpu_to_le16(EXT3_ERROR_FS);
1512 ext3_commit_super (sb, es, 1);
1514 --- ./fs/ext3/symlink.c.orig Fri Apr 12 10:27:49 2002
1515 +++ ./fs/ext3/symlink.c Tue May 7 15:25:39 2002
1518 static int ext3_readlink(struct dentry *dentry, char *buffer, int buflen)
1520 - char *s = (char *)dentry->d_inode->u.ext3_i.i_data;
1521 - return vfs_readlink(dentry, buffer, buflen, s);
1522 + struct ext3_inode_info *ei = EXT3_I(dentry->d_inode);
1523 + return vfs_readlink(dentry, buffer, buflen, (char *)ei->i_data);
1526 static int ext3_follow_link(struct dentry *dentry, struct nameidata *nd)
1528 - char *s = (char *)dentry->d_inode->u.ext3_i.i_data;
1529 - return vfs_follow_link(nd, s);
1530 + struct ext3_inode_info *ei = EXT3_I(dentry->d_inode);
1531 + return vfs_follow_link(nd, (char*)ei->i_data);
1534 --- ./include/linux/ext3_fs.h.orig Tue Apr 16 14:27:25 2002
1535 +++ ./include/linux/ext3_fs.h Tue May 7 16:47:36 2002
1537 #define EXT3_MIN_BLOCK_SIZE 1024
1538 #define EXT3_MAX_BLOCK_SIZE 4096
1539 #define EXT3_MIN_BLOCK_LOG_SIZE 10
1542 -# define EXT3_BLOCK_SIZE(s) ((s)->s_blocksize)
1544 -# define EXT3_BLOCK_SIZE(s) (EXT3_MIN_BLOCK_SIZE << (s)->s_log_block_size)
1546 -#define EXT3_ADDR_PER_BLOCK(s) (EXT3_BLOCK_SIZE(s) / sizeof (__u32))
1548 -# define EXT3_BLOCK_SIZE_BITS(s) ((s)->s_blocksize_bits)
1550 -# define EXT3_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10)
1553 -#define EXT3_ADDR_PER_BLOCK_BITS(s) ((s)->u.ext3_sb.s_addr_per_block_bits)
1554 -#define EXT3_INODE_SIZE(s) ((s)->u.ext3_sb.s_inode_size)
1555 -#define EXT3_FIRST_INO(s) ((s)->u.ext3_sb.s_first_ino)
1556 +#define EXT3_SB(sb) (&((sb)->u.ext3_sb))
1557 +#define EXT3_I(inode) (&((inode)->u.ext3_i))
1559 +#define EXT3_BLOCK_SIZE(s) ((s)->s_blocksize)
1560 +#define EXT3_BLOCK_SIZE_BITS(s) ((s)->s_blocksize_bits)
1561 +#define EXT3_ADDR_PER_BLOCK_BITS(s) (EXT3_SB(s)->s_addr_per_block_bits)
1562 +#define EXT3_INODE_SIZE(s) (EXT3_SB(s)->s_inode_size)
1563 +#define EXT3_FIRST_INO(s) (EXT3_SB(s)->s_first_ino)
1566 +/* Assume that user mode programs are passing in an ext3fs superblock, not
1567 + * a kernel struct super_block. This will allow us to call the feature-test
1568 + * macros from user land. */
1569 +#define EXT3_SB(sb) (sb)
1571 +#define EXT3_BLOCK_SIZE(s) (EXT3_MIN_BLOCK_SIZE << (s)->s_log_block_size)
1572 +#define EXT3_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10)
1573 #define EXT3_INODE_SIZE(s) (((s)->s_rev_level == EXT3_GOOD_OLD_REV) ? \
1574 EXT3_GOOD_OLD_INODE_SIZE : \
1577 EXT3_GOOD_OLD_FIRST_INO : \
1580 +#define EXT3_ADDR_PER_BLOCK(s) (EXT3_BLOCK_SIZE(s) / sizeof (__u32))
1583 * Macro-instructions used to manage fragments
1585 #define EXT3_MAX_FRAG_SIZE 4096
1586 #define EXT3_MIN_FRAG_LOG_SIZE 10
1588 -# define EXT3_FRAG_SIZE(s) ((s)->u.ext3_sb.s_frag_size)
1589 -# define EXT3_FRAGS_PER_BLOCK(s) ((s)->u.ext3_sb.s_frags_per_block)
1590 +# define EXT3_FRAG_SIZE(s) (EXT3_SB(s)->s_frag_size)
1591 +# define EXT3_FRAGS_PER_BLOCK(s) (EXT3_SB(s)->s_frags_per_block)
1593 # define EXT3_FRAG_SIZE(s) (EXT3_MIN_FRAG_SIZE << (s)->s_log_frag_size)
1594 # define EXT3_FRAGS_PER_BLOCK(s) (EXT3_BLOCK_SIZE(s) / EXT3_FRAG_SIZE(s))
1595 @@ -163,15 +167,13 @@
1597 * Macro-instructions used to manage group descriptors
1599 +# define EXT3_BLOCKS_PER_GROUP(s) (EXT3_SB(s)->s_blocks_per_group)
1600 +# define EXT3_INODES_PER_GROUP(s) (EXT3_SB(s)->s_inodes_per_group)
1602 -# define EXT3_BLOCKS_PER_GROUP(s) ((s)->u.ext3_sb.s_blocks_per_group)
1603 -# define EXT3_DESC_PER_BLOCK(s) ((s)->u.ext3_sb.s_desc_per_block)
1604 -# define EXT3_INODES_PER_GROUP(s) ((s)->u.ext3_sb.s_inodes_per_group)
1605 -# define EXT3_DESC_PER_BLOCK_BITS(s) ((s)->u.ext3_sb.s_desc_per_block_bits)
1606 +# define EXT3_DESC_PER_BLOCK(s) (EXT3_SB(s)->s_desc_per_block)
1607 +# define EXT3_DESC_PER_BLOCK_BITS(s) (EXT3_SB(s)->s_desc_per_block_bits)
1609 -# define EXT3_BLOCKS_PER_GROUP(s) ((s)->s_blocks_per_group)
1610 # define EXT3_DESC_PER_BLOCK(s) (EXT3_BLOCK_SIZE(s) / sizeof (struct ext3_group_desc))
1611 -# define EXT3_INODES_PER_GROUP(s) ((s)->s_inodes_per_group)
1616 #ifndef _LINUX_EXT2_FS_H
1617 #define clear_opt(o, opt) o &= ~EXT3_MOUNT_##opt
1618 #define set_opt(o, opt) o |= EXT3_MOUNT_##opt
1619 -#define test_opt(sb, opt) ((sb)->u.ext3_sb.s_mount_opt & \
1620 +#define test_opt(sb, opt) (EXT3_SB(sb)->s_mount_opt & \
1623 #define EXT2_MOUNT_NOLOAD EXT3_MOUNT_NOLOAD
1624 @@ -441,17 +443,11 @@
1625 /*EC*/ __u32 s_reserved[197]; /* Padding to the end of the block */
1629 -#define EXT3_SB(sb) (&((sb)->u.ext3_sb))
1630 -#define EXT3_I(inode) (&((inode)->u.ext3_i))
1632 -/* Assume that user mode programs are passing in an ext3fs superblock, not
1633 - * a kernel struct super_block. This will allow us to call the feature-test
1634 - * macros from user land. */
1635 -#define EXT3_SB(sb) (sb)
1638 -#define NEXT_ORPHAN(inode) (inode)->u.ext3_i.i_dtime
1639 +#define NEXT_ORPHAN(inode) EXT3_I(inode)->i_dtime
1640 +static inline struct inode *orphan_list_entry(struct list_head *l)
1642 + return list_entry(l, struct inode, u.ext3_i.i_orphan);
1646 * Codes for operating systems
1647 --- ./include/linux/ext3_jbd.h.orig Tue May 7 14:44:08 2002
1648 +++ ./include/linux/ext3_jbd.h Tue May 7 14:44:43 2002
1651 if (test_opt(inode->i_sb, DATA_FLAGS) == EXT3_MOUNT_JOURNAL_DATA)
1653 - if (inode->u.ext3_i.i_flags & EXT3_JOURNAL_DATA_FL)
1654 + if (EXT3_I(inode)->i_flags & EXT3_JOURNAL_DATA_FL)