--- linux-2.4-ext3merge/fs/ext3/inode.c.=K0014=.orig 2003-03-13 16:22:45.000000000 +0000 +++ linux-2.4-ext3merge/fs/ext3/inode.c 2003-03-13 16:22:52.000000000 +0000 @@ -32,13 +32,6 @@ #include #include -/* - * SEARCH_FROM_ZERO forces each block allocation to search from the start - * of the filesystem. This is to force rapid reallocation of recently-freed - * blocks. The file fragmentation is horrendous. - */ -#undef SEARCH_FROM_ZERO - /* The ext3 forget function must perform a revoke if we are freeing data * which has been journaled. Metadata (eg. indirect blocks) must be * revoked in all cases. @@ -495,10 +488,6 @@ static int ext3_find_goal(struct inode * inode->u.ext3_i.i_next_alloc_block++; inode->u.ext3_i.i_next_alloc_goal++; } -#ifdef SEARCH_FROM_ZERO - inode->u.ext3_i.i_next_alloc_block = 0; - inode->u.ext3_i.i_next_alloc_goal = 0; -#endif /* Writer: end */ /* Reader: pointers, ->i_next_alloc* */ if (verify_chain(chain, partial)) { @@ -510,9 +499,6 @@ static int ext3_find_goal(struct inode * *goal = inode->u.ext3_i.i_next_alloc_goal; if (!*goal) *goal = ext3_find_near(inode, partial); -#ifdef SEARCH_FROM_ZERO - *goal = 0; -#endif return 0; } /* Reader: end */ @@ -657,10 +643,6 @@ static int ext3_splice_branch(handle_t * *where->p = where->key; inode->u.ext3_i.i_next_alloc_block = block; inode->u.ext3_i.i_next_alloc_goal = le32_to_cpu(where[num-1].key); -#ifdef SEARCH_FROM_ZERO - inode->u.ext3_i.i_next_alloc_block = 0; - inode->u.ext3_i.i_next_alloc_goal = 0; -#endif /* Writer: end */ /* We are done with atomic stuff, now do the rest of housekeeping */ --- linux-2.4-ext3merge/fs/ext3/super.c.=K0014=.orig 2003-03-13 16:22:45.000000000 +0000 +++ linux-2.4-ext3merge/fs/ext3/super.c 2003-03-14 18:19:13.000000000 +0000 @@ -568,6 +568,10 @@ static int parse_options (char * options return 0; sbi->s_resuid = v; } + else if (!strcmp (this_char, "oldalloc")) + set_opt (sbi->s_mount_opt, OLDALLOC); + else if (!strcmp (this_char, "orlov")) + clear_opt (sbi->s_mount_opt, OLDALLOC); #ifdef CONFIG_JBD_DEBUG else if (!strcmp (this_char, "ro-after")) { unsigned long v; --- linux-2.4-ext3merge/include/linux/ext2_fs_i.h.=K0014=.orig 2003-03-13 16:22:45.000000000 +0000 +++ linux-2.4-ext3merge/include/linux/ext2_fs_i.h 2003-03-14 18:19:13.000000000 +0000 @@ -29,8 +29,30 @@ struct ext2_inode_info { __u32 i_file_acl; __u32 i_dir_acl; __u32 i_dtime; + + /* + * i_block_group is the number of the block group which contains + * this file's inode. Constant across the lifetime of the inode, + * it is ued for making block allocation decisions - we try to + * place a file's data blocks near its inode block, and new inodes + * near to their parent directory's inode. + */ __u32 i_block_group; + + /* + * i_next_alloc_block is the logical (file-relative) number of the + * most-recently-allocated block in this file. Yes, it is misnamed. + * We use this for detecting linearly ascending allocation requests. + */ __u32 i_next_alloc_block; + + /* + * i_next_alloc_goal is the *physical* companion to + * i_next_alloc_block. it the the physical block number of + * the block which was most-recently allocated to this file. + * This give us the goal (target) for the next allocation when + * we detect linearly ascending requests. + */ __u32 i_next_alloc_goal; __u32 i_prealloc_block; __u32 i_prealloc_count; --- linux-2.4-ext3merge/include/linux/ext3_fs_i.h.=K0014=.orig 2003-03-13 16:22:45.000000000 +0000 +++ linux-2.4-ext3merge/include/linux/ext3_fs_i.h 2003-03-14 18:19:13.000000000 +0000 @@ -33,9 +33,30 @@ struct ext3_inode_info { __u32 i_file_acl; __u32 i_dir_acl; __u32 i_dtime; + + /* + * i_block_group is the number of the block group which contains + * this file's inode. Constant across the lifetime of the inode, + * it is ued for making block allocation decisions - we try to + * place a file's data blocks near its inode block, and new inodes + * near to their parent directory's inode. + */ __u32 i_block_group; __u32 i_state; /* Dynamic state flags for ext3 */ + + /* + * i_next_alloc_block is the logical (file-relative) number of the + * most-recently-allocated block in this file. Yes, it is misnamed. + * We use this for detecting linearly ascending allocation requests. + */ __u32 i_next_alloc_block; + + /* + * i_next_alloc_goal is the *physical* companion to i_next_alloc_block. + * it the the physical block number of the block which was most-recently + * allocated to this file. This give us the goal (target) for the next + * allocation when we detect linearly ascending requests. + */ __u32 i_next_alloc_goal; #ifdef EXT3_PREALLOCATE __u32 i_prealloc_block;