1 Index: linux-2.4.21-chaos/fs/ext3/balloc.c
2 ===================================================================
3 --- linux-2.4.21-chaos.orig/fs/ext3/balloc.c 2003-07-15 02:09:35.000000000 +0400
4 +++ linux-2.4.21-chaos/fs/ext3/balloc.c 2003-12-12 12:50:34.000000000 +0300
7 struct ext3_group_desc * gdp;
9 - if (block_group >= sb->u.ext3_sb.s_groups_count) {
10 + if (block_group >= EXT3_SB(sb)->s_groups_count) {
11 ext3_error (sb, "ext3_get_group_desc",
12 "block_group >= groups_count - "
13 "block_group = %d, groups_count = %lu",
14 - block_group, sb->u.ext3_sb.s_groups_count);
15 + block_group, EXT3_SB(sb)->s_groups_count);
20 group_desc = block_group / EXT3_DESC_PER_BLOCK(sb);
21 desc = block_group % EXT3_DESC_PER_BLOCK(sb);
22 - if (!sb->u.ext3_sb.s_group_desc[group_desc]) {
23 + if (!EXT3_SB(sb)->s_group_desc[group_desc]) {
24 ext3_error (sb, "ext3_get_group_desc",
25 "Group descriptor not loaded - "
26 "block_group = %d, group_desc = %lu, desc = %lu",
30 gdp = (struct ext3_group_desc *)
31 - sb->u.ext3_sb.s_group_desc[group_desc]->b_data;
32 + EXT3_SB(sb)->s_group_desc[group_desc]->b_data;
34 - *bh = sb->u.ext3_sb.s_group_desc[group_desc];
35 + *bh = EXT3_SB(sb)->s_group_desc[group_desc];
40 * this group. The IO will be retried next time.
43 - sb->u.ext3_sb.s_block_bitmap_number[bitmap_nr] = block_group;
44 - sb->u.ext3_sb.s_block_bitmap[bitmap_nr] = bh;
45 + EXT3_SB(sb)->s_block_bitmap_number[bitmap_nr] = block_group;
46 + EXT3_SB(sb)->s_block_bitmap[bitmap_nr] = bh;
52 unsigned long block_bitmap_number;
53 struct buffer_head * block_bitmap;
54 + struct ext3_sb_info *sbi = EXT3_SB(sb);
56 - if (block_group >= sb->u.ext3_sb.s_groups_count)
57 + if (block_group >= sbi->s_groups_count)
58 ext3_panic (sb, "load_block_bitmap",
59 "block_group >= groups_count - "
60 "block_group = %d, groups_count = %lu",
61 - block_group, sb->u.ext3_sb.s_groups_count);
62 + block_group, EXT3_SB(sb)->s_groups_count);
64 - if (sb->u.ext3_sb.s_groups_count <= EXT3_MAX_GROUP_LOADED) {
65 - if (sb->u.ext3_sb.s_block_bitmap[block_group]) {
66 - if (sb->u.ext3_sb.s_block_bitmap_number[block_group] ==
67 + if (sbi->s_groups_count <= EXT3_MAX_GROUP_LOADED) {
68 + if (sbi->s_block_bitmap[block_group]) {
69 + if (sbi->s_block_bitmap_number[block_group] ==
72 ext3_error (sb, "__load_block_bitmap",
77 - for (i = 0; i < sb->u.ext3_sb.s_loaded_block_bitmaps &&
78 - sb->u.ext3_sb.s_block_bitmap_number[i] != block_group; i++)
79 + for (i = 0; i < sbi->s_loaded_block_bitmaps &&
80 + sbi->s_block_bitmap_number[i] != block_group; i++)
82 - if (i < sb->u.ext3_sb.s_loaded_block_bitmaps &&
83 - sb->u.ext3_sb.s_block_bitmap_number[i] == block_group) {
84 - block_bitmap_number = sb->u.ext3_sb.s_block_bitmap_number[i];
85 - block_bitmap = sb->u.ext3_sb.s_block_bitmap[i];
86 + if (i < sbi->s_loaded_block_bitmaps &&
87 + sbi->s_block_bitmap_number[i] == block_group) {
88 + block_bitmap_number = sbi->s_block_bitmap_number[i];
89 + block_bitmap = sbi->s_block_bitmap[i];
90 for (j = i; j > 0; j--) {
91 - sb->u.ext3_sb.s_block_bitmap_number[j] =
92 - sb->u.ext3_sb.s_block_bitmap_number[j - 1];
93 - sb->u.ext3_sb.s_block_bitmap[j] =
94 - sb->u.ext3_sb.s_block_bitmap[j - 1];
95 + sbi->s_block_bitmap_number[j] =
96 + sbi->s_block_bitmap_number[j - 1];
97 + sbi->s_block_bitmap[j] = sbi->s_block_bitmap[j - 1];
99 - sb->u.ext3_sb.s_block_bitmap_number[0] = block_bitmap_number;
100 - sb->u.ext3_sb.s_block_bitmap[0] = block_bitmap;
101 + sbi->s_block_bitmap_number[0] = block_bitmap_number;
102 + sbi->s_block_bitmap[0] = block_bitmap;
105 * There's still one special case here --- if block_bitmap == 0
106 @@ -173,17 +173,14 @@
108 retval = read_block_bitmap (sb, block_group, 0);
110 - if (sb->u.ext3_sb.s_loaded_block_bitmaps<EXT3_MAX_GROUP_LOADED)
111 - sb->u.ext3_sb.s_loaded_block_bitmaps++;
112 + if (sbi->s_loaded_block_bitmaps<EXT3_MAX_GROUP_LOADED)
113 + sbi->s_loaded_block_bitmaps++;
115 - brelse (sb->u.ext3_sb.s_block_bitmap
116 - [EXT3_MAX_GROUP_LOADED - 1]);
117 - for (j = sb->u.ext3_sb.s_loaded_block_bitmaps - 1;
119 - sb->u.ext3_sb.s_block_bitmap_number[j] =
120 - sb->u.ext3_sb.s_block_bitmap_number[j - 1];
121 - sb->u.ext3_sb.s_block_bitmap[j] =
122 - sb->u.ext3_sb.s_block_bitmap[j - 1];
123 + brelse(sbi->s_block_bitmap[EXT3_MAX_GROUP_LOADED - 1]);
124 + for (j = sbi->s_loaded_block_bitmaps - 1; j > 0; j--) {
125 + sbi->s_block_bitmap_number[j] =
126 + sbi->s_block_bitmap_number[j - 1];
127 + sbi->s_block_bitmap[j] = sbi->s_block_bitmap[j - 1];
129 retval = read_block_bitmap (sb, block_group, 0);
131 @@ -206,24 +203,25 @@
132 static inline int load_block_bitmap (struct super_block * sb,
133 unsigned int block_group)
135 + struct ext3_sb_info *sbi = EXT3_SB(sb);
140 * Do the lookup for the slot. First of all, check if we're asking
141 * for the same slot as last time, and did we succeed that last time?
143 - if (sb->u.ext3_sb.s_loaded_block_bitmaps > 0 &&
144 - sb->u.ext3_sb.s_block_bitmap_number[0] == block_group &&
145 - sb->u.ext3_sb.s_block_bitmap[0]) {
146 + if (sbi->s_loaded_block_bitmaps > 0 &&
147 + sbi->s_block_bitmap_number[0] == block_group &&
148 + sbi->s_block_bitmap[0]) {
152 * Or can we do a fast lookup based on a loaded group on a filesystem
153 * small enough to be mapped directly into the superblock?
155 - else if (sb->u.ext3_sb.s_groups_count <= EXT3_MAX_GROUP_LOADED &&
156 - sb->u.ext3_sb.s_block_bitmap_number[block_group]==block_group
157 - && sb->u.ext3_sb.s_block_bitmap[block_group]) {
158 + else if (sbi->s_groups_count <= EXT3_MAX_GROUP_LOADED &&
159 + sbi->s_block_bitmap_number[block_group] == block_group
160 + && sbi->s_block_bitmap[block_group]) {
165 * If it's a valid slot, we may still have cached a previous IO error,
166 * in which case the bh in the superblock cache will be zero.
168 - if (!sb->u.ext3_sb.s_block_bitmap[slot])
169 + if (!sbi->s_block_bitmap[slot])
177 - es = sb->u.ext3_sb.s_es;
178 + es = EXT3_SB(sb)->s_es;
179 if (block < le32_to_cpu(es->s_first_data_block) ||
180 block + count < block ||
181 (block + count) > le32_to_cpu(es->s_blocks_count)) {
186 - bitmap_bh = sb->u.ext3_sb.s_block_bitmap[bitmap_nr];
187 + bitmap_bh = EXT3_SB(sb)->s_block_bitmap[bitmap_nr];
188 gdp = ext3_get_group_desc (sb, block_group, &gd_bh);
195 - BUFFER_TRACE(sb->u.ext3_sb.s_sbh, "get_write_access");
196 - err = ext3_journal_get_write_access(handle, sb->u.ext3_sb.s_sbh);
197 + BUFFER_TRACE(EXT3_SB(sb)->s_sbh, "get_write_access");
198 + err = ext3_journal_get_write_access(handle, EXT3_SB(sb)->s_sbh);
205 /* And the superblock */
206 - BUFFER_TRACE(sb->u.ext3_sb.s_sbh, "dirtied superblock");
207 - ret = ext3_journal_dirty_metadata(handle, sb->u.ext3_sb.s_sbh);
208 + BUFFER_TRACE(EXT3_SB(sb)->s_sbh, "dirtied superblock");
209 + ret = ext3_journal_dirty_metadata(handle, EXT3_SB(sb)->s_sbh);
212 if (overflow && !err) {
213 @@ -563,12 +561,12 @@
217 - es = sb->u.ext3_sb.s_es;
218 + es = EXT3_SB(sb)->s_es;
219 if (le32_to_cpu(es->s_free_blocks_count) <=
220 le32_to_cpu(es->s_r_blocks_count) &&
221 - ((sb->u.ext3_sb.s_resuid != current->fsuid) &&
222 - (sb->u.ext3_sb.s_resgid == 0 ||
223 - !in_group_p (sb->u.ext3_sb.s_resgid)) &&
224 + ((EXT3_SB(sb)->s_resuid != current->fsuid) &&
225 + (EXT3_SB(sb)->s_resgid == 0 ||
226 + !in_group_p (EXT3_SB(sb)->s_resgid)) &&
227 !capable(CAP_SYS_RESOURCE)))
234 - bh = sb->u.ext3_sb.s_block_bitmap[bitmap_nr];
235 + bh = EXT3_SB(sb)->s_block_bitmap[bitmap_nr];
237 ext3_debug ("goal is at %d:%d.\n", i, j);
240 * Now search the rest of the groups. We assume that
241 * i and gdp correctly point to the last group visited.
243 - for (k = 0; k < sb->u.ext3_sb.s_groups_count; k++) {
244 + for (k = 0; k < EXT3_SB(sb)->s_groups_count; k++) {
246 - if (i >= sb->u.ext3_sb.s_groups_count)
247 + if (i >= EXT3_SB(sb)->s_groups_count)
249 gdp = ext3_get_group_desc (sb, i, &bh2);
255 - bh = sb->u.ext3_sb.s_block_bitmap[bitmap_nr];
256 + bh = EXT3_SB(sb)->s_block_bitmap[bitmap_nr];
257 j = find_next_usable_block(-1, bh,
258 EXT3_BLOCKS_PER_GROUP(sb));
261 fatal = ext3_journal_get_write_access(handle, bh2);
264 - BUFFER_TRACE(sb->u.ext3_sb.s_sbh, "get_write_access");
265 - fatal = ext3_journal_get_write_access(handle, sb->u.ext3_sb.s_sbh);
266 + BUFFER_TRACE(EXT3_SB(sb)->s_sbh, "get_write_access");
267 + fatal = ext3_journal_get_write_access(handle, EXT3_SB(sb)->s_sbh);
270 tmp = j + i * EXT3_BLOCKS_PER_GROUP(sb)
272 if (!fatal) fatal = err;
274 BUFFER_TRACE(bh, "journal_dirty_metadata for superblock");
275 - err = ext3_journal_dirty_metadata(handle, sb->u.ext3_sb.s_sbh);
276 + err = ext3_journal_dirty_metadata(handle, EXT3_SB(sb)->s_sbh);
277 if (!fatal) fatal = err;
280 @@ -845,11 +843,11 @@
284 - es = sb->u.ext3_sb.s_es;
285 + es = EXT3_SB(sb)->s_es;
289 - for (i = 0; i < sb->u.ext3_sb.s_groups_count; i++) {
290 + for (i = 0; i < EXT3_SB(sb)->s_groups_count; i++) {
291 gdp = ext3_get_group_desc (sb, i, NULL);
298 - x = ext3_count_free (sb->u.ext3_sb.s_block_bitmap[bitmap_nr],
299 + x = ext3_count_free (EXT3_SB(sb)->s_block_bitmap[bitmap_nr],
301 printk ("group %d: stored = %d, counted = %lu\n",
302 i, le16_to_cpu(gdp->bg_free_blocks_count), x);
307 - return le32_to_cpu(sb->u.ext3_sb.s_es->s_free_blocks_count);
308 + return le32_to_cpu(EXT3_SB(sb)->s_es->s_free_blocks_count);
315 return ext3_test_bit ((block -
316 - le32_to_cpu(sb->u.ext3_sb.s_es->s_first_data_block)) %
317 + le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block)) %
318 EXT3_BLOCKS_PER_GROUP(sb), map);
321 @@ -946,11 +944,11 @@
322 struct ext3_group_desc * gdp;
325 - es = sb->u.ext3_sb.s_es;
326 + es = EXT3_SB(sb)->s_es;
330 - for (i = 0; i < sb->u.ext3_sb.s_groups_count; i++) {
331 + for (i = 0; i < EXT3_SB(sb)->s_groups_count; i++) {
332 gdp = ext3_get_group_desc (sb, i, NULL);
336 "Inode bitmap for group %d is marked free",
339 - for (j = 0; j < sb->u.ext3_sb.s_itb_per_group; j++)
340 + for (j = 0; j < EXT3_SB(sb)->s_itb_per_group; j++)
341 if (!block_in_use (le32_to_cpu(gdp->bg_inode_table) + j,
343 ext3_error (sb, "ext3_check_blocks_bitmap",
344 Index: linux-2.4.21-chaos/fs/ext3/dir.c
345 ===================================================================
346 --- linux-2.4.21-chaos.orig/fs/ext3/dir.c 2003-12-12 11:36:13.000000000 +0300
347 +++ linux-2.4.21-chaos/fs/ext3/dir.c 2003-12-12 12:50:34.000000000 +0300
349 else if (((char *) de - bh->b_data) + rlen > dir->i_sb->s_blocksize)
350 error_msg = "directory entry across blocks";
351 else if (le32_to_cpu(de->inode) >
352 - le32_to_cpu(dir->i_sb->u.ext3_sb.s_es->s_inodes_count))
353 + le32_to_cpu(EXT3_SB(dir->i_sb)->s_es->s_inodes_count))
354 error_msg = "inode out of bounds";
356 if (error_msg != NULL)
357 Index: linux-2.4.21-chaos/fs/ext3/ialloc.c
358 ===================================================================
359 --- linux-2.4.21-chaos.orig/fs/ext3/ialloc.c 2003-09-19 03:49:54.000000000 +0400
360 +++ linux-2.4.21-chaos/fs/ext3/ialloc.c 2003-12-12 12:53:11.000000000 +0300
362 * this group. The IO will be retried next time.
365 - sb->u.ext3_sb.s_inode_bitmap_number[bitmap_nr] = block_group;
366 - sb->u.ext3_sb.s_inode_bitmap[bitmap_nr] = bh;
367 + EXT3_SB(sb)->s_inode_bitmap_number[bitmap_nr] = block_group;
368 + EXT3_SB(sb)->s_inode_bitmap[bitmap_nr] = bh;
376 - es = sb->u.ext3_sb.s_es;
377 + es = EXT3_SB(sb)->s_es;
378 if (ino < EXT3_FIRST_INO(sb) || ino > le32_to_cpu(es->s_inodes_count)) {
379 ext3_error (sb, "ext3_free_inode",
380 "reserved or nonexistent inode %lu", ino);
385 - bh = sb->u.ext3_sb.s_inode_bitmap[bitmap_nr];
386 + bh = EXT3_SB(sb)->s_inode_bitmap[bitmap_nr];
388 BUFFER_TRACE(bh, "get_write_access");
389 fatal = ext3_journal_get_write_access(handle, bh);
391 fatal = ext3_journal_get_write_access(handle, bh2);
392 if (fatal) goto error_return;
394 - BUFFER_TRACE(sb->u.ext3_sb.s_sbh, "get write access");
395 - fatal = ext3_journal_get_write_access(handle, sb->u.ext3_sb.s_sbh);
396 + BUFFER_TRACE(EXT3_SB(sb)->s_sbh, "get write access");
397 + fatal = ext3_journal_get_write_access(handle, EXT3_SB(sb)->s_sbh);
398 if (fatal) goto error_return;
402 if (!fatal) fatal = err;
403 es->s_free_inodes_count =
404 cpu_to_le32(le32_to_cpu(es->s_free_inodes_count) + 1);
405 - BUFFER_TRACE(sb->u.ext3_sb.s_sbh,
406 + BUFFER_TRACE(EXT3_SB(sb)->s_sbh,
407 "call ext3_journal_dirty_metadata");
408 - err = ext3_journal_dirty_metadata(handle, sb->u.ext3_sb.s_sbh);
409 + err = ext3_journal_dirty_metadata(handle, EXT3_SB(sb)->s_sbh);
410 if (!fatal) fatal = err;
412 BUFFER_TRACE(bh, "call ext3_journal_dirty_metadata");
415 struct inode * inode;
417 + struct ext3_inode_info *ei;
418 + struct ext3_sb_info *sbi;
419 struct ext3_group_desc * gdp;
420 struct ext3_group_desc * tmp;
421 struct ext3_super_block * es;
422 @@ -320,19 +322,21 @@
423 inode = new_inode(sb);
425 return ERR_PTR(-ENOMEM);
426 - init_rwsem(&inode->u.ext3_i.truncate_sem);
428 + ei = EXT3_I(inode);
429 + init_rwsem(&ei->truncate_sem);
432 - es = sb->u.ext3_sb.s_es;
439 avefreei = le32_to_cpu(es->s_free_inodes_count) /
440 - sb->u.ext3_sb.s_groups_count;
441 + sbi->s_groups_count;
443 - for (j = 0; j < sb->u.ext3_sb.s_groups_count; j++) {
444 + for (j = 0; j < sbi->s_groups_count; j++) {
445 struct buffer_head *temp_buffer;
446 tmp = ext3_get_group_desc (sb, j, &temp_buffer);
450 * Try to place the inode in its parent directory
452 - i = dir->u.ext3_i.i_block_group;
453 + i = EXT3_I(dir)->i_block_group;
454 tmp = ext3_get_group_desc (sb, i, &bh2);
455 if (tmp && le16_to_cpu(tmp->bg_free_inodes_count))
457 @@ -362,10 +366,10 @@
458 * Use a quadratic hash to find a group with a
461 - for (j = 1; j < sb->u.ext3_sb.s_groups_count; j <<= 1) {
462 + for (j = 1; j < sbi->s_groups_count; j <<= 1) {
464 - if (i >= sb->u.ext3_sb.s_groups_count)
465 - i -= sb->u.ext3_sb.s_groups_count;
466 + if (i >= sbi->s_groups_count)
467 + i -= sbi->s_groups_count;
468 tmp = ext3_get_group_desc (sb, i, &bh2);
470 le16_to_cpu(tmp->bg_free_inodes_count)) {
473 * That failed: try linear search for a free inode
475 - i = dir->u.ext3_i.i_block_group + 1;
476 - for (j = 2; j < sb->u.ext3_sb.s_groups_count; j++) {
477 - if (++i >= sb->u.ext3_sb.s_groups_count)
478 + i = EXT3_I(dir)->i_block_group + 1;
479 + for (j = 2; j < sbi->s_groups_count; j++) {
480 + if (++i >= sbi->s_groups_count)
482 tmp = ext3_get_group_desc (sb, i, &bh2);
484 @@ -401,11 +405,11 @@
488 - bh = sb->u.ext3_sb.s_inode_bitmap[bitmap_nr];
489 + bh = sbi->s_inode_bitmap[bitmap_nr];
491 if ((j = ext3_find_first_zero_bit ((unsigned long *) bh->b_data,
492 - EXT3_INODES_PER_GROUP(sb))) <
493 - EXT3_INODES_PER_GROUP(sb)) {
494 + sbi->s_inodes_per_group)) <
495 + sbi->s_inodes_per_group) {
496 BUFFER_TRACE(bh, "get_write_access");
497 err = ext3_journal_get_write_access(handle, bh);
499 @@ -459,13 +463,13 @@
500 err = ext3_journal_dirty_metadata(handle, bh2);
503 - BUFFER_TRACE(sb->u.ext3_sb.s_sbh, "get_write_access");
504 - err = ext3_journal_get_write_access(handle, sb->u.ext3_sb.s_sbh);
505 + BUFFER_TRACE(sbi->s_sbh, "get_write_access");
506 + err = ext3_journal_get_write_access(handle, sbi->s_sbh);
508 es->s_free_inodes_count =
509 cpu_to_le32(le32_to_cpu(es->s_free_inodes_count) - 1);
510 - BUFFER_TRACE(sb->u.ext3_sb.s_sbh, "call ext3_journal_dirty_metadata");
511 - err = ext3_journal_dirty_metadata(handle, sb->u.ext3_sb.s_sbh);
512 + BUFFER_TRACE(sbi->s_sbh, "call ext3_journal_dirty_metadata");
513 + err = ext3_journal_dirty_metadata(handle, sbi->s_sbh);
517 @@ -485,35 +489,35 @@
518 inode->i_blksize = PAGE_SIZE;
520 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
521 - inode->u.ext3_i.i_flags = dir->u.ext3_i.i_flags & ~EXT3_INDEX_FL;
522 + ei->i_flags = EXT3_I(dir)->i_flags & ~EXT3_INDEX_FL;
524 - inode->u.ext3_i.i_flags &= ~(EXT3_IMMUTABLE_FL|EXT3_APPEND_FL);
525 + ei->i_flags &= ~(EXT3_IMMUTABLE_FL|EXT3_APPEND_FL);
526 #ifdef EXT3_FRAGMENTS
527 - inode->u.ext3_i.i_faddr = 0;
528 - inode->u.ext3_i.i_frag_no = 0;
529 - inode->u.ext3_i.i_frag_size = 0;
532 + ei->i_frag_size = 0;
534 - inode->u.ext3_i.i_file_acl = 0;
535 - inode->u.ext3_i.i_dir_acl = 0;
536 - inode->u.ext3_i.i_dtime = 0;
537 - INIT_LIST_HEAD(&inode->u.ext3_i.i_orphan);
538 + ei->i_file_acl = 0;
541 + INIT_LIST_HEAD(&ei->i_orphan);
542 #ifdef EXT3_PREALLOCATE
543 - inode->u.ext3_i.i_prealloc_count = 0;
544 + ei->i_prealloc_count = 0;
546 - inode->u.ext3_i.i_block_group = i;
547 + ei->i_block_group = i;
549 ext3_set_inode_flags(inode);
552 insert_inode_hash(inode);
553 - inode->i_generation = sb->u.ext3_sb.s_next_generation++;
554 + inode->i_generation = sbi->s_next_generation++;
556 - inode->u.ext3_i.i_state = EXT3_STATE_NEW;
557 + ei->i_state = EXT3_STATE_NEW;
558 err = ext3_mark_inode_dirty(handle, inode);
561 #ifdef CONFIG_EXT3_FS_XATTR
562 - init_rwsem(&inode->u.ext3_i.xattr_sem);
563 + init_rwsem(&EXT3_I(inode)->xattr_sem);
567 @@ -600,19 +604,19 @@
569 unsigned long ext3_count_free_inodes (struct super_block * sb)
571 + struct ext3_sb_info *sbi = EXT3_SB(sb);
572 + struct ext3_super_block *es = sbi->s_es;
574 - struct ext3_super_block * es;
575 unsigned long desc_count, bitmap_count, x;
577 struct ext3_group_desc * gdp;
581 - es = sb->u.ext3_sb.s_es;
585 - for (i = 0; i < sb->u.ext3_sb.s_groups_count; i++) {
586 + for (i = 0; i < sbi->s_groups_count; i++) {
587 gdp = ext3_get_group_desc (sb, i, NULL);
594 - x = ext3_count_free (sb->u.ext3_sb.s_inode_bitmap[bitmap_nr],
595 - EXT3_INODES_PER_GROUP(sb) / 8);
596 + x = ext3_count_free(sbi->s_inode_bitmap[bitmap_nr],
597 + sbi->s_inodes_per_group / 8);
598 printk ("group %d: stored = %d, counted = %lu\n",
599 i, le16_to_cpu(gdp->bg_free_inodes_count), x);
605 - return le32_to_cpu(sb->u.ext3_sb.s_es->s_free_inodes_count);
606 + return le32_to_cpu(es->s_free_inodes_count);
610 @@ -641,16 +645,18 @@
611 void ext3_check_inodes_bitmap (struct super_block * sb)
613 struct ext3_super_block * es;
614 + struct ext3_sb_info *sbi;
615 unsigned long desc_count, bitmap_count, x;
617 struct ext3_group_desc * gdp;
620 - es = sb->u.ext3_sb.s_es;
626 - for (i = 0; i < sb->u.ext3_sb.s_groups_count; i++) {
627 + for (i = 0; i < sbi->s_groups_count; i++) {
628 gdp = ext3_get_group_desc (sb, i, NULL);
635 - x = ext3_count_free (sb->u.ext3_sb.s_inode_bitmap[bitmap_nr],
636 + x = ext3_count_free (sbi->s_inode_bitmap[bitmap_nr],
637 EXT3_INODES_PER_GROUP(sb) / 8);
638 if (le16_to_cpu(gdp->bg_free_inodes_count) != x)
639 ext3_error (sb, "ext3_check_inodes_bitmap",
640 Index: linux-2.4.21-chaos/fs/ext3/inode.c
641 ===================================================================
642 --- linux-2.4.21-chaos.orig/fs/ext3/inode.c 2003-12-05 07:55:47.000000000 +0300
643 +++ linux-2.4.21-chaos/fs/ext3/inode.c 2003-12-12 12:55:41.000000000 +0300
646 static inline int ext3_inode_is_fast_symlink(struct inode *inode)
648 - int ea_blocks = inode->u.ext3_i.i_file_acl ?
649 + int ea_blocks = EXT3_I(inode)->i_file_acl ?
650 (inode->i_sb->s_blocksize >> 9) : 0;
652 return (S_ISLNK(inode->i_mode) &&
654 * (Well, we could do this if we need to, but heck - it works)
656 ext3_orphan_del(handle, inode);
657 - inode->u.ext3_i.i_dtime = CURRENT_TIME;
658 + EXT3_I(inode)->i_dtime = CURRENT_TIME;
661 * One subtle ordering requirement: if anything has gone wrong
662 @@ -248,13 +248,14 @@
663 void ext3_discard_prealloc (struct inode * inode)
665 #ifdef EXT3_PREALLOCATE
666 + struct ext3_inode_info *ei = EXT3_I(inode);
668 /* Writer: ->i_prealloc* */
669 - if (inode->u.ext3_i.i_prealloc_count) {
670 - unsigned short total = inode->u.ext3_i.i_prealloc_count;
671 - unsigned long block = inode->u.ext3_i.i_prealloc_block;
672 - inode->u.ext3_i.i_prealloc_count = 0;
673 - inode->u.ext3_i.i_prealloc_block = 0;
674 + if (ei->i_prealloc_count) {
675 + unsigned short total = ei->i_prealloc_count;
676 + unsigned long block = ei->i_prealloc_block;
677 + ei->i_prealloc_count = 0;
678 + ei->i_prealloc_block = 0;
680 ext3_free_blocks (inode, block, total);
682 @@ -271,13 +272,15 @@
683 unsigned long result;
685 #ifdef EXT3_PREALLOCATE
686 + struct ext3_inode_info *ei = EXT3_I(inode);
688 /* Writer: ->i_prealloc* */
689 - if (inode->u.ext3_i.i_prealloc_count &&
690 - (goal == inode->u.ext3_i.i_prealloc_block ||
691 - goal + 1 == inode->u.ext3_i.i_prealloc_block))
692 + if (ei->i_prealloc_count &&
693 + (goal == ei->i_prealloc_block ||
694 + goal + 1 == ei->i_prealloc_block))
696 - result = inode->u.ext3_i.i_prealloc_block++;
697 - inode->u.ext3_i.i_prealloc_count--;
698 + result = ei->i_prealloc_block++;
699 + ei->i_prealloc_count--;
701 ext3_debug ("preallocation hit (%lu/%lu).\n",
702 ++alloc_hits, ++alloc_attempts);
704 alloc_hits, ++alloc_attempts);
705 if (S_ISREG(inode->i_mode))
706 result = ext3_new_block (inode, goal,
707 - &inode->u.ext3_i.i_prealloc_count,
708 - &inode->u.ext3_i.i_prealloc_block, err);
709 + &ei->i_prealloc_count,
710 + &ei->i_prealloc_block, err);
712 result = ext3_new_block (inode, goal, 0, 0, err);
717 /* i_data is not going away, no lock needed */
718 - add_chain (chain, NULL, inode->u.ext3_i.i_data + *offsets);
719 + add_chain (chain, NULL, EXT3_I(inode)->i_data + *offsets);
725 static inline unsigned long ext3_find_near(struct inode *inode, Indirect *ind)
727 - u32 *start = ind->bh ? (u32*) ind->bh->b_data : inode->u.ext3_i.i_data;
728 + struct ext3_inode_info *ei = EXT3_I(inode);
729 + u32 *start = ind->bh ? (u32*) ind->bh->b_data : ei->i_data;
732 /* Try to find previous block */
734 * It is going to be refered from inode itself? OK, just put it into
735 * the same cylinder group then.
737 - return (inode->u.ext3_i.i_block_group *
738 - EXT3_BLOCKS_PER_GROUP(inode->i_sb)) +
739 - le32_to_cpu(inode->i_sb->u.ext3_sb.s_es->s_first_data_block);
740 + return (ei->i_block_group * EXT3_BLOCKS_PER_GROUP(inode->i_sb)) +
741 + le32_to_cpu(EXT3_SB(inode->i_sb)->s_es->s_first_data_block);
745 @@ -503,14 +506,15 @@
746 static int ext3_find_goal(struct inode *inode, long block, Indirect chain[4],
747 Indirect *partial, unsigned long *goal)
749 + struct ext3_inode_info *ei = EXT3_I(inode);
750 /* Writer: ->i_next_alloc* */
751 - if (block == inode->u.ext3_i.i_next_alloc_block + 1) {
752 - inode->u.ext3_i.i_next_alloc_block++;
753 - inode->u.ext3_i.i_next_alloc_goal++;
754 + if (block == ei->i_next_alloc_block + 1) {
755 + ei->i_next_alloc_block++;
756 + ei->i_next_alloc_goal++;
758 #ifdef SEARCH_FROM_ZERO
759 - inode->u.ext3_i.i_next_alloc_block = 0;
760 - inode->u.ext3_i.i_next_alloc_goal = 0;
761 + ei->i_next_alloc_block = 0;
762 + ei->i_next_alloc_goal = 0;
765 /* Reader: pointers, ->i_next_alloc* */
767 * try the heuristic for sequential allocation,
768 * failing that at least try to get decent locality.
770 - if (block == inode->u.ext3_i.i_next_alloc_block)
771 - *goal = inode->u.ext3_i.i_next_alloc_goal;
772 + if (block == ei->i_next_alloc_block)
773 + *goal = ei->i_next_alloc_goal;
775 *goal = ext3_find_near(inode, partial);
776 #ifdef SEARCH_FROM_ZERO
781 + struct ext3_inode_info *ei = EXT3_I(inode);
784 * If we're splicing into a [td]indirect block (as opposed to the
785 @@ -668,11 +673,11 @@
788 *where->p = where->key;
789 - inode->u.ext3_i.i_next_alloc_block = block;
790 - inode->u.ext3_i.i_next_alloc_goal = le32_to_cpu(where[num-1].key);
791 + ei->i_next_alloc_block = block;
792 + ei->i_next_alloc_goal = le32_to_cpu(where[num-1].key);
793 #ifdef SEARCH_FROM_ZERO
794 - inode->u.ext3_i.i_next_alloc_block = 0;
795 - inode->u.ext3_i.i_next_alloc_goal = 0;
796 + ei->i_next_alloc_block = 0;
797 + ei->i_next_alloc_goal = 0;
804 int depth = ext3_block_to_path(inode, iblock, offsets);
805 + struct ext3_inode_info *ei = EXT3_I(inode);
808 J_ASSERT(handle != NULL || create == 0);
811 * Block out ext3_truncate while we alter the tree
813 - down_read(&inode->u.ext3_i.truncate_sem);
814 + down_read(&ei->truncate_sem);
815 err = ext3_alloc_branch(handle, inode, left, goal,
816 offsets+(partial-chain), partial);
820 err = ext3_splice_branch(handle, inode, iblock, chain,
822 - up_read(&inode->u.ext3_i.truncate_sem);
823 + up_read(&ei->truncate_sem);
828 struct buffer_head *tmp_bh;
831 - inode->u.ext3_i.i_prealloc_count &&
832 + EXT3_I(inode)->i_prealloc_count &&
833 i < EXT3_SB(inode->i_sb)->s_es->s_prealloc_dir_blocks;
836 @@ -1199,8 +1205,8 @@
840 - if (inode->i_size > inode->u.ext3_i.i_disksize) {
841 - inode->u.ext3_i.i_disksize = inode->i_size;
842 + if (inode->i_size > EXT3_I(inode)->i_disksize) {
843 + EXT3_I(inode)->i_disksize = inode->i_size;
844 ret2 = ext3_mark_inode_dirty(handle, inode);
847 @@ -2011,7 +2017,8 @@
848 void ext3_truncate(struct inode * inode)
851 - u32 *i_data = inode->u.ext3_i.i_data;
852 + struct ext3_inode_info *ei = EXT3_I(inode);
853 + u32 *i_data = EXT3_I(inode)->i_data;
854 int addr_per_block = EXT3_ADDR_PER_BLOCK(inode->i_sb);
857 @@ -2072,13 +2079,13 @@
858 * on-disk inode. We do this via i_disksize, which is the value which
859 * ext3 *really* writes onto the disk inode.
861 - inode->u.ext3_i.i_disksize = inode->i_size;
862 + ei->i_disksize = inode->i_size;
865 * From here we block out all ext3_get_block() callers who want to
866 * modify the block allocation tree.
868 - down_write(&inode->u.ext3_i.truncate_sem);
869 + down_write(&ei->truncate_sem);
871 if (n == 1) { /* direct blocks */
872 ext3_free_data(handle, inode, NULL, i_data+offsets[0],
873 @@ -2142,7 +2149,7 @@
874 case EXT3_TIND_BLOCK:
877 - up_write(&inode->u.ext3_i.truncate_sem);
878 + up_write(&ei->truncate_sem);
879 inode->i_mtime = inode->i_ctime = CURRENT_TIME;
880 ext3_mark_inode_dirty(handle, inode);
882 @@ -2179,6 +2186,8 @@
884 int ext3_get_inode_loc (struct inode *inode, struct ext3_iloc *iloc)
886 + struct super_block *sb = inode->i_sb;
887 + struct ext3_sb_info *sbi = EXT3_SB(sb);
888 struct buffer_head *bh = 0;
890 unsigned long block_group;
891 @@ -2189,25 +2198,21 @@
893 if ((inode->i_ino != EXT3_ROOT_INO &&
894 inode->i_ino != EXT3_JOURNAL_INO &&
895 - inode->i_ino < EXT3_FIRST_INO(inode->i_sb)) ||
896 - inode->i_ino > le32_to_cpu(
897 - inode->i_sb->u.ext3_sb.s_es->s_inodes_count)) {
898 - ext3_error (inode->i_sb, "ext3_get_inode_loc",
899 - "bad inode number: %lu", inode->i_ino);
900 + inode->i_ino < EXT3_FIRST_INO(sb)) ||
901 + inode->i_ino > le32_to_cpu(sbi->s_es->s_inodes_count)) {
902 + ext3_error (sb, __FUNCTION__, "bad inode #%lu", inode->i_ino);
905 - block_group = (inode->i_ino - 1) / EXT3_INODES_PER_GROUP(inode->i_sb);
906 - if (block_group >= inode->i_sb->u.ext3_sb.s_groups_count) {
907 - ext3_error (inode->i_sb, "ext3_get_inode_loc",
908 - "group >= groups count");
909 + block_group = (inode->i_ino - 1) / sbi->s_inodes_per_group;
910 + if (block_group >= sbi->s_groups_count) {
911 + ext3_error(sb, __FUNCTION__, "group >= groups count");
914 - group_desc = block_group >> EXT3_DESC_PER_BLOCK_BITS(inode->i_sb);
915 - desc = block_group & (EXT3_DESC_PER_BLOCK(inode->i_sb) - 1);
916 - bh = inode->i_sb->u.ext3_sb.s_group_desc[group_desc];
917 + group_desc = block_group >> sbi->s_desc_per_block_bits;
918 + desc = block_group & (sbi->s_desc_per_block - 1);
919 + bh = sbi->s_group_desc[group_desc];
921 - ext3_error (inode->i_sb, "ext3_get_inode_loc",
922 - "Descriptor not loaded");
923 + ext3_error(sb, __FUNCTION__, "Descriptor not loaded");
927 @@ -2215,17 +2220,17 @@
929 * Figure out the offset within the block group inode table
931 - offset = ((inode->i_ino - 1) % EXT3_INODES_PER_GROUP(inode->i_sb)) *
932 - EXT3_INODE_SIZE(inode->i_sb);
933 + offset = ((inode->i_ino - 1) % sbi->s_inodes_per_group) *
935 block = le32_to_cpu(gdp[desc].bg_inode_table) +
936 - (offset >> EXT3_BLOCK_SIZE_BITS(inode->i_sb));
937 - if (!(bh = sb_bread(inode->i_sb, block))) {
938 - ext3_error (inode->i_sb, "ext3_get_inode_loc",
939 + (offset >> EXT3_BLOCK_SIZE_BITS(sb));
940 + if (!(bh = sb_bread(sb, block))) {
941 + ext3_error (sb, __FUNCTION__,
942 "unable to read inode block - "
943 "inode=%lu, block=%lu", inode->i_ino, block);
946 - offset &= (EXT3_BLOCK_SIZE(inode->i_sb) - 1);
947 + offset &= (EXT3_BLOCK_SIZE(sb) - 1);
950 iloc->raw_inode = (struct ext3_inode *) (bh->b_data + offset);
951 @@ -2239,7 +2244,7 @@
953 void ext3_set_inode_flags(struct inode *inode)
955 - unsigned int flags = inode->u.ext3_i.i_flags;
956 + unsigned int flags = EXT3_I(inode)->i_flags;
958 inode->i_flags &= ~(S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME);
959 if (flags & EXT3_SYNC_FL)
960 @@ -2257,6 +2262,7 @@
962 struct ext3_iloc iloc;
963 struct ext3_inode *raw_inode;
964 + struct ext3_inode_info *ei = EXT3_I(inode);
965 struct buffer_head *bh;
968 @@ -2264,7 +2270,7 @@
971 raw_inode = iloc.raw_inode;
972 - init_rwsem(&inode->u.ext3_i.truncate_sem);
973 + init_rwsem(&ei->truncate_sem);
974 inode->i_mode = le16_to_cpu(raw_inode->i_mode);
975 inode->i_uid = (uid_t)le16_to_cpu(raw_inode->i_uid_low);
976 inode->i_gid = (gid_t)le16_to_cpu(raw_inode->i_gid_low);
977 @@ -2277,7 +2283,7 @@
978 inode->i_atime = le32_to_cpu(raw_inode->i_atime);
979 inode->i_ctime = le32_to_cpu(raw_inode->i_ctime);
980 inode->i_mtime = le32_to_cpu(raw_inode->i_mtime);
981 - inode->u.ext3_i.i_dtime = le32_to_cpu(raw_inode->i_dtime);
982 + ei->i_dtime = le32_to_cpu(raw_inode->i_dtime);
983 /* We now have enough fields to check if the inode was active or not.
984 * This is needed because nfsd might try to access dead inodes
985 * the test is that same one that e2fsck uses
986 @@ -2285,7 +2291,7 @@
988 if (inode->i_nlink == 0) {
989 if (inode->i_mode == 0 ||
990 - !(inode->i_sb->u.ext3_sb.s_mount_state & EXT3_ORPHAN_FS)) {
991 + !(EXT3_SB(inode->i_sb)->s_mount_state & EXT3_ORPHAN_FS)) {
992 /* this inode is deleted */
995 @@ -2300,33 +2306,33 @@
997 inode->i_blocks = le32_to_cpu(raw_inode->i_blocks);
998 inode->i_version = ++event;
999 - inode->u.ext3_i.i_flags = le32_to_cpu(raw_inode->i_flags);
1000 + ei->i_flags = le32_to_cpu(raw_inode->i_flags);
1001 #ifdef EXT3_FRAGMENTS
1002 - inode->u.ext3_i.i_faddr = le32_to_cpu(raw_inode->i_faddr);
1003 - inode->u.ext3_i.i_frag_no = raw_inode->i_frag;
1004 - inode->u.ext3_i.i_frag_size = raw_inode->i_fsize;
1005 + ei->i_faddr = le32_to_cpu(raw_inode->i_faddr);
1006 + ei->i_frag_no = raw_inode->i_frag;
1007 + ei->i_frag_size = raw_inode->i_fsize;
1009 - inode->u.ext3_i.i_file_acl = le32_to_cpu(raw_inode->i_file_acl);
1010 + ei->i_file_acl = le32_to_cpu(raw_inode->i_file_acl);
1011 if (!S_ISREG(inode->i_mode)) {
1012 - inode->u.ext3_i.i_dir_acl = le32_to_cpu(raw_inode->i_dir_acl);
1013 + ei->i_dir_acl = le32_to_cpu(raw_inode->i_dir_acl);
1016 ((__u64)le32_to_cpu(raw_inode->i_size_high)) << 32;
1018 - inode->u.ext3_i.i_disksize = inode->i_size;
1019 + ei->i_disksize = inode->i_size;
1020 inode->i_generation = le32_to_cpu(raw_inode->i_generation);
1021 #ifdef EXT3_PREALLOCATE
1022 - inode->u.ext3_i.i_prealloc_count = 0;
1023 + ei->i_prealloc_count = 0;
1025 - inode->u.ext3_i.i_block_group = iloc.block_group;
1026 + ei->i_block_group = iloc.block_group;
1029 * NOTE! The in-memory inode i_data array is in little-endian order
1030 * even on big-endian machines: we do NOT byteswap the block numbers!
1032 for (block = 0; block < EXT3_N_BLOCKS; block++)
1033 - inode->u.ext3_i.i_data[block] = iloc.raw_inode->i_block[block];
1034 - INIT_LIST_HEAD(&inode->u.ext3_i.i_orphan);
1035 + ei->i_data[block] = iloc.raw_inode->i_block[block];
1036 + INIT_LIST_HEAD(&ei->i_orphan);
1038 if (S_ISREG(inode->i_mode)) {
1039 inode->i_op = &ext3_file_inode_operations;
1040 @@ -2350,15 +2356,15 @@
1042 ext3_set_inode_flags(inode);
1043 #ifdef CONFIG_EXT3_FS_XATTR
1044 - init_rwsem(&inode->u.ext3_i.xattr_sem);
1045 + init_rwsem(&ei->xattr_sem);
1047 #ifdef CONFIG_EXT3_FS_POSIX_ACL
1048 - if (inode->u.ext3_i.i_file_acl) {
1049 + if (ei->i_file_acl) {
1050 /* The filesystem is mounted with ACL support, and there
1051 are extended attributes for this inode. However we do
1052 not yet know whether there are actually any ACLs. */
1053 - inode->u.ext3_i.i_acl = EXT3_ACL_NOT_CACHED;
1054 - inode->u.ext3_i.i_default_acl = EXT3_ACL_NOT_CACHED;
1055 + ei->i_acl = EXT3_ACL_NOT_CACHED;
1056 + ei->i_default_acl = EXT3_ACL_NOT_CACHED;
1060 @@ -2380,6 +2386,7 @@
1061 struct ext3_iloc *iloc)
1063 struct ext3_inode *raw_inode = iloc->raw_inode;
1064 + struct ext3_inode_info *ei = EXT3_I(inode);
1065 struct buffer_head *bh = iloc->bh;
1066 int err = 0, rc, block;
1068 @@ -2397,7 +2404,7 @@
1069 * Fix up interoperability with old kernels. Otherwise, old inodes get
1070 * re-used with the upper 16 bits of the uid/gid intact
1072 - if(!inode->u.ext3_i.i_dtime) {
1073 + if(!ei->i_dtime) {
1074 raw_inode->i_uid_high =
1075 cpu_to_le16(high_16_bits(inode->i_uid));
1076 raw_inode->i_gid_high =
1077 @@ -2415,34 +2422,33 @@
1078 raw_inode->i_gid_high = 0;
1080 raw_inode->i_links_count = cpu_to_le16(inode->i_nlink);
1081 - raw_inode->i_size = cpu_to_le32(inode->u.ext3_i.i_disksize);
1082 + raw_inode->i_size = cpu_to_le32(ei->i_disksize);
1083 raw_inode->i_atime = cpu_to_le32(inode->i_atime);
1084 raw_inode->i_ctime = cpu_to_le32(inode->i_ctime);
1085 raw_inode->i_mtime = cpu_to_le32(inode->i_mtime);
1086 raw_inode->i_blocks = cpu_to_le32(inode->i_blocks);
1087 - raw_inode->i_dtime = cpu_to_le32(inode->u.ext3_i.i_dtime);
1088 - raw_inode->i_flags = cpu_to_le32(inode->u.ext3_i.i_flags);
1089 + raw_inode->i_dtime = cpu_to_le32(ei->i_dtime);
1090 + raw_inode->i_flags = cpu_to_le32(ei->i_flags);
1091 #ifdef EXT3_FRAGMENTS
1092 - raw_inode->i_faddr = cpu_to_le32(inode->u.ext3_i.i_faddr);
1093 - raw_inode->i_frag = inode->u.ext3_i.i_frag_no;
1094 - raw_inode->i_fsize = inode->u.ext3_i.i_frag_size;
1095 + raw_inode->i_faddr = cpu_to_le32(ei->i_faddr);
1096 + raw_inode->i_frag = ei->i_frag_no;
1097 + raw_inode->i_fsize = ei->i_frag_size;
1099 /* If we are not tracking these fields in the in-memory inode,
1100 * then preserve them on disk, but still initialise them to zero
1101 * for new inodes. */
1102 - if (EXT3_I(inode)->i_state & EXT3_STATE_NEW) {
1103 + if (ei->i_state & EXT3_STATE_NEW) {
1104 raw_inode->i_faddr = 0;
1105 raw_inode->i_frag = 0;
1106 raw_inode->i_fsize = 0;
1109 - raw_inode->i_file_acl = cpu_to_le32(inode->u.ext3_i.i_file_acl);
1110 + raw_inode->i_file_acl = cpu_to_le32(ei->i_file_acl);
1111 if (!S_ISREG(inode->i_mode)) {
1112 - raw_inode->i_dir_acl = cpu_to_le32(inode->u.ext3_i.i_dir_acl);
1113 + raw_inode->i_dir_acl = cpu_to_le32(ei->i_dir_acl);
1115 - raw_inode->i_size_high =
1116 - cpu_to_le32(inode->u.ext3_i.i_disksize >> 32);
1117 - if (inode->u.ext3_i.i_disksize > 0x7fffffffULL) {
1118 + raw_inode->i_size_high = cpu_to_le32(ei->i_disksize >> 32);
1119 + if (ei->i_disksize > MAX_NON_LFS) {
1120 struct super_block *sb = inode->i_sb;
1121 if (!EXT3_HAS_RO_COMPAT_FEATURE(sb,
1122 EXT3_FEATURE_RO_COMPAT_LARGE_FILE) ||
1123 @@ -2452,7 +2458,7 @@
1124 * created, add a flag to the superblock.
1126 err = ext3_journal_get_write_access(handle,
1127 - sb->u.ext3_sb.s_sbh);
1128 + EXT3_SB(sb)->s_sbh);
1131 ext3_update_dynamic_rev(sb);
1132 @@ -2461,7 +2467,7 @@
1135 err = ext3_journal_dirty_metadata(handle,
1136 - sb->u.ext3_sb.s_sbh);
1137 + EXT3_SB(sb)->s_sbh);
1141 @@ -2470,13 +2476,13 @@
1142 raw_inode->i_block[0] =
1143 cpu_to_le32(kdev_t_to_nr(inode->i_rdev));
1144 else for (block = 0; block < EXT3_N_BLOCKS; block++)
1145 - raw_inode->i_block[block] = inode->u.ext3_i.i_data[block];
1146 + raw_inode->i_block[block] = ei->i_data[block];
1148 BUFFER_TRACE(bh, "call ext3_journal_dirty_metadata");
1149 rc = ext3_journal_dirty_metadata(handle, bh);
1152 - EXT3_I(inode)->i_state &= ~EXT3_STATE_NEW;
1153 + ei->i_state &= ~EXT3_STATE_NEW;
1157 @@ -2581,7 +2587,7 @@
1160 error = ext3_orphan_add(handle, inode);
1161 - inode->u.ext3_i.i_disksize = attr->ia_size;
1162 + EXT3_I(inode)->i_disksize = attr->ia_size;
1163 rc = ext3_mark_inode_dirty(handle, inode);
1166 @@ -2843,9 +2849,9 @@
1170 - inode->u.ext3_i.i_flags |= EXT3_JOURNAL_DATA_FL;
1171 + EXT3_I(inode)->i_flags |= EXT3_JOURNAL_DATA_FL;
1173 - inode->u.ext3_i.i_flags &= ~EXT3_JOURNAL_DATA_FL;
1174 + EXT3_I(inode)->i_flags &= ~EXT3_JOURNAL_DATA_FL;
1176 journal_unlock_updates(journal);
1178 Index: linux-2.4.21-chaos/fs/ext3/ioctl.c
1179 ===================================================================
1180 --- linux-2.4.21-chaos.orig/fs/ext3/ioctl.c 2003-09-19 03:49:54.000000000 +0400
1181 +++ linux-2.4.21-chaos/fs/ext3/ioctl.c 2003-12-12 12:50:34.000000000 +0300
1183 int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd,
1186 + struct ext3_inode_info *ei = EXT3_I(inode);
1189 ext3_debug ("cmd = %u, arg = %lu\n", cmd, arg);
1192 case EXT3_IOC_GETFLAGS:
1193 - flags = inode->u.ext3_i.i_flags & EXT3_FL_USER_VISIBLE;
1194 + flags = ei->i_flags & EXT3_FL_USER_VISIBLE;
1195 return put_user(flags, (int *) arg);
1196 case EXT3_IOC_SETFLAGS: {
1197 handle_t *handle = NULL;
1199 if (get_user(flags, (int *) arg))
1202 - oldflags = inode->u.ext3_i.i_flags;
1203 + oldflags = ei->i_flags;
1205 /* The JOURNAL_DATA flag is modifiable only by root */
1206 jflag = flags & EXT3_JOURNAL_DATA_FL;
1209 flags = flags & EXT3_FL_USER_MODIFIABLE;
1210 flags |= oldflags & ~EXT3_FL_USER_MODIFIABLE;
1211 - inode->u.ext3_i.i_flags = flags;
1212 + ei->i_flags = flags;
1214 ext3_set_inode_flags(inode);
1215 inode->i_ctime = CURRENT_TIME;
1216 @@ -138,12 +139,12 @@
1219 set_current_state(TASK_INTERRUPTIBLE);
1220 - add_wait_queue(&sb->u.ext3_sb.ro_wait_queue, &wait);
1221 - if (timer_pending(&sb->u.ext3_sb.turn_ro_timer)) {
1222 + add_wait_queue(&EXT3_SB(sb)->ro_wait_queue, &wait);
1223 + if (timer_pending(&EXT3_SB(sb)->turn_ro_timer)) {
1227 - remove_wait_queue(&sb->u.ext3_sb.ro_wait_queue, &wait);
1228 + remove_wait_queue(&EXT3_SB(sb)->ro_wait_queue, &wait);
1232 Index: linux-2.4.21-chaos/fs/ext3/namei.c
1233 ===================================================================
1234 --- linux-2.4.21-chaos.orig/fs/ext3/namei.c 2003-12-12 11:36:13.000000000 +0300
1235 +++ linux-2.4.21-chaos/fs/ext3/namei.c 2003-12-12 12:56:27.000000000 +0300
1239 hinfo->hash_version = root->info.hash_version;
1240 - hinfo->seed = dir->i_sb->u.ext3_sb.s_hash_seed;
1241 + hinfo->seed = EXT3_SB(dir->i_sb)->s_hash_seed;
1243 ext3fs_dirhash(dentry->d_name.name, dentry->d_name.len, hinfo);
1245 @@ -1236,7 +1236,7 @@
1246 de->rec_len = cpu_to_le16(blocksize - EXT3_DIR_REC_LEN(2));
1247 memset (&root->info, 0, sizeof(root->info));
1248 root->info.info_length = sizeof(root->info);
1249 - root->info.hash_version = dir->i_sb->u.ext3_sb.s_def_hash_version;
1250 + root->info.hash_version = EXT3_SB(dir->i_sb)->s_def_hash_version;
1251 entries = root->entries;
1252 dx_set_block (entries, 1);
1253 dx_set_count (entries, 1);
1254 @@ -1244,7 +1244,7 @@
1256 /* Initialize as for dx_probe */
1257 hinfo.hash_version = root->info.hash_version;
1258 - hinfo.seed = dir->i_sb->u.ext3_sb.s_hash_seed;
1259 + hinfo.seed = EXT3_SB(dir->i_sb)->s_hash_seed;
1260 ext3fs_dirhash(name, namelen, &hinfo);
1262 frame->entries = entries;
1263 @@ -1768,8 +1768,8 @@
1264 J_ASSERT ((S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
1265 S_ISLNK(inode->i_mode)) || inode->i_nlink == 0);
1267 - BUFFER_TRACE(sb->u.ext3_sb.s_sbh, "get_write_access");
1268 - err = ext3_journal_get_write_access(handle, sb->u.ext3_sb.s_sbh);
1269 + BUFFER_TRACE(EXT3_SB(sb)->s_sbh, "get_write_access");
1270 + err = ext3_journal_get_write_access(handle, EXT3_SB(sb)->s_sbh);
1274 @@ -1780,7 +1780,7 @@
1275 /* Insert this inode at the head of the on-disk orphan list... */
1276 NEXT_ORPHAN(inode) = le32_to_cpu(EXT3_SB(sb)->s_es->s_last_orphan);
1277 EXT3_SB(sb)->s_es->s_last_orphan = cpu_to_le32(inode->i_ino);
1278 - err = ext3_journal_dirty_metadata(handle, sb->u.ext3_sb.s_sbh);
1279 + err = ext3_journal_dirty_metadata(handle, EXT3_SB(sb)->s_sbh);
1280 rc = ext3_mark_iloc_dirty(handle, inode, &iloc);
1283 @@ -1854,8 +1854,7 @@
1284 err = ext3_journal_dirty_metadata(handle, sbi->s_sbh);
1286 struct ext3_iloc iloc2;
1287 - struct inode *i_prev =
1288 - list_entry(prev, struct inode, u.ext3_i.i_orphan);
1289 + struct inode *i_prev = orphan_list_entry(prev);
1291 jbd_debug(4, "orphan inode %lu will point to %lu\n",
1292 i_prev->i_ino, ino_next);
1293 Index: linux-2.4.21-chaos/fs/ext3/super.c
1294 ===================================================================
1295 --- linux-2.4.21-chaos.orig/fs/ext3/super.c 2003-12-12 12:14:29.000000000 +0300
1296 +++ linux-2.4.21-chaos/fs/ext3/super.c 2003-12-12 12:50:34.000000000 +0300
1298 /* If no overrides were specified on the mount, then fall back
1299 * to the default behaviour set in the filesystem's superblock
1301 - switch (le16_to_cpu(sb->u.ext3_sb.s_es->s_errors)) {
1302 + switch (le16_to_cpu(EXT3_SB(sb)->s_es->s_errors)) {
1303 case EXT3_ERRORS_PANIC:
1304 return EXT3_ERRORS_PANIC;
1305 case EXT3_ERRORS_RO:
1309 printk (KERN_CRIT "Remounting filesystem read-only\n");
1310 - sb->u.ext3_sb.s_mount_state |= EXT3_ERROR_FS;
1311 + EXT3_SB(sb)->s_mount_state |= EXT3_ERROR_FS;
1312 sb->s_flags |= MS_RDONLY;
1313 - sb->u.ext3_sb.s_mount_opt |= EXT3_MOUNT_ABORT;
1314 + EXT3_SB(sb)->s_mount_opt |= EXT3_MOUNT_ABORT;
1315 journal_abort(EXT3_SB(sb)->s_journal, -EIO);
1322 -#define orphan_list_entry(l) list_entry((l), struct inode, u.ext3_i.i_orphan)
1324 static void dump_orphan_list(struct super_block *sb, struct ext3_sb_info *sbi)
1326 struct list_head *l;
1331 - if (sb->u.ext3_sb.s_mount_state & EXT3_ERROR_FS) {
1332 + if (EXT3_SB(sb)->s_mount_state & EXT3_ERROR_FS) {
1333 if (es->s_last_orphan)
1334 jbd_debug(1, "Errors on filesystem, "
1335 "clearing orphan list.\n");
1336 @@ -1571,12 +1569,14 @@
1337 struct ext3_super_block * es,
1340 + struct buffer_head *sbh = EXT3_SB(sb)->s_sbh;
1342 es->s_wtime = cpu_to_le32(CURRENT_TIME);
1343 - BUFFER_TRACE(sb->u.ext3_sb.s_sbh, "marking dirty");
1344 - mark_buffer_dirty(sb->u.ext3_sb.s_sbh);
1345 + BUFFER_TRACE(sbh, "marking dirty");
1346 + mark_buffer_dirty(sbh);
1348 - ll_rw_block(WRITE, 1, &sb->u.ext3_sb.s_sbh);
1349 - wait_on_buffer(sb->u.ext3_sb.s_sbh);
1350 + ll_rw_block(WRITE, 1, &sbh);
1351 + wait_on_buffer(sbh);
1355 @@ -1627,7 +1627,7 @@
1356 ext3_warning(sb, __FUNCTION__, "Marking fs in need of "
1357 "filesystem check.");
1359 - sb->u.ext3_sb.s_mount_state |= EXT3_ERROR_FS;
1360 + EXT3_SB(sb)->s_mount_state |= EXT3_ERROR_FS;
1361 es->s_state |= cpu_to_le16(EXT3_ERROR_FS);
1362 ext3_commit_super (sb, es, 1);
1364 Index: linux-2.4.21-chaos/fs/ext3/symlink.c
1365 ===================================================================
1366 --- linux-2.4.21-chaos.orig/fs/ext3/symlink.c 2003-07-15 04:41:01.000000000 +0400
1367 +++ linux-2.4.21-chaos/fs/ext3/symlink.c 2003-12-12 12:50:34.000000000 +0300
1370 static int ext3_readlink(struct dentry *dentry, char *buffer, int buflen)
1372 - char *s = (char *)dentry->d_inode->u.ext3_i.i_data;
1373 - return vfs_readlink(dentry, buffer, buflen, s);
1374 + struct ext3_inode_info *ei = EXT3_I(dentry->d_inode);
1375 + return vfs_readlink(dentry, buffer, buflen, (char *)ei->i_data);
1378 static int ext3_follow_link(struct dentry *dentry, struct nameidata *nd)
1380 - char *s = (char *)dentry->d_inode->u.ext3_i.i_data;
1381 - return vfs_follow_link(nd, s);
1382 + struct ext3_inode_info *ei = EXT3_I(dentry->d_inode);
1383 + return vfs_follow_link(nd, (char*)ei->i_data);
1386 struct inode_operations ext3_symlink_inode_operations = {
1387 Index: linux-2.4.21-chaos/include/linux/ext3_fs.h
1388 ===================================================================
1389 --- linux-2.4.21-chaos.orig/include/linux/ext3_fs.h 2003-12-12 11:36:14.000000000 +0300
1390 +++ linux-2.4.21-chaos/include/linux/ext3_fs.h 2003-12-12 12:50:34.000000000 +0300
1392 #define EXT3_MIN_BLOCK_SIZE 1024
1393 #define EXT3_MAX_BLOCK_SIZE 4096
1394 #define EXT3_MIN_BLOCK_LOG_SIZE 10
1397 -# define EXT3_BLOCK_SIZE(s) ((s)->s_blocksize)
1399 -# define EXT3_BLOCK_SIZE(s) (EXT3_MIN_BLOCK_SIZE << (s)->s_log_block_size)
1401 -#define EXT3_ADDR_PER_BLOCK(s) (EXT3_BLOCK_SIZE(s) / sizeof (__u32))
1403 -# define EXT3_BLOCK_SIZE_BITS(s) ((s)->s_blocksize_bits)
1405 -# define EXT3_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10)
1408 -#define EXT3_ADDR_PER_BLOCK_BITS(s) ((s)->u.ext3_sb.s_addr_per_block_bits)
1409 -#define EXT3_INODE_SIZE(s) ((s)->u.ext3_sb.s_inode_size)
1410 -#define EXT3_FIRST_INO(s) ((s)->u.ext3_sb.s_first_ino)
1411 +#define EXT3_SB(sb) (&((sb)->u.ext3_sb))
1412 +#define EXT3_I(inode) (&((inode)->u.ext3_i))
1414 +#define EXT3_BLOCK_SIZE(s) ((s)->s_blocksize)
1415 +#define EXT3_BLOCK_SIZE_BITS(s) ((s)->s_blocksize_bits)
1416 +#define EXT3_ADDR_PER_BLOCK_BITS(s) (EXT3_SB(s)->s_addr_per_block_bits)
1417 +#define EXT3_INODE_SIZE(s) (EXT3_SB(s)->s_inode_size)
1418 +#define EXT3_FIRST_INO(s) (EXT3_SB(s)->s_first_ino)
1421 +/* Assume that user mode programs are passing in an ext3fs superblock, not
1422 + * a kernel struct super_block. This will allow us to call the feature-test
1423 + * macros from user land. */
1424 +#define EXT3_SB(sb) (sb)
1426 +#define EXT3_BLOCK_SIZE(s) (EXT3_MIN_BLOCK_SIZE << (s)->s_log_block_size)
1427 +#define EXT3_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10)
1428 #define EXT3_INODE_SIZE(s) (((s)->s_rev_level == EXT3_GOOD_OLD_REV) ? \
1429 EXT3_GOOD_OLD_INODE_SIZE : \
1432 EXT3_GOOD_OLD_FIRST_INO : \
1435 +#define EXT3_ADDR_PER_BLOCK(s) (EXT3_BLOCK_SIZE(s) / sizeof (__u32))
1438 * Macro-instructions used to manage fragments
1440 #define EXT3_MAX_FRAG_SIZE 4096
1441 #define EXT3_MIN_FRAG_LOG_SIZE 10
1443 -# define EXT3_FRAG_SIZE(s) ((s)->u.ext3_sb.s_frag_size)
1444 -# define EXT3_FRAGS_PER_BLOCK(s) ((s)->u.ext3_sb.s_frags_per_block)
1445 +# define EXT3_FRAG_SIZE(s) (EXT3_SB(s)->s_frag_size)
1446 +# define EXT3_FRAGS_PER_BLOCK(s) (EXT3_SB(s)->s_frags_per_block)
1448 # define EXT3_FRAG_SIZE(s) (EXT3_MIN_FRAG_SIZE << (s)->s_log_frag_size)
1449 # define EXT3_FRAGS_PER_BLOCK(s) (EXT3_BLOCK_SIZE(s) / EXT3_FRAG_SIZE(s))
1450 @@ -143,15 +147,13 @@
1452 * Macro-instructions used to manage group descriptors
1454 +# define EXT3_BLOCKS_PER_GROUP(s) (EXT3_SB(s)->s_blocks_per_group)
1455 +# define EXT3_INODES_PER_GROUP(s) (EXT3_SB(s)->s_inodes_per_group)
1457 -# define EXT3_BLOCKS_PER_GROUP(s) ((s)->u.ext3_sb.s_blocks_per_group)
1458 -# define EXT3_DESC_PER_BLOCK(s) ((s)->u.ext3_sb.s_desc_per_block)
1459 -# define EXT3_INODES_PER_GROUP(s) ((s)->u.ext3_sb.s_inodes_per_group)
1460 -# define EXT3_DESC_PER_BLOCK_BITS(s) ((s)->u.ext3_sb.s_desc_per_block_bits)
1461 +# define EXT3_DESC_PER_BLOCK(s) (EXT3_SB(s)->s_desc_per_block)
1462 +# define EXT3_DESC_PER_BLOCK_BITS(s) (EXT3_SB(s)->s_desc_per_block_bits)
1464 -# define EXT3_BLOCKS_PER_GROUP(s) ((s)->s_blocks_per_group)
1465 # define EXT3_DESC_PER_BLOCK(s) (EXT3_BLOCK_SIZE(s) / sizeof (struct ext3_group_desc))
1466 -# define EXT3_INODES_PER_GROUP(s) ((s)->s_inodes_per_group)
1471 #ifndef _LINUX_EXT2_FS_H
1472 #define clear_opt(o, opt) o &= ~EXT3_MOUNT_##opt
1473 #define set_opt(o, opt) o |= EXT3_MOUNT_##opt
1474 -#define test_opt(sb, opt) ((sb)->u.ext3_sb.s_mount_opt & \
1475 +#define test_opt(sb, opt) (EXT3_SB(sb)->s_mount_opt & \
1478 #define EXT2_MOUNT_NOLOAD EXT3_MOUNT_NOLOAD
1479 @@ -427,17 +429,11 @@
1480 __u32 s_reserved[192]; /* Padding to the end of the block */
1484 -#define EXT3_SB(sb) (&((sb)->u.ext3_sb))
1485 -#define EXT3_I(inode) (&((inode)->u.ext3_i))
1487 -/* Assume that user mode programs are passing in an ext3fs superblock, not
1488 - * a kernel struct super_block. This will allow us to call the feature-test
1489 - * macros from user land. */
1490 -#define EXT3_SB(sb) (sb)
1493 -#define NEXT_ORPHAN(inode) (inode)->u.ext3_i.i_dtime
1494 +#define NEXT_ORPHAN(inode) EXT3_I(inode)->i_dtime
1495 +static inline struct inode *orphan_list_entry(struct list_head *l)
1497 + return list_entry(l, struct inode, u.ext3_i.i_orphan);
1501 * Codes for operating systems
1502 Index: linux-2.4.21-chaos/include/linux/ext3_jbd.h
1503 ===================================================================
1504 --- linux-2.4.21-chaos.orig/include/linux/ext3_jbd.h 2003-12-12 11:36:14.000000000 +0300
1505 +++ linux-2.4.21-chaos/include/linux/ext3_jbd.h 2003-12-12 12:50:34.000000000 +0300
1508 if (test_opt(inode->i_sb, DATA_FLAGS) == EXT3_MOUNT_JOURNAL_DATA)
1510 - if (inode->u.ext3_i.i_flags & EXT3_JOURNAL_DATA_FL)
1511 + if (EXT3_I(inode)->i_flags & EXT3_JOURNAL_DATA_FL)