1 fs/ext3/balloc.c | 134 +-
3 fs/ext3/ialloc.c | 102 -
4 fs/ext3/inode.c | 202 +--
9 include/linux/ext3_fs.h | 64
10 include/linux/ext3_jbd.h | 2
11 19 files changed, 5574 insertions(+), 290 deletions(-)
13 --- linux-2.4.18-chaos/fs/ext3/balloc.c~ext3-2.4.18-ino_sb_macro-2 2003-07-28 17:52:04.000000000 +0400
14 +++ linux-2.4.18-chaos-alexey/fs/ext3/balloc.c 2003-09-16 23:34:40.000000000 +0400
15 @@ -46,18 +46,18 @@ struct ext3_group_desc * ext3_get_group_
17 struct ext3_group_desc * gdp;
19 - if (block_group >= sb->u.ext3_sb.s_groups_count) {
20 + if (block_group >= EXT3_SB(sb)->s_groups_count) {
21 ext3_error (sb, "ext3_get_group_desc",
22 "block_group >= groups_count - "
23 "block_group = %d, groups_count = %lu",
24 - block_group, sb->u.ext3_sb.s_groups_count);
25 + block_group, EXT3_SB(sb)->s_groups_count);
30 group_desc = block_group / EXT3_DESC_PER_BLOCK(sb);
31 desc = block_group % EXT3_DESC_PER_BLOCK(sb);
32 - if (!sb->u.ext3_sb.s_group_desc[group_desc]) {
33 + if (!EXT3_SB(sb)->s_group_desc[group_desc]) {
34 ext3_error (sb, "ext3_get_group_desc",
35 "Group descriptor not loaded - "
36 "block_group = %d, group_desc = %lu, desc = %lu",
37 @@ -66,9 +66,9 @@ struct ext3_group_desc * ext3_get_group_
40 gdp = (struct ext3_group_desc *)
41 - sb->u.ext3_sb.s_group_desc[group_desc]->b_data;
42 + EXT3_SB(sb)->s_group_desc[group_desc]->b_data;
44 - *bh = sb->u.ext3_sb.s_group_desc[group_desc];
45 + *bh = EXT3_SB(sb)->s_group_desc[group_desc];
49 @@ -104,8 +104,8 @@ static int read_block_bitmap (struct sup
50 * this group. The IO will be retried next time.
53 - sb->u.ext3_sb.s_block_bitmap_number[bitmap_nr] = block_group;
54 - sb->u.ext3_sb.s_block_bitmap[bitmap_nr] = bh;
55 + EXT3_SB(sb)->s_block_bitmap_number[bitmap_nr] = block_group;
56 + EXT3_SB(sb)->s_block_bitmap[bitmap_nr] = bh;
60 @@ -128,16 +128,17 @@ static int __load_block_bitmap (struct s
62 unsigned long block_bitmap_number;
63 struct buffer_head * block_bitmap;
64 + struct ext3_sb_info *sbi = EXT3_SB(sb);
66 - if (block_group >= sb->u.ext3_sb.s_groups_count)
67 + if (block_group >= sbi->s_groups_count)
68 ext3_panic (sb, "load_block_bitmap",
69 "block_group >= groups_count - "
70 "block_group = %d, groups_count = %lu",
71 - block_group, sb->u.ext3_sb.s_groups_count);
72 + block_group, EXT3_SB(sb)->s_groups_count);
74 - if (sb->u.ext3_sb.s_groups_count <= EXT3_MAX_GROUP_LOADED) {
75 - if (sb->u.ext3_sb.s_block_bitmap[block_group]) {
76 - if (sb->u.ext3_sb.s_block_bitmap_number[block_group] ==
77 + if (sbi->s_groups_count <= EXT3_MAX_GROUP_LOADED) {
78 + if (sbi->s_block_bitmap[block_group]) {
79 + if (sbi->s_block_bitmap_number[block_group] ==
82 ext3_error (sb, "__load_block_bitmap",
83 @@ -149,21 +150,20 @@ static int __load_block_bitmap (struct s
87 - for (i = 0; i < sb->u.ext3_sb.s_loaded_block_bitmaps &&
88 - sb->u.ext3_sb.s_block_bitmap_number[i] != block_group; i++)
89 + for (i = 0; i < sbi->s_loaded_block_bitmaps &&
90 + sbi->s_block_bitmap_number[i] != block_group; i++)
92 - if (i < sb->u.ext3_sb.s_loaded_block_bitmaps &&
93 - sb->u.ext3_sb.s_block_bitmap_number[i] == block_group) {
94 - block_bitmap_number = sb->u.ext3_sb.s_block_bitmap_number[i];
95 - block_bitmap = sb->u.ext3_sb.s_block_bitmap[i];
96 + if (i < sbi->s_loaded_block_bitmaps &&
97 + sbi->s_block_bitmap_number[i] == block_group) {
98 + block_bitmap_number = sbi->s_block_bitmap_number[i];
99 + block_bitmap = sbi->s_block_bitmap[i];
100 for (j = i; j > 0; j--) {
101 - sb->u.ext3_sb.s_block_bitmap_number[j] =
102 - sb->u.ext3_sb.s_block_bitmap_number[j - 1];
103 - sb->u.ext3_sb.s_block_bitmap[j] =
104 - sb->u.ext3_sb.s_block_bitmap[j - 1];
105 + sbi->s_block_bitmap_number[j] =
106 + sbi->s_block_bitmap_number[j - 1];
107 + sbi->s_block_bitmap[j] = sbi->s_block_bitmap[j - 1];
109 - sb->u.ext3_sb.s_block_bitmap_number[0] = block_bitmap_number;
110 - sb->u.ext3_sb.s_block_bitmap[0] = block_bitmap;
111 + sbi->s_block_bitmap_number[0] = block_bitmap_number;
112 + sbi->s_block_bitmap[0] = block_bitmap;
115 * There's still one special case here --- if block_bitmap == 0
116 @@ -173,17 +173,14 @@ static int __load_block_bitmap (struct s
118 retval = read_block_bitmap (sb, block_group, 0);
120 - if (sb->u.ext3_sb.s_loaded_block_bitmaps<EXT3_MAX_GROUP_LOADED)
121 - sb->u.ext3_sb.s_loaded_block_bitmaps++;
122 + if (sbi->s_loaded_block_bitmaps<EXT3_MAX_GROUP_LOADED)
123 + sbi->s_loaded_block_bitmaps++;
125 - brelse (sb->u.ext3_sb.s_block_bitmap
126 - [EXT3_MAX_GROUP_LOADED - 1]);
127 - for (j = sb->u.ext3_sb.s_loaded_block_bitmaps - 1;
129 - sb->u.ext3_sb.s_block_bitmap_number[j] =
130 - sb->u.ext3_sb.s_block_bitmap_number[j - 1];
131 - sb->u.ext3_sb.s_block_bitmap[j] =
132 - sb->u.ext3_sb.s_block_bitmap[j - 1];
133 + brelse(sbi->s_block_bitmap[EXT3_MAX_GROUP_LOADED - 1]);
134 + for (j = sbi->s_loaded_block_bitmaps - 1; j > 0; j--) {
135 + sbi->s_block_bitmap_number[j] =
136 + sbi->s_block_bitmap_number[j - 1];
137 + sbi->s_block_bitmap[j] = sbi->s_block_bitmap[j - 1];
139 retval = read_block_bitmap (sb, block_group, 0);
141 @@ -206,24 +203,25 @@ static int __load_block_bitmap (struct s
142 static inline int load_block_bitmap (struct super_block * sb,
143 unsigned int block_group)
145 + struct ext3_sb_info *sbi = EXT3_SB(sb);
150 * Do the lookup for the slot. First of all, check if we're asking
151 * for the same slot as last time, and did we succeed that last time?
153 - if (sb->u.ext3_sb.s_loaded_block_bitmaps > 0 &&
154 - sb->u.ext3_sb.s_block_bitmap_number[0] == block_group &&
155 - sb->u.ext3_sb.s_block_bitmap[0]) {
156 + if (sbi->s_loaded_block_bitmaps > 0 &&
157 + sbi->s_block_bitmap_number[0] == block_group &&
158 + sbi->s_block_bitmap[0]) {
162 * Or can we do a fast lookup based on a loaded group on a filesystem
163 * small enough to be mapped directly into the superblock?
165 - else if (sb->u.ext3_sb.s_groups_count <= EXT3_MAX_GROUP_LOADED &&
166 - sb->u.ext3_sb.s_block_bitmap_number[block_group]==block_group
167 - && sb->u.ext3_sb.s_block_bitmap[block_group]) {
168 + else if (sbi->s_groups_count <= EXT3_MAX_GROUP_LOADED &&
169 + sbi->s_block_bitmap_number[block_group] == block_group
170 + && sbi->s_block_bitmap[block_group]) {
174 @@ -243,7 +241,7 @@ static inline int load_block_bitmap (str
175 * If it's a valid slot, we may still have cached a previous IO error,
176 * in which case the bh in the superblock cache will be zero.
178 - if (!sb->u.ext3_sb.s_block_bitmap[slot])
179 + if (!sbi->s_block_bitmap[slot])
183 @@ -275,7 +273,7 @@ void ext3_free_blocks (handle_t *handle,
187 - es = sb->u.ext3_sb.s_es;
188 + es = EXT3_SB(sb)->s_es;
189 if (block < le32_to_cpu(es->s_first_data_block) ||
190 block + count < block ||
191 (block + count) > le32_to_cpu(es->s_blocks_count)) {
192 @@ -305,7 +303,7 @@ do_more:
196 - bitmap_bh = sb->u.ext3_sb.s_block_bitmap[bitmap_nr];
197 + bitmap_bh = EXT3_SB(sb)->s_block_bitmap[bitmap_nr];
198 gdp = ext3_get_group_desc (sb, block_group, &gd_bh);
201 @@ -330,8 +328,8 @@ do_more:
205 - BUFFER_TRACE(sb->u.ext3_sb.s_sbh, "get_write_access");
206 - err = ext3_journal_get_write_access(handle, sb->u.ext3_sb.s_sbh);
207 + BUFFER_TRACE(EXT3_SB(sb)->s_sbh, "get_write_access");
208 + err = ext3_journal_get_write_access(handle, EXT3_SB(sb)->s_sbh);
212 @@ -339,7 +337,7 @@ do_more:
213 if (block == le32_to_cpu(gdp->bg_block_bitmap) ||
214 block == le32_to_cpu(gdp->bg_inode_bitmap) ||
215 in_range(block, le32_to_cpu(gdp->bg_inode_table),
216 - sb->u.ext2_sb.s_itb_per_group)) {
217 + EXT3_SB(sb)->s_itb_per_group)) {
218 ext3_error(sb, __FUNCTION__,
219 "Freeing block in system zone - block = %lu",
221 @@ -412,8 +410,8 @@ do_more:
224 /* And the superblock */
225 - BUFFER_TRACE(sb->u.ext3_sb.s_sbh, "dirtied superblock");
226 - ret = ext3_journal_dirty_metadata(handle, sb->u.ext3_sb.s_sbh);
227 + BUFFER_TRACE(EXT3_SB(sb)->s_sbh, "dirtied superblock");
228 + ret = ext3_journal_dirty_metadata(handle, EXT3_SB(sb)->s_sbh);
231 if (overflow && !err) {
232 @@ -566,12 +564,12 @@ int ext3_new_block (handle_t *handle, st
236 - es = sb->u.ext3_sb.s_es;
237 + es = EXT3_SB(sb)->s_es;
238 if (le32_to_cpu(es->s_free_blocks_count) <=
239 le32_to_cpu(es->s_r_blocks_count) &&
240 - ((sb->u.ext3_sb.s_resuid != current->fsuid) &&
241 - (sb->u.ext3_sb.s_resgid == 0 ||
242 - !in_group_p (sb->u.ext3_sb.s_resgid)) &&
243 + ((EXT3_SB(sb)->s_resuid != current->fsuid) &&
244 + (EXT3_SB(sb)->s_resgid == 0 ||
245 + !in_group_p (EXT3_SB(sb)->s_resgid)) &&
246 !capable(CAP_SYS_RESOURCE)))
249 @@ -601,7 +599,7 @@ repeat:
253 - bh = sb->u.ext3_sb.s_block_bitmap[bitmap_nr];
254 + bh = EXT3_SB(sb)->s_block_bitmap[bitmap_nr];
256 ext3_debug ("goal is at %d:%d.\n", i, j);
258 @@ -624,9 +622,9 @@ repeat:
259 * Now search the rest of the groups. We assume that
260 * i and gdp correctly point to the last group visited.
262 - for (k = 0; k < sb->u.ext3_sb.s_groups_count; k++) {
263 + for (k = 0; k < EXT3_SB(sb)->s_groups_count; k++) {
265 - if (i >= sb->u.ext3_sb.s_groups_count)
266 + if (i >= EXT3_SB(sb)->s_groups_count)
268 gdp = ext3_get_group_desc (sb, i, &bh2);
270 @@ -638,7 +636,7 @@ repeat:
274 - bh = sb->u.ext3_sb.s_block_bitmap[bitmap_nr];
275 + bh = EXT3_SB(sb)->s_block_bitmap[bitmap_nr];
276 j = find_next_usable_block(-1, bh,
277 EXT3_BLOCKS_PER_GROUP(sb));
279 @@ -676,8 +674,8 @@ got_block:
280 fatal = ext3_journal_get_write_access(handle, bh2);
283 - BUFFER_TRACE(sb->u.ext3_sb.s_sbh, "get_write_access");
284 - fatal = ext3_journal_get_write_access(handle, sb->u.ext3_sb.s_sbh);
285 + BUFFER_TRACE(EXT3_SB(sb)->s_sbh, "get_write_access");
286 + fatal = ext3_journal_get_write_access(handle, EXT3_SB(sb)->s_sbh);
289 tmp = j + i * EXT3_BLOCKS_PER_GROUP(sb)
290 @@ -810,7 +808,7 @@ got_block:
291 if (!fatal) fatal = err;
293 BUFFER_TRACE(bh, "journal_dirty_metadata for superblock");
294 - err = ext3_journal_dirty_metadata(handle, sb->u.ext3_sb.s_sbh);
295 + err = ext3_journal_dirty_metadata(handle, EXT3_SB(sb)->s_sbh);
296 if (!fatal) fatal = err;
299 @@ -848,11 +846,11 @@ unsigned long ext3_count_free_blocks (st
303 - es = sb->u.ext3_sb.s_es;
304 + es = EXT3_SB(sb)->s_es;
308 - for (i = 0; i < sb->u.ext3_sb.s_groups_count; i++) {
309 + for (i = 0; i < EXT3_SB(sb)->s_groups_count; i++) {
310 gdp = ext3_get_group_desc (sb, i, NULL);
313 @@ -861,7 +859,7 @@ unsigned long ext3_count_free_blocks (st
317 - x = ext3_count_free (sb->u.ext3_sb.s_block_bitmap[bitmap_nr],
318 + x = ext3_count_free (EXT3_SB(sb)->s_block_bitmap[bitmap_nr],
320 printk ("group %d: stored = %d, counted = %lu\n",
321 i, le16_to_cpu(gdp->bg_free_blocks_count), x);
322 @@ -872,7 +870,7 @@ unsigned long ext3_count_free_blocks (st
326 - return le32_to_cpu(sb->u.ext3_sb.s_es->s_free_blocks_count);
327 + return le32_to_cpu(EXT3_SB(sb)->s_es->s_free_blocks_count);
331 @@ -881,7 +879,7 @@ static inline int block_in_use (unsigned
334 return ext3_test_bit ((block -
335 - le32_to_cpu(sb->u.ext3_sb.s_es->s_first_data_block)) %
336 + le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block)) %
337 EXT3_BLOCKS_PER_GROUP(sb), map);
340 @@ -949,11 +947,11 @@ void ext3_check_blocks_bitmap (struct su
341 struct ext3_group_desc * gdp;
344 - es = sb->u.ext3_sb.s_es;
345 + es = EXT3_SB(sb)->s_es;
349 - for (i = 0; i < sb->u.ext3_sb.s_groups_count; i++) {
350 + for (i = 0; i < EXT3_SB(sb)->s_groups_count; i++) {
351 gdp = ext3_get_group_desc (sb, i, NULL);
354 @@ -987,7 +985,7 @@ void ext3_check_blocks_bitmap (struct su
355 "Inode bitmap for group %d is marked free",
358 - for (j = 0; j < sb->u.ext3_sb.s_itb_per_group; j++)
359 + for (j = 0; j < EXT3_SB(sb)->s_itb_per_group; j++)
360 if (!block_in_use (le32_to_cpu(gdp->bg_inode_table) + j,
362 ext3_error (sb, "ext3_check_blocks_bitmap",
363 --- linux-2.4.18-chaos/fs/ext3/dir.c~ext3-2.4.18-ino_sb_macro-2 2003-09-16 23:34:14.000000000 +0400
364 +++ linux-2.4.18-chaos-alexey/fs/ext3/dir.c 2003-09-16 23:34:40.000000000 +0400
365 @@ -67,7 +67,7 @@ int ext3_check_dir_entry (const char * f
366 else if (((char *) de - bh->b_data) + rlen > dir->i_sb->s_blocksize)
367 error_msg = "directory entry across blocks";
368 else if (le32_to_cpu(de->inode) >
369 - le32_to_cpu(dir->i_sb->u.ext3_sb.s_es->s_inodes_count))
370 + le32_to_cpu(EXT3_SB(dir->i_sb)->s_es->s_inodes_count))
371 error_msg = "inode out of bounds";
373 if (error_msg != NULL)
374 --- linux-2.4.18-chaos/fs/ext3/ialloc.c~ext3-2.4.18-ino_sb_macro-2 2003-09-16 23:34:33.000000000 +0400
375 +++ linux-2.4.18-chaos-alexey/fs/ext3/ialloc.c 2003-09-16 23:34:40.000000000 +0400
376 @@ -74,8 +74,8 @@ static int read_inode_bitmap (struct sup
377 * this group. The IO will be retried next time.
380 - sb->u.ext3_sb.s_inode_bitmap_number[bitmap_nr] = block_group;
381 - sb->u.ext3_sb.s_inode_bitmap[bitmap_nr] = bh;
382 + EXT3_SB(sb)->s_inode_bitmap_number[bitmap_nr] = block_group;
383 + EXT3_SB(sb)->s_inode_bitmap[bitmap_nr] = bh;
387 @@ -227,7 +227,7 @@ void ext3_free_inode (handle_t *handle,
391 - es = sb->u.ext3_sb.s_es;
392 + es = EXT3_SB(sb)->s_es;
393 if (ino < EXT3_FIRST_INO(sb) || ino > le32_to_cpu(es->s_inodes_count)) {
394 ext3_error (sb, "ext3_free_inode",
395 "reserved or nonexistent inode %lu", ino);
396 @@ -239,7 +239,7 @@ void ext3_free_inode (handle_t *handle,
400 - bh = sb->u.ext3_sb.s_inode_bitmap[bitmap_nr];
401 + bh = EXT3_SB(sb)->s_inode_bitmap[bitmap_nr];
403 BUFFER_TRACE(bh, "get_write_access");
404 fatal = ext3_journal_get_write_access(handle, bh);
405 @@ -257,8 +257,8 @@ void ext3_free_inode (handle_t *handle,
406 fatal = ext3_journal_get_write_access(handle, bh2);
407 if (fatal) goto error_return;
409 - BUFFER_TRACE(sb->u.ext3_sb.s_sbh, "get write access");
410 - fatal = ext3_journal_get_write_access(handle, sb->u.ext3_sb.s_sbh);
411 + BUFFER_TRACE(EXT3_SB(sb)->s_sbh, "get write access");
412 + fatal = ext3_journal_get_write_access(handle, EXT3_SB(sb)->s_sbh);
413 if (fatal) goto error_return;
416 @@ -273,9 +273,9 @@ void ext3_free_inode (handle_t *handle,
417 if (!fatal) fatal = err;
418 es->s_free_inodes_count =
419 cpu_to_le32(le32_to_cpu(es->s_free_inodes_count) + 1);
420 - BUFFER_TRACE(sb->u.ext3_sb.s_sbh,
421 + BUFFER_TRACE(EXT3_SB(sb)->s_sbh,
422 "call ext3_journal_dirty_metadata");
423 - err = ext3_journal_dirty_metadata(handle, sb->u.ext3_sb.s_sbh);
424 + err = ext3_journal_dirty_metadata(handle, EXT3_SB(sb)->s_sbh);
425 if (!fatal) fatal = err;
427 BUFFER_TRACE(bh, "call ext3_journal_dirty_metadata");
428 @@ -307,6 +307,8 @@ struct inode * ext3_new_inode (handle_t
430 struct inode * inode;
432 + struct ext3_inode_info *ei;
433 + struct ext3_sb_info *sbi;
434 struct ext3_group_desc * gdp;
435 struct ext3_group_desc * tmp;
436 struct ext3_super_block * es;
437 @@ -320,7 +322,9 @@ struct inode * ext3_new_inode (handle_t
438 inode = new_inode(sb);
440 return ERR_PTR(-ENOMEM);
441 - init_rwsem(&inode->u.ext3_i.truncate_sem);
443 + ei = EXT3_I(inode);
444 + init_rwsem(&ei->truncate_sem);
447 es = sb->u.ext3_sb.s_es;
448 @@ -330,9 +334,9 @@ repeat:
451 avefreei = le32_to_cpu(es->s_free_inodes_count) /
452 - sb->u.ext3_sb.s_groups_count;
453 + sbi->s_groups_count;
455 - for (j = 0; j < sb->u.ext3_sb.s_groups_count; j++) {
456 + for (j = 0; j < sbi->s_groups_count; j++) {
457 struct buffer_head *temp_buffer;
458 tmp = ext3_get_group_desc (sb, j, &temp_buffer);
460 @@ -352,7 +356,7 @@ repeat:
462 * Try to place the inode in its parent directory
464 - i = dir->u.ext3_i.i_block_group;
465 + i = EXT3_I(dir)->i_block_group;
466 tmp = ext3_get_group_desc (sb, i, &bh2);
467 if (tmp && le16_to_cpu(tmp->bg_free_inodes_count))
469 @@ -362,10 +366,10 @@ repeat:
470 * Use a quadratic hash to find a group with a
473 - for (j = 1; j < sb->u.ext3_sb.s_groups_count; j <<= 1) {
474 + for (j = 1; j < sbi->s_groups_count; j <<= 1) {
476 - if (i >= sb->u.ext3_sb.s_groups_count)
477 - i -= sb->u.ext3_sb.s_groups_count;
478 + if (i >= sbi->s_groups_count)
479 + i -= sbi->s_groups_count;
480 tmp = ext3_get_group_desc (sb, i, &bh2);
482 le16_to_cpu(tmp->bg_free_inodes_count)) {
483 @@ -378,9 +382,9 @@ repeat:
485 * That failed: try linear search for a free inode
487 - i = dir->u.ext3_i.i_block_group + 1;
488 - for (j = 2; j < sb->u.ext3_sb.s_groups_count; j++) {
489 - if (++i >= sb->u.ext3_sb.s_groups_count)
490 + i = EXT3_I(dir)->i_block_group + 1;
491 + for (j = 2; j < sbi->s_groups_count; j++) {
492 + if (++i >= sbi->s_groups_count)
494 tmp = ext3_get_group_desc (sb, i, &bh2);
496 @@ -401,11 +405,11 @@ repeat:
500 - bh = sb->u.ext3_sb.s_inode_bitmap[bitmap_nr];
501 + bh = sbi->s_inode_bitmap[bitmap_nr];
503 if ((j = ext3_find_first_zero_bit ((unsigned long *) bh->b_data,
504 - EXT3_INODES_PER_GROUP(sb))) <
505 - EXT3_INODES_PER_GROUP(sb)) {
506 + sbi->s_inodes_per_group)) <
507 + sbi->s_inodes_per_group) {
508 BUFFER_TRACE(bh, "get_write_access");
509 err = ext3_journal_get_write_access(handle, bh);
511 @@ -459,13 +463,13 @@ repeat:
512 err = ext3_journal_dirty_metadata(handle, bh2);
515 - BUFFER_TRACE(sb->u.ext3_sb.s_sbh, "get_write_access");
516 - err = ext3_journal_get_write_access(handle, sb->u.ext3_sb.s_sbh);
517 + BUFFER_TRACE(sbi->s_sbh, "get_write_access");
518 + err = ext3_journal_get_write_access(handle, sbi->s_sbh);
520 es->s_free_inodes_count =
521 cpu_to_le32(le32_to_cpu(es->s_free_inodes_count) - 1);
522 - BUFFER_TRACE(sb->u.ext3_sb.s_sbh, "call ext3_journal_dirty_metadata");
523 - err = ext3_journal_dirty_metadata(handle, sb->u.ext3_sb.s_sbh);
524 + BUFFER_TRACE(sbi->s_sbh, "call ext3_journal_dirty_metadata");
525 + err = ext3_journal_dirty_metadata(handle, sbi->s_sbh);
529 @@ -485,31 +489,31 @@ repeat:
530 inode->i_blksize = PAGE_SIZE;
532 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
533 - inode->u.ext3_i.i_flags = dir->u.ext3_i.i_flags & ~EXT3_INDEX_FL;
534 + ei->i_flags = EXT3_I(dir)->i_flags & ~EXT3_INDEX_FL;
536 - inode->u.ext3_i.i_flags &= ~(EXT3_IMMUTABLE_FL|EXT3_APPEND_FL);
537 + ei->i_flags &= ~(EXT3_IMMUTABLE_FL|EXT3_APPEND_FL);
538 #ifdef EXT3_FRAGMENTS
539 - inode->u.ext3_i.i_faddr = 0;
540 - inode->u.ext3_i.i_frag_no = 0;
541 - inode->u.ext3_i.i_frag_size = 0;
544 + ei->i_frag_size = 0;
546 - inode->u.ext3_i.i_file_acl = 0;
547 - inode->u.ext3_i.i_dir_acl = 0;
548 - inode->u.ext3_i.i_dtime = 0;
549 - INIT_LIST_HEAD(&inode->u.ext3_i.i_orphan);
550 + ei->i_file_acl = 0;
553 + INIT_LIST_HEAD(&ei->i_orphan);
554 #ifdef EXT3_PREALLOCATE
555 - inode->u.ext3_i.i_prealloc_count = 0;
556 + ei->i_prealloc_count = 0;
558 - inode->u.ext3_i.i_block_group = i;
559 + ei->i_block_group = i;
561 - if (inode->u.ext3_i.i_flags & EXT3_SYNC_FL)
562 + if (ei->i_flags & EXT3_SYNC_FL)
563 inode->i_flags |= S_SYNC;
566 insert_inode_hash(inode);
567 - inode->i_generation = sb->u.ext3_sb.s_next_generation++;
568 + inode->i_generation = sbi->s_next_generation++;
570 - inode->u.ext3_i.i_state = EXT3_STATE_NEW;
571 + ei->i_state = EXT3_STATE_NEW;
572 err = ext3_mark_inode_dirty(handle, inode);
575 @@ -588,19 +592,19 @@ struct inode *ext3_orphan_get(struct sup
577 unsigned long ext3_count_free_inodes (struct super_block * sb)
579 + struct ext3_sb_info *sbi = EXT3_SB(sb);
580 + struct ext3_super_block *es = sbi->s_es;
582 - struct ext3_super_block * es;
583 unsigned long desc_count, bitmap_count, x;
585 struct ext3_group_desc * gdp;
589 - es = sb->u.ext3_sb.s_es;
593 - for (i = 0; i < sb->u.ext3_sb.s_groups_count; i++) {
594 + for (i = 0; i < sbi->s_groups_count; i++) {
595 gdp = ext3_get_group_desc (sb, i, NULL);
598 @@ -609,8 +613,8 @@ unsigned long ext3_count_free_inodes (st
602 - x = ext3_count_free (sb->u.ext3_sb.s_inode_bitmap[bitmap_nr],
603 - EXT3_INODES_PER_GROUP(sb) / 8);
604 + x = ext3_count_free(sbi->s_inode_bitmap[bitmap_nr],
605 + sbi->s_inodes_per_group / 8);
606 printk ("group %d: stored = %d, counted = %lu\n",
607 i, le16_to_cpu(gdp->bg_free_inodes_count), x);
609 @@ -620,7 +624,7 @@ unsigned long ext3_count_free_inodes (st
613 - return le32_to_cpu(sb->u.ext3_sb.s_es->s_free_inodes_count);
614 + return le32_to_cpu(es->s_free_inodes_count);
618 @@ -629,16 +633,18 @@ unsigned long ext3_count_free_inodes (st
619 void ext3_check_inodes_bitmap (struct super_block * sb)
621 struct ext3_super_block * es;
622 + struct ext3_sb_info *sbi;
623 unsigned long desc_count, bitmap_count, x;
625 struct ext3_group_desc * gdp;
628 - es = sb->u.ext3_sb.s_es;
634 - for (i = 0; i < sb->u.ext3_sb.s_groups_count; i++) {
635 + for (i = 0; i < sbi->s_groups_count; i++) {
636 gdp = ext3_get_group_desc (sb, i, NULL);
639 @@ -647,7 +653,7 @@ void ext3_check_inodes_bitmap (struct su
643 - x = ext3_count_free (sb->u.ext3_sb.s_inode_bitmap[bitmap_nr],
644 + x = ext3_count_free (sbi->s_inode_bitmap[bitmap_nr],
645 EXT3_INODES_PER_GROUP(sb) / 8);
646 if (le16_to_cpu(gdp->bg_free_inodes_count) != x)
647 ext3_error (sb, "ext3_check_inodes_bitmap",
648 --- linux-2.4.18-chaos/fs/ext3/inode.c~ext3-2.4.18-ino_sb_macro-2 2003-09-16 23:34:16.000000000 +0400
649 +++ linux-2.4.18-chaos-alexey/fs/ext3/inode.c 2003-09-16 23:34:40.000000000 +0400
650 @@ -206,7 +206,7 @@ void ext3_delete_inode (struct inode * i
651 * (Well, we could do this if we need to, but heck - it works)
653 ext3_orphan_del(handle, inode);
654 - inode->u.ext3_i.i_dtime = CURRENT_TIME;
655 + EXT3_I(inode)->i_dtime = CURRENT_TIME;
658 * One subtle ordering requirement: if anything has gone wrong
659 @@ -230,13 +230,14 @@ no_delete:
660 void ext3_discard_prealloc (struct inode * inode)
662 #ifdef EXT3_PREALLOCATE
663 + struct ext3_inode_info *ei = EXT3_I(inode);
665 /* Writer: ->i_prealloc* */
666 - if (inode->u.ext3_i.i_prealloc_count) {
667 - unsigned short total = inode->u.ext3_i.i_prealloc_count;
668 - unsigned long block = inode->u.ext3_i.i_prealloc_block;
669 - inode->u.ext3_i.i_prealloc_count = 0;
670 - inode->u.ext3_i.i_prealloc_block = 0;
671 + if (ei->i_prealloc_count) {
672 + unsigned short total = ei->i_prealloc_count;
673 + unsigned long block = ei->i_prealloc_block;
674 + ei->i_prealloc_count = 0;
675 + ei->i_prealloc_block = 0;
677 ext3_free_blocks (inode, block, total);
679 @@ -253,13 +254,15 @@ static int ext3_alloc_block (handle_t *h
680 unsigned long result;
682 #ifdef EXT3_PREALLOCATE
683 + struct ext3_inode_info *ei = EXT3_I(inode);
685 /* Writer: ->i_prealloc* */
686 - if (inode->u.ext3_i.i_prealloc_count &&
687 - (goal == inode->u.ext3_i.i_prealloc_block ||
688 - goal + 1 == inode->u.ext3_i.i_prealloc_block))
689 + if (ei->i_prealloc_count &&
690 + (goal == ei->i_prealloc_block ||
691 + goal + 1 == ei->i_prealloc_block))
693 - result = inode->u.ext3_i.i_prealloc_block++;
694 - inode->u.ext3_i.i_prealloc_count--;
695 + result = ei->i_prealloc_block++;
696 + ei->i_prealloc_count--;
698 ext3_debug ("preallocation hit (%lu/%lu).\n",
699 ++alloc_hits, ++alloc_attempts);
700 @@ -269,8 +272,8 @@ static int ext3_alloc_block (handle_t *h
701 alloc_hits, ++alloc_attempts);
702 if (S_ISREG(inode->i_mode))
703 result = ext3_new_block (inode, goal,
704 - &inode->u.ext3_i.i_prealloc_count,
705 - &inode->u.ext3_i.i_prealloc_block, err);
706 + &ei->i_prealloc_count,
707 + &ei->i_prealloc_block, err);
709 result = ext3_new_block (inode, goal, 0, 0, err);
711 @@ -404,7 +407,7 @@ static Indirect *ext3_get_branch(struct
714 /* i_data is not going away, no lock needed */
715 - add_chain (chain, NULL, inode->u.ext3_i.i_data + *offsets);
716 + add_chain (chain, NULL, EXT3_I(inode)->i_data + *offsets);
720 @@ -448,7 +451,8 @@ no_block:
722 static inline unsigned long ext3_find_near(struct inode *inode, Indirect *ind)
724 - u32 *start = ind->bh ? (u32*) ind->bh->b_data : inode->u.ext3_i.i_data;
725 + struct ext3_inode_info *ei = EXT3_I(inode);
726 + u32 *start = ind->bh ? (u32*) ind->bh->b_data : ei->i_data;
729 /* Try to find previous block */
730 @@ -464,9 +468,8 @@ static inline unsigned long ext3_find_ne
731 * It is going to be refered from inode itself? OK, just put it into
732 * the same cylinder group then.
734 - return (inode->u.ext3_i.i_block_group *
735 - EXT3_BLOCKS_PER_GROUP(inode->i_sb)) +
736 - le32_to_cpu(inode->i_sb->u.ext3_sb.s_es->s_first_data_block);
737 + return (ei->i_block_group * EXT3_BLOCKS_PER_GROUP(inode->i_sb)) +
738 + le32_to_cpu(EXT3_SB(inode->i_sb)->s_es->s_first_data_block);
742 @@ -485,14 +488,15 @@ static inline unsigned long ext3_find_ne
743 static int ext3_find_goal(struct inode *inode, long block, Indirect chain[4],
744 Indirect *partial, unsigned long *goal)
746 + struct ext3_inode_info *ei = EXT3_I(inode);
747 /* Writer: ->i_next_alloc* */
748 - if (block == inode->u.ext3_i.i_next_alloc_block + 1) {
749 - inode->u.ext3_i.i_next_alloc_block++;
750 - inode->u.ext3_i.i_next_alloc_goal++;
751 + if (block == ei->i_next_alloc_block + 1) {
752 + ei->i_next_alloc_block++;
753 + ei->i_next_alloc_goal++;
755 #ifdef SEARCH_FROM_ZERO
756 - inode->u.ext3_i.i_next_alloc_block = 0;
757 - inode->u.ext3_i.i_next_alloc_goal = 0;
758 + ei->i_next_alloc_block = 0;
759 + ei->i_next_alloc_goal = 0;
762 /* Reader: pointers, ->i_next_alloc* */
763 @@ -501,8 +505,8 @@ static int ext3_find_goal(struct inode *
764 * try the heuristic for sequential allocation,
765 * failing that at least try to get decent locality.
767 - if (block == inode->u.ext3_i.i_next_alloc_block)
768 - *goal = inode->u.ext3_i.i_next_alloc_goal;
769 + if (block == ei->i_next_alloc_block)
770 + *goal = ei->i_next_alloc_goal;
772 *goal = ext3_find_near(inode, partial);
773 #ifdef SEARCH_FROM_ZERO
774 @@ -628,6 +632,7 @@ static int ext3_splice_branch(handle_t *
778 + struct ext3_inode_info *ei = EXT3_I(inode);
781 * If we're splicing into a [td]indirect block (as opposed to the
782 @@ -650,11 +655,11 @@ static int ext3_splice_branch(handle_t *
785 *where->p = where->key;
786 - inode->u.ext3_i.i_next_alloc_block = block;
787 - inode->u.ext3_i.i_next_alloc_goal = le32_to_cpu(where[num-1].key);
788 + ei->i_next_alloc_block = block;
789 + ei->i_next_alloc_goal = le32_to_cpu(where[num-1].key);
790 #ifdef SEARCH_FROM_ZERO
791 - inode->u.ext3_i.i_next_alloc_block = 0;
792 - inode->u.ext3_i.i_next_alloc_goal = 0;
793 + ei->i_next_alloc_block = 0;
794 + ei->i_next_alloc_goal = 0;
798 @@ -738,6 +743,7 @@ static int ext3_get_block_handle(handle_
801 int depth = ext3_block_to_path(inode, iblock, offsets);
802 + struct ext3_inode_info *ei = EXT3_I(inode);
805 J_ASSERT(handle != NULL || create == 0);
806 @@ -791,7 +797,7 @@ out:
808 * Block out ext3_truncate while we alter the tree
810 - down_read(&inode->u.ext3_i.truncate_sem);
811 + down_read(&ei->truncate_sem);
812 err = ext3_alloc_branch(handle, inode, left, goal,
813 offsets+(partial-chain), partial);
815 @@ -803,7 +809,7 @@ out:
817 err = ext3_splice_branch(handle, inode, iblock, chain,
819 - up_read(&inode->u.ext3_i.truncate_sem);
820 + up_read(&ei->truncate_sem);
824 @@ -816,8 +822,8 @@ out:
825 * truncate is in progress. It is racy between multiple parallel
826 * instances of get_block, but we have the BKL.
828 - if (new_size > inode->u.ext3_i.i_disksize)
829 - inode->u.ext3_i.i_disksize = new_size;
830 + if (new_size > ei->i_disksize)
831 + ei->i_disksize = new_size;
833 bh_result->b_state |= (1UL << BH_New);
835 @@ -932,7 +938,7 @@ struct buffer_head *ext3_bread(handle_t
836 struct buffer_head *tmp_bh;
839 - inode->u.ext3_i.i_prealloc_count &&
840 + EXT3_I(inode)->i_prealloc_count &&
841 i < EXT3_SB(inode->i_sb)->s_es->s_prealloc_dir_blocks;
844 @@ -1152,8 +1158,8 @@ static int ext3_commit_write(struct file
848 - if (inode->i_size > inode->u.ext3_i.i_disksize) {
849 - inode->u.ext3_i.i_disksize = inode->i_size;
850 + if (inode->i_size > EXT3_I(inode)->i_disksize) {
851 + EXT3_I(inode)->i_disksize = inode->i_size;
852 ret2 = ext3_mark_inode_dirty(handle, inode);
855 @@ -1873,7 +1879,8 @@ static void ext3_free_branches(handle_t
856 void ext3_truncate(struct inode * inode)
859 - u32 *i_data = inode->u.ext3_i.i_data;
860 + struct ext3_inode_info *ei = EXT3_I(inode);
861 + u32 *i_data = EXT3_I(inode)->i_data;
862 int addr_per_block = EXT3_ADDR_PER_BLOCK(inode->i_sb);
865 @@ -1934,13 +1941,13 @@ void ext3_truncate(struct inode * inode)
866 * on-disk inode. We do this via i_disksize, which is the value which
867 * ext3 *really* writes onto the disk inode.
869 - inode->u.ext3_i.i_disksize = inode->i_size;
870 + ei->i_disksize = inode->i_size;
873 * From here we block out all ext3_get_block() callers who want to
874 * modify the block allocation tree.
876 - down_write(&inode->u.ext3_i.truncate_sem);
877 + down_write(&ei->truncate_sem);
879 if (n == 1) { /* direct blocks */
880 ext3_free_data(handle, inode, NULL, i_data+offsets[0],
881 @@ -2004,7 +2011,7 @@ do_indirects:
882 case EXT3_TIND_BLOCK:
885 - up_write(&inode->u.ext3_i.truncate_sem);
886 + up_write(&ei->truncate_sem);
887 inode->i_mtime = inode->i_ctime = CURRENT_TIME;
888 ext3_mark_inode_dirty(handle, inode);
890 @@ -2041,6 +2048,8 @@ out_unlock:
892 int ext3_get_inode_loc (struct inode *inode, struct ext3_iloc *iloc)
894 + struct super_block *sb = inode->i_sb;
895 + struct ext3_sb_info *sbi = EXT3_SB(sb);
896 struct buffer_head *bh = 0;
898 unsigned long block_group;
899 @@ -2051,25 +2060,21 @@ int ext3_get_inode_loc (struct inode *in
901 if ((inode->i_ino != EXT3_ROOT_INO &&
902 inode->i_ino != EXT3_JOURNAL_INO &&
903 - inode->i_ino < EXT3_FIRST_INO(inode->i_sb)) ||
904 - inode->i_ino > le32_to_cpu(
905 - inode->i_sb->u.ext3_sb.s_es->s_inodes_count)) {
906 - ext3_error (inode->i_sb, "ext3_get_inode_loc",
907 - "bad inode number: %lu", inode->i_ino);
908 + inode->i_ino < EXT3_FIRST_INO(sb)) ||
909 + inode->i_ino > le32_to_cpu(sbi->s_es->s_inodes_count)) {
910 + ext3_error (sb, __FUNCTION__, "bad inode #%lu", inode->i_ino);
913 - block_group = (inode->i_ino - 1) / EXT3_INODES_PER_GROUP(inode->i_sb);
914 - if (block_group >= inode->i_sb->u.ext3_sb.s_groups_count) {
915 - ext3_error (inode->i_sb, "ext3_get_inode_loc",
916 - "group >= groups count");
917 + block_group = (inode->i_ino - 1) / sbi->s_inodes_per_group;
918 + if (block_group >= sbi->s_groups_count) {
919 + ext3_error(sb, __FUNCTION__, "group >= groups count");
922 - group_desc = block_group >> EXT3_DESC_PER_BLOCK_BITS(inode->i_sb);
923 - desc = block_group & (EXT3_DESC_PER_BLOCK(inode->i_sb) - 1);
924 - bh = inode->i_sb->u.ext3_sb.s_group_desc[group_desc];
925 + group_desc = block_group >> sbi->s_desc_per_block_bits;
926 + desc = block_group & (sbi->s_desc_per_block - 1);
927 + bh = sbi->s_group_desc[group_desc];
929 - ext3_error (inode->i_sb, "ext3_get_inode_loc",
930 - "Descriptor not loaded");
931 + ext3_error(sb, __FUNCTION__, "Descriptor not loaded");
935 @@ -2077,17 +2082,17 @@ int ext3_get_inode_loc (struct inode *in
937 * Figure out the offset within the block group inode table
939 - offset = ((inode->i_ino - 1) % EXT3_INODES_PER_GROUP(inode->i_sb)) *
940 - EXT3_INODE_SIZE(inode->i_sb);
941 + offset = ((inode->i_ino - 1) % sbi->s_inodes_per_group) *
943 block = le32_to_cpu(gdp[desc].bg_inode_table) +
944 - (offset >> EXT3_BLOCK_SIZE_BITS(inode->i_sb));
945 - if (!(bh = sb_bread(inode->i_sb, block))) {
946 - ext3_error (inode->i_sb, "ext3_get_inode_loc",
947 + (offset >> EXT3_BLOCK_SIZE_BITS(sb));
948 + if (!(bh = sb_bread(sb, block))) {
949 + ext3_error (sb, __FUNCTION__,
950 "unable to read inode block - "
951 "inode=%lu, block=%lu", inode->i_ino, block);
954 - offset &= (EXT3_BLOCK_SIZE(inode->i_sb) - 1);
955 + offset &= (EXT3_BLOCK_SIZE(sb) - 1);
958 iloc->raw_inode = (struct ext3_inode *) (bh->b_data + offset);
959 @@ -2103,6 +2108,7 @@ void ext3_read_inode(struct inode * inod
961 struct ext3_iloc iloc;
962 struct ext3_inode *raw_inode;
963 + struct ext3_inode_info *ei = EXT3_I(inode);
964 struct buffer_head *bh;
967 @@ -2110,7 +2116,7 @@ void ext3_read_inode(struct inode * inod
970 raw_inode = iloc.raw_inode;
971 - init_rwsem(&inode->u.ext3_i.truncate_sem);
972 + init_rwsem(&ei->truncate_sem);
973 inode->i_mode = le16_to_cpu(raw_inode->i_mode);
974 inode->i_uid = (uid_t)le16_to_cpu(raw_inode->i_uid_low);
975 inode->i_gid = (gid_t)le16_to_cpu(raw_inode->i_gid_low);
976 @@ -2123,7 +2129,7 @@ void ext3_read_inode(struct inode * inod
977 inode->i_atime = le32_to_cpu(raw_inode->i_atime);
978 inode->i_ctime = le32_to_cpu(raw_inode->i_ctime);
979 inode->i_mtime = le32_to_cpu(raw_inode->i_mtime);
980 - inode->u.ext3_i.i_dtime = le32_to_cpu(raw_inode->i_dtime);
981 + ei->i_dtime = le32_to_cpu(raw_inode->i_dtime);
982 /* We now have enough fields to check if the inode was active or not.
983 * This is needed because nfsd might try to access dead inodes
984 * the test is that same one that e2fsck uses
985 @@ -2131,7 +2137,7 @@ void ext3_read_inode(struct inode * inod
987 if (inode->i_nlink == 0) {
988 if (inode->i_mode == 0 ||
989 - !(inode->i_sb->u.ext3_sb.s_mount_state & EXT3_ORPHAN_FS)) {
990 + !(EXT3_SB(inode->i_sb)->s_mount_state & EXT3_ORPHAN_FS)) {
991 /* this inode is deleted */
994 @@ -2146,33 +2152,33 @@ void ext3_read_inode(struct inode * inod
996 inode->i_blocks = le32_to_cpu(raw_inode->i_blocks);
997 inode->i_version = ++event;
998 - inode->u.ext3_i.i_flags = le32_to_cpu(raw_inode->i_flags);
999 + ei->i_flags = le32_to_cpu(raw_inode->i_flags);
1000 #ifdef EXT3_FRAGMENTS
1001 - inode->u.ext3_i.i_faddr = le32_to_cpu(raw_inode->i_faddr);
1002 - inode->u.ext3_i.i_frag_no = raw_inode->i_frag;
1003 - inode->u.ext3_i.i_frag_size = raw_inode->i_fsize;
1004 + ei->i_faddr = le32_to_cpu(raw_inode->i_faddr);
1005 + ei->i_frag_no = raw_inode->i_frag;
1006 + ei->i_frag_size = raw_inode->i_fsize;
1008 - inode->u.ext3_i.i_file_acl = le32_to_cpu(raw_inode->i_file_acl);
1009 + ei->i_file_acl = le32_to_cpu(raw_inode->i_file_acl);
1010 if (!S_ISREG(inode->i_mode)) {
1011 - inode->u.ext3_i.i_dir_acl = le32_to_cpu(raw_inode->i_dir_acl);
1012 + ei->i_dir_acl = le32_to_cpu(raw_inode->i_dir_acl);
1015 ((__u64)le32_to_cpu(raw_inode->i_size_high)) << 32;
1017 - inode->u.ext3_i.i_disksize = inode->i_size;
1018 + ei->i_disksize = inode->i_size;
1019 inode->i_generation = le32_to_cpu(raw_inode->i_generation);
1020 #ifdef EXT3_PREALLOCATE
1021 - inode->u.ext3_i.i_prealloc_count = 0;
1022 + ei->i_prealloc_count = 0;
1024 - inode->u.ext3_i.i_block_group = iloc.block_group;
1025 + ei->i_block_group = iloc.block_group;
1028 * NOTE! The in-memory inode i_data array is in little-endian order
1029 * even on big-endian machines: we do NOT byteswap the block numbers!
1031 for (block = 0; block < EXT3_N_BLOCKS; block++)
1032 - inode->u.ext3_i.i_data[block] = iloc.raw_inode->i_block[block];
1033 - INIT_LIST_HEAD(&inode->u.ext3_i.i_orphan);
1034 + ei->i_data[block] = iloc.raw_inode->i_block[block];
1035 + INIT_LIST_HEAD(&ei->i_orphan);
1039 @@ -2194,19 +2200,19 @@ void ext3_read_inode(struct inode * inod
1040 init_special_inode(inode, inode->i_mode,
1041 le32_to_cpu(iloc.raw_inode->i_block[0]));
1042 /* inode->i_attr_flags = 0; unused */
1043 - if (inode->u.ext3_i.i_flags & EXT3_SYNC_FL) {
1044 + if (ei->i_flags & EXT3_SYNC_FL) {
1045 /* inode->i_attr_flags |= ATTR_FLAG_SYNCRONOUS; unused */
1046 inode->i_flags |= S_SYNC;
1048 - if (inode->u.ext3_i.i_flags & EXT3_APPEND_FL) {
1049 + if (ei->i_flags & EXT3_APPEND_FL) {
1050 /* inode->i_attr_flags |= ATTR_FLAG_APPEND; unused */
1051 inode->i_flags |= S_APPEND;
1053 - if (inode->u.ext3_i.i_flags & EXT3_IMMUTABLE_FL) {
1054 + if (ei->i_flags & EXT3_IMMUTABLE_FL) {
1055 /* inode->i_attr_flags |= ATTR_FLAG_IMMUTABLE; unused */
1056 inode->i_flags |= S_IMMUTABLE;
1058 - if (inode->u.ext3_i.i_flags & EXT3_NOATIME_FL) {
1059 + if (ei->i_flags & EXT3_NOATIME_FL) {
1060 /* inode->i_attr_flags |= ATTR_FLAG_NOATIME; unused */
1061 inode->i_flags |= S_NOATIME;
1063 @@ -2228,6 +2234,7 @@ static int ext3_do_update_inode(handle_t
1064 struct ext3_iloc *iloc)
1066 struct ext3_inode *raw_inode = iloc->raw_inode;
1067 + struct ext3_inode_info *ei = EXT3_I(inode);
1068 struct buffer_head *bh = iloc->bh;
1069 int err = 0, rc, block;
1071 @@ -2245,7 +2252,7 @@ static int ext3_do_update_inode(handle_t
1072 * Fix up interoperability with old kernels. Otherwise, old inodes get
1073 * re-used with the upper 16 bits of the uid/gid intact
1075 - if(!inode->u.ext3_i.i_dtime) {
1076 + if(!ei->i_dtime) {
1077 raw_inode->i_uid_high =
1078 cpu_to_le16(high_16_bits(inode->i_uid));
1079 raw_inode->i_gid_high =
1080 @@ -2263,34 +2270,33 @@ static int ext3_do_update_inode(handle_t
1081 raw_inode->i_gid_high = 0;
1083 raw_inode->i_links_count = cpu_to_le16(inode->i_nlink);
1084 - raw_inode->i_size = cpu_to_le32(inode->u.ext3_i.i_disksize);
1085 + raw_inode->i_size = cpu_to_le32(ei->i_disksize);
1086 raw_inode->i_atime = cpu_to_le32(inode->i_atime);
1087 raw_inode->i_ctime = cpu_to_le32(inode->i_ctime);
1088 raw_inode->i_mtime = cpu_to_le32(inode->i_mtime);
1089 raw_inode->i_blocks = cpu_to_le32(inode->i_blocks);
1090 - raw_inode->i_dtime = cpu_to_le32(inode->u.ext3_i.i_dtime);
1091 - raw_inode->i_flags = cpu_to_le32(inode->u.ext3_i.i_flags);
1092 + raw_inode->i_dtime = cpu_to_le32(ei->i_dtime);
1093 + raw_inode->i_flags = cpu_to_le32(ei->i_flags);
1094 #ifdef EXT3_FRAGMENTS
1095 - raw_inode->i_faddr = cpu_to_le32(inode->u.ext3_i.i_faddr);
1096 - raw_inode->i_frag = inode->u.ext3_i.i_frag_no;
1097 - raw_inode->i_fsize = inode->u.ext3_i.i_frag_size;
1098 + raw_inode->i_faddr = cpu_to_le32(ei->i_faddr);
1099 + raw_inode->i_frag = ei->i_frag_no;
1100 + raw_inode->i_fsize = ei->i_frag_size;
1102 /* If we are not tracking these fields in the in-memory inode,
1103 * then preserve them on disk, but still initialise them to zero
1104 * for new inodes. */
1105 - if (EXT3_I(inode)->i_state & EXT3_STATE_NEW) {
1106 + if (ei->i_state & EXT3_STATE_NEW) {
1107 raw_inode->i_faddr = 0;
1108 raw_inode->i_frag = 0;
1109 raw_inode->i_fsize = 0;
1112 - raw_inode->i_file_acl = cpu_to_le32(inode->u.ext3_i.i_file_acl);
1113 + raw_inode->i_file_acl = cpu_to_le32(ei->i_file_acl);
1114 if (!S_ISREG(inode->i_mode)) {
1115 - raw_inode->i_dir_acl = cpu_to_le32(inode->u.ext3_i.i_dir_acl);
1116 + raw_inode->i_dir_acl = cpu_to_le32(ei->i_dir_acl);
1118 - raw_inode->i_size_high =
1119 - cpu_to_le32(inode->u.ext3_i.i_disksize >> 32);
1120 - if (inode->u.ext3_i.i_disksize > 0x7fffffffULL) {
1121 + raw_inode->i_size_high = cpu_to_le32(ei->i_disksize >> 32);
1122 + if (ei->i_disksize > MAX_NON_LFS) {
1123 struct super_block *sb = inode->i_sb;
1124 if (!EXT3_HAS_RO_COMPAT_FEATURE(sb,
1125 EXT3_FEATURE_RO_COMPAT_LARGE_FILE) ||
1126 @@ -2300,7 +2306,7 @@ static int ext3_do_update_inode(handle_t
1127 * created, add a flag to the superblock.
1129 err = ext3_journal_get_write_access(handle,
1130 - sb->u.ext3_sb.s_sbh);
1131 + EXT3_SB(sb)->s_sbh);
1134 ext3_update_dynamic_rev(sb);
1135 @@ -2309,7 +2315,7 @@ static int ext3_do_update_inode(handle_t
1138 err = ext3_journal_dirty_metadata(handle,
1139 - sb->u.ext3_sb.s_sbh);
1140 + EXT3_SB(sb)->s_sbh);
1144 @@ -2318,13 +2324,13 @@ static int ext3_do_update_inode(handle_t
1145 raw_inode->i_block[0] =
1146 cpu_to_le32(kdev_t_to_nr(inode->i_rdev));
1147 else for (block = 0; block < EXT3_N_BLOCKS; block++)
1148 - raw_inode->i_block[block] = inode->u.ext3_i.i_data[block];
1149 + raw_inode->i_block[block] = ei->i_data[block];
1151 BUFFER_TRACE(bh, "call ext3_journal_dirty_metadata");
1152 rc = ext3_journal_dirty_metadata(handle, bh);
1155 - EXT3_I(inode)->i_state &= ~EXT3_STATE_NEW;
1156 + ei->i_state &= ~EXT3_STATE_NEW;
1160 @@ -2432,7 +2438,7 @@ int ext3_setattr(struct dentry *dentry,
1163 error = ext3_orphan_add(handle, inode);
1164 - inode->u.ext3_i.i_disksize = attr->ia_size;
1165 + EXT3_I(inode)->i_disksize = attr->ia_size;
1166 rc = ext3_mark_inode_dirty(handle, inode);
1169 @@ -2675,9 +2681,9 @@ int ext3_change_inode_journal_flag(struc
1173 - inode->u.ext3_i.i_flags |= EXT3_JOURNAL_DATA_FL;
1174 + EXT3_I(inode)->i_flags |= EXT3_JOURNAL_DATA_FL;
1176 - inode->u.ext3_i.i_flags &= ~EXT3_JOURNAL_DATA_FL;
1177 + EXT3_I(inode)->i_flags &= ~EXT3_JOURNAL_DATA_FL;
1179 journal_unlock_updates(journal);
1181 --- linux-2.4.18-chaos/fs/ext3/ioctl.c~ext3-2.4.18-ino_sb_macro-2 2001-11-10 01:25:04.000000000 +0300
1182 +++ linux-2.4.18-chaos-alexey/fs/ext3/ioctl.c 2003-09-16 23:34:40.000000000 +0400
1184 int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd,
1187 + struct ext3_inode_info *ei = EXT3_I(inode);
1190 ext3_debug ("cmd = %u, arg = %lu\n", cmd, arg);
1193 case EXT3_IOC_GETFLAGS:
1194 - flags = inode->u.ext3_i.i_flags & EXT3_FL_USER_VISIBLE;
1195 + flags = ei->i_flags & EXT3_FL_USER_VISIBLE;
1196 return put_user(flags, (int *) arg);
1197 case EXT3_IOC_SETFLAGS: {
1198 handle_t *handle = NULL;
1199 @@ -42,7 +43,7 @@ int ext3_ioctl (struct inode * inode, st
1200 if (get_user(flags, (int *) arg))
1203 - oldflags = inode->u.ext3_i.i_flags;
1204 + oldflags = ei->i_flags;
1206 /* The JOURNAL_DATA flag is modifiable only by root */
1207 jflag = flags & EXT3_JOURNAL_DATA_FL;
1208 @@ -79,7 +80,7 @@ int ext3_ioctl (struct inode * inode, st
1210 flags = flags & EXT3_FL_USER_MODIFIABLE;
1211 flags |= oldflags & ~EXT3_FL_USER_MODIFIABLE;
1212 - inode->u.ext3_i.i_flags = flags;
1213 + ei->i_flags = flags;
1215 if (flags & EXT3_SYNC_FL)
1216 inode->i_flags |= S_SYNC;
1217 @@ -155,12 +156,12 @@ flags_err:
1220 set_current_state(TASK_INTERRUPTIBLE);
1221 - add_wait_queue(&sb->u.ext3_sb.ro_wait_queue, &wait);
1222 - if (timer_pending(&sb->u.ext3_sb.turn_ro_timer)) {
1223 + add_wait_queue(&EXT3_SB(sb)->ro_wait_queue, &wait);
1224 + if (timer_pending(&EXT3_SB(sb)->turn_ro_timer)) {
1228 - remove_wait_queue(&sb->u.ext3_sb.ro_wait_queue, &wait);
1229 + remove_wait_queue(&EXT3_SB(sb)->ro_wait_queue, &wait);
1233 --- linux-2.4.18-chaos/fs/ext3/namei.c~ext3-2.4.18-ino_sb_macro-2 2003-09-16 23:34:33.000000000 +0400
1234 +++ linux-2.4.18-chaos-alexey/fs/ext3/namei.c 2003-09-16 23:34:40.000000000 +0400
1235 @@ -1764,8 +1764,8 @@ int ext3_orphan_add(handle_t *handle, st
1236 J_ASSERT ((S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
1237 S_ISLNK(inode->i_mode)) || inode->i_nlink == 0);
1239 - BUFFER_TRACE(sb->u.ext3_sb.s_sbh, "get_write_access");
1240 - err = ext3_journal_get_write_access(handle, sb->u.ext3_sb.s_sbh);
1241 + BUFFER_TRACE(EXT3_SB(sb)->s_sbh, "get_write_access");
1242 + err = ext3_journal_get_write_access(handle, EXT3_SB(sb)->s_sbh);
1246 @@ -1776,7 +1776,7 @@ int ext3_orphan_add(handle_t *handle, st
1247 /* Insert this inode at the head of the on-disk orphan list... */
1248 NEXT_ORPHAN(inode) = le32_to_cpu(EXT3_SB(sb)->s_es->s_last_orphan);
1249 EXT3_SB(sb)->s_es->s_last_orphan = cpu_to_le32(inode->i_ino);
1250 - err = ext3_journal_dirty_metadata(handle, sb->u.ext3_sb.s_sbh);
1251 + err = ext3_journal_dirty_metadata(handle, EXT3_SB(sb)->s_sbh);
1252 rc = ext3_mark_iloc_dirty(handle, inode, &iloc);
1255 @@ -1850,8 +1850,7 @@ int ext3_orphan_del(handle_t *handle, st
1256 err = ext3_journal_dirty_metadata(handle, sbi->s_sbh);
1258 struct ext3_iloc iloc2;
1259 - struct inode *i_prev =
1260 - list_entry(prev, struct inode, u.ext3_i.i_orphan);
1261 + struct inode *i_prev = orphan_list_entry(prev);
1263 jbd_debug(4, "orphan inode %lu will point to %lu\n",
1264 i_prev->i_ino, ino_next);
1265 --- linux-2.4.18-chaos/fs/ext3/super.c~ext3-2.4.18-ino_sb_macro-2 2003-09-16 23:34:16.000000000 +0400
1266 +++ linux-2.4.18-chaos-alexey/fs/ext3/super.c 2003-09-16 23:34:40.000000000 +0400
1267 @@ -124,7 +124,7 @@ static int ext3_error_behaviour(struct s
1268 /* If no overrides were specified on the mount, then fall back
1269 * to the default behaviour set in the filesystem's superblock
1271 - switch (le16_to_cpu(sb->u.ext3_sb.s_es->s_errors)) {
1272 + switch (le16_to_cpu(EXT3_SB(sb)->s_es->s_errors)) {
1273 case EXT3_ERRORS_PANIC:
1274 return EXT3_ERRORS_PANIC;
1275 case EXT3_ERRORS_RO:
1276 @@ -272,9 +272,9 @@ void ext3_abort (struct super_block * sb
1279 printk (KERN_CRIT "Remounting filesystem read-only\n");
1280 - sb->u.ext3_sb.s_mount_state |= EXT3_ERROR_FS;
1281 + EXT3_SB(sb)->s_mount_state |= EXT3_ERROR_FS;
1282 sb->s_flags |= MS_RDONLY;
1283 - sb->u.ext3_sb.s_mount_opt |= EXT3_MOUNT_ABORT;
1284 + EXT3_SB(sb)->s_mount_opt |= EXT3_MOUNT_ABORT;
1285 journal_abort(EXT3_SB(sb)->s_journal, -EIO);
1288 @@ -380,8 +380,6 @@ static int ext3_blkdev_remove(struct ext
1292 -#define orphan_list_entry(l) list_entry((l), struct inode, u.ext3_i.i_orphan)
1294 static void dump_orphan_list(struct super_block *sb, struct ext3_sb_info *sbi)
1296 struct list_head *l;
1297 @@ -825,7 +823,7 @@ static void ext3_orphan_cleanup (struct
1298 sb->s_flags &= ~MS_RDONLY;
1301 - if (sb->u.ext3_sb.s_mount_state & EXT3_ERROR_FS) {
1302 + if (EXT3_SB(sb)->s_mount_state & EXT3_ERROR_FS) {
1303 if (es->s_last_orphan)
1304 jbd_debug(1, "Errors on filesystem, "
1305 "clearing orphan list.\n");
1306 @@ -1474,12 +1472,14 @@ static void ext3_commit_super (struct su
1307 struct ext3_super_block * es,
1310 + struct buffer_head *sbh = EXT3_SB(sb)->s_sbh;
1312 es->s_wtime = cpu_to_le32(CURRENT_TIME);
1313 - BUFFER_TRACE(sb->u.ext3_sb.s_sbh, "marking dirty");
1314 - mark_buffer_dirty(sb->u.ext3_sb.s_sbh);
1315 + BUFFER_TRACE(sbh, "marking dirty");
1316 + mark_buffer_dirty(sbh);
1318 - ll_rw_block(WRITE, 1, &sb->u.ext3_sb.s_sbh);
1319 - wait_on_buffer(sb->u.ext3_sb.s_sbh);
1320 + ll_rw_block(WRITE, 1, &sbh);
1321 + wait_on_buffer(sbh);
1325 @@ -1530,7 +1530,7 @@ static void ext3_clear_journal_err(struc
1326 ext3_warning(sb, __FUNCTION__, "Marking fs in need of "
1327 "filesystem check.");
1329 - sb->u.ext3_sb.s_mount_state |= EXT3_ERROR_FS;
1330 + EXT3_SB(sb)->s_mount_state |= EXT3_ERROR_FS;
1331 es->s_state |= cpu_to_le16(EXT3_ERROR_FS);
1332 ext3_commit_super (sb, es, 1);
1334 --- linux-2.4.18-chaos/fs/ext3/symlink.c~ext3-2.4.18-ino_sb_macro-2 2001-11-10 01:25:04.000000000 +0300
1335 +++ linux-2.4.18-chaos-alexey/fs/ext3/symlink.c 2003-09-16 23:34:40.000000000 +0400
1338 static int ext3_readlink(struct dentry *dentry, char *buffer, int buflen)
1340 - char *s = (char *)dentry->d_inode->u.ext3_i.i_data;
1341 - return vfs_readlink(dentry, buffer, buflen, s);
1342 + struct ext3_inode_info *ei = EXT3_I(dentry->d_inode);
1343 + return vfs_readlink(dentry, buffer, buflen, (char *)ei->i_data);
1346 static int ext3_follow_link(struct dentry *dentry, struct nameidata *nd)
1348 - char *s = (char *)dentry->d_inode->u.ext3_i.i_data;
1349 - return vfs_follow_link(nd, s);
1350 + struct ext3_inode_info *ei = EXT3_I(dentry->d_inode);
1351 + return vfs_follow_link(nd, (char*)ei->i_data);
1354 struct inode_operations ext3_fast_symlink_inode_operations = {
1355 --- linux-2.4.18-chaos/include/linux/ext3_fs.h~ext3-2.4.18-ino_sb_macro-2 2003-09-16 23:34:33.000000000 +0400
1356 +++ linux-2.4.18-chaos-alexey/include/linux/ext3_fs.h 2003-09-16 23:34:40.000000000 +0400
1358 #define EXT3_MIN_BLOCK_SIZE 1024
1359 #define EXT3_MAX_BLOCK_SIZE 4096
1360 #define EXT3_MIN_BLOCK_LOG_SIZE 10
1363 -# define EXT3_BLOCK_SIZE(s) ((s)->s_blocksize)
1365 -# define EXT3_BLOCK_SIZE(s) (EXT3_MIN_BLOCK_SIZE << (s)->s_log_block_size)
1367 -#define EXT3_ADDR_PER_BLOCK(s) (EXT3_BLOCK_SIZE(s) / sizeof (__u32))
1369 -# define EXT3_BLOCK_SIZE_BITS(s) ((s)->s_blocksize_bits)
1371 -# define EXT3_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10)
1374 -#define EXT3_ADDR_PER_BLOCK_BITS(s) ((s)->u.ext3_sb.s_addr_per_block_bits)
1375 -#define EXT3_INODE_SIZE(s) ((s)->u.ext3_sb.s_inode_size)
1376 -#define EXT3_FIRST_INO(s) ((s)->u.ext3_sb.s_first_ino)
1377 +#define EXT3_SB(sb) (&((sb)->u.ext3_sb))
1378 +#define EXT3_I(inode) (&((inode)->u.ext3_i))
1380 +#define EXT3_BLOCK_SIZE(s) ((s)->s_blocksize)
1381 +#define EXT3_BLOCK_SIZE_BITS(s) ((s)->s_blocksize_bits)
1382 +#define EXT3_ADDR_PER_BLOCK_BITS(s) (EXT3_SB(s)->s_addr_per_block_bits)
1383 +#define EXT3_INODE_SIZE(s) (EXT3_SB(s)->s_inode_size)
1384 +#define EXT3_FIRST_INO(s) (EXT3_SB(s)->s_first_ino)
1387 +/* Assume that user mode programs are passing in an ext3fs superblock, not
1388 + * a kernel struct super_block. This will allow us to call the feature-test
1389 + * macros from user land. */
1390 +#define EXT3_SB(sb) (sb)
1392 +#define EXT3_BLOCK_SIZE(s) (EXT3_MIN_BLOCK_SIZE << (s)->s_log_block_size)
1393 +#define EXT3_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10)
1394 #define EXT3_INODE_SIZE(s) (((s)->s_rev_level == EXT3_GOOD_OLD_REV) ? \
1395 EXT3_GOOD_OLD_INODE_SIZE : \
1398 EXT3_GOOD_OLD_FIRST_INO : \
1401 +#define EXT3_ADDR_PER_BLOCK(s) (EXT3_BLOCK_SIZE(s) / sizeof (__u32))
1404 * Macro-instructions used to manage fragments
1406 #define EXT3_MAX_FRAG_SIZE 4096
1407 #define EXT3_MIN_FRAG_LOG_SIZE 10
1409 -# define EXT3_FRAG_SIZE(s) ((s)->u.ext3_sb.s_frag_size)
1410 -# define EXT3_FRAGS_PER_BLOCK(s) ((s)->u.ext3_sb.s_frags_per_block)
1411 +# define EXT3_FRAG_SIZE(s) (EXT3_SB(s)->s_frag_size)
1412 +# define EXT3_FRAGS_PER_BLOCK(s) (EXT3_SB(s)->s_frags_per_block)
1414 # define EXT3_FRAG_SIZE(s) (EXT3_MIN_FRAG_SIZE << (s)->s_log_frag_size)
1415 # define EXT3_FRAGS_PER_BLOCK(s) (EXT3_BLOCK_SIZE(s) / EXT3_FRAG_SIZE(s))
1416 @@ -143,15 +147,13 @@ struct ext3_group_desc
1418 * Macro-instructions used to manage group descriptors
1420 +# define EXT3_BLOCKS_PER_GROUP(s) (EXT3_SB(s)->s_blocks_per_group)
1421 +# define EXT3_INODES_PER_GROUP(s) (EXT3_SB(s)->s_inodes_per_group)
1423 -# define EXT3_BLOCKS_PER_GROUP(s) ((s)->u.ext3_sb.s_blocks_per_group)
1424 -# define EXT3_DESC_PER_BLOCK(s) ((s)->u.ext3_sb.s_desc_per_block)
1425 -# define EXT3_INODES_PER_GROUP(s) ((s)->u.ext3_sb.s_inodes_per_group)
1426 -# define EXT3_DESC_PER_BLOCK_BITS(s) ((s)->u.ext3_sb.s_desc_per_block_bits)
1427 +# define EXT3_DESC_PER_BLOCK(s) (EXT3_SB(s)->s_desc_per_block)
1428 +# define EXT3_DESC_PER_BLOCK_BITS(s) (EXT3_SB(s)->s_desc_per_block_bits)
1430 -# define EXT3_BLOCKS_PER_GROUP(s) ((s)->s_blocks_per_group)
1431 # define EXT3_DESC_PER_BLOCK(s) (EXT3_BLOCK_SIZE(s) / sizeof (struct ext3_group_desc))
1432 -# define EXT3_INODES_PER_GROUP(s) ((s)->s_inodes_per_group)
1436 @@ -325,7 +327,7 @@ struct ext3_inode {
1437 #ifndef _LINUX_EXT2_FS_H
1438 #define clear_opt(o, opt) o &= ~EXT3_MOUNT_##opt
1439 #define set_opt(o, opt) o |= EXT3_MOUNT_##opt
1440 -#define test_opt(sb, opt) ((sb)->u.ext3_sb.s_mount_opt & \
1441 +#define test_opt(sb, opt) (EXT3_SB(sb)->s_mount_opt & \
1444 #define EXT2_MOUNT_NOLOAD EXT3_MOUNT_NOLOAD
1445 @@ -425,17 +427,11 @@ struct ext3_super_block {
1446 __u32 s_reserved[192]; /* Padding to the end of the block */
1450 -#define EXT3_SB(sb) (&((sb)->u.ext3_sb))
1451 -#define EXT3_I(inode) (&((inode)->u.ext3_i))
1453 -/* Assume that user mode programs are passing in an ext3fs superblock, not
1454 - * a kernel struct super_block. This will allow us to call the feature-test
1455 - * macros from user land. */
1456 -#define EXT3_SB(sb) (sb)
1459 -#define NEXT_ORPHAN(inode) (inode)->u.ext3_i.i_dtime
1460 +#define NEXT_ORPHAN(inode) EXT3_I(inode)->i_dtime
1461 +static inline struct inode *orphan_list_entry(struct list_head *l)
1463 + return list_entry(l, struct inode, u.ext3_i.i_orphan);
1467 * Codes for operating systems
1468 --- linux-2.4.18-chaos/include/linux/ext3_jbd.h~ext3-2.4.18-ino_sb_macro-2 2003-09-16 23:34:16.000000000 +0400
1469 +++ linux-2.4.18-chaos-alexey/include/linux/ext3_jbd.h 2003-09-16 23:34:40.000000000 +0400
1470 @@ -297,7 +297,7 @@ static inline int ext3_should_journal_da
1472 if (test_opt(inode->i_sb, DATA_FLAGS) == EXT3_MOUNT_JOURNAL_DATA)
1474 - if (inode->u.ext3_i.i_flags & EXT3_JOURNAL_DATA_FL)
1475 + if (EXT3_I(inode)->i_flags & EXT3_JOURNAL_DATA_FL)