Commit 61432dbc authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] ext2/3 commentary and cleanup

- Add some (much-needed) commentary to the ext2/ext3 block allocator
  state fields.

- Remove the SEARCH_FROM_ZERO debug code.  I wrote that to trigger
  some race and it hasn't been used in a year.
parent e386771c
......@@ -14,8 +14,29 @@ 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;
......
......@@ -39,13 +39,6 @@
#include "xattr.h"
#include "acl.h"
/*
* 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
/*
* Test whether an inode is a fast symlink.
*/
......@@ -510,10 +503,6 @@ static int ext3_find_goal(struct inode *inode, long block, Indirect chain[4],
ei->i_next_alloc_block++;
ei->i_next_alloc_goal++;
}
#ifdef SEARCH_FROM_ZERO
ei->i_next_alloc_block = 0;
ei->i_next_alloc_goal = 0;
#endif
/* Writer: end */
/* Reader: pointers, ->i_next_alloc* */
if (verify_chain(chain, partial)) {
......@@ -525,9 +514,6 @@ static int ext3_find_goal(struct inode *inode, long block, Indirect chain[4],
*goal = ei->i_next_alloc_goal;
if (!*goal)
*goal = ext3_find_near(inode, partial);
#ifdef SEARCH_FROM_ZERO
*goal = 0;
#endif
return 0;
}
/* Reader: end */
......@@ -673,10 +659,6 @@ static int ext3_splice_branch(handle_t *handle, struct inode *inode, long block,
*where->p = where->key;
ei->i_next_alloc_block = block;
ei->i_next_alloc_goal = le32_to_cpu(where[num-1].key);
#ifdef SEARCH_FROM_ZERO
ei->i_next_alloc_block = 0;
ei->i_next_alloc_goal = 0;
#endif
/* Writer: end */
/* We are done with atomic stuff, now do the rest of housekeeping */
......
......@@ -32,9 +32,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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment