diff options
author | Akira Fujita <a-fujita@rs.jp.nec.com> | 2012-03-27 03:09:16 -0400 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2012-04-11 05:12:44 -0400 |
commit | ac0dd2474822fbd7d8e8cca12495e6b4760556cd (patch) | |
tree | 81c7d4a137500bd8bfe6824f70d7969736cc4785 /fs/ext3/ialloc.c | |
parent | 2db938bee32e7469ca8ed9bfb3a05535f28c680d (diff) |
ext3: remove max_debt in find_group_orlov()
max_debt, involved variables and calculations
are no longer needed, clean them up.
Signed-off-by: Akira Fujita <a-fujita@rs.jp.nec.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/ext3/ialloc.c')
-rw-r--r-- | fs/ext3/ialloc.c | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/fs/ext3/ialloc.c b/fs/ext3/ialloc.c index e3c39e4cec19..082afd78b107 100644 --- a/fs/ext3/ialloc.c +++ b/fs/ext3/ialloc.c | |||
@@ -180,8 +180,7 @@ error_return: | |||
180 | * It's OK to put directory into a group unless | 180 | * It's OK to put directory into a group unless |
181 | * it has too many directories already (max_dirs) or | 181 | * it has too many directories already (max_dirs) or |
182 | * it has too few free inodes left (min_inodes) or | 182 | * it has too few free inodes left (min_inodes) or |
183 | * it has too few free blocks left (min_blocks) or | 183 | * it has too few free blocks left (min_blocks). |
184 | * it's already running too large debt (max_debt). | ||
185 | * Parent's group is preferred, if it doesn't satisfy these | 184 | * Parent's group is preferred, if it doesn't satisfy these |
186 | * conditions we search cyclically through the rest. If none | 185 | * conditions we search cyclically through the rest. If none |
187 | * of the groups look good we just look for a group with more | 186 | * of the groups look good we just look for a group with more |
@@ -191,21 +190,16 @@ error_return: | |||
191 | * when we allocate an inode, within 0--255. | 190 | * when we allocate an inode, within 0--255. |
192 | */ | 191 | */ |
193 | 192 | ||
194 | #define INODE_COST 64 | ||
195 | #define BLOCK_COST 256 | ||
196 | |||
197 | static int find_group_orlov(struct super_block *sb, struct inode *parent) | 193 | static int find_group_orlov(struct super_block *sb, struct inode *parent) |
198 | { | 194 | { |
199 | int parent_group = EXT3_I(parent)->i_block_group; | 195 | int parent_group = EXT3_I(parent)->i_block_group; |
200 | struct ext3_sb_info *sbi = EXT3_SB(sb); | 196 | struct ext3_sb_info *sbi = EXT3_SB(sb); |
201 | struct ext3_super_block *es = sbi->s_es; | ||
202 | int ngroups = sbi->s_groups_count; | 197 | int ngroups = sbi->s_groups_count; |
203 | int inodes_per_group = EXT3_INODES_PER_GROUP(sb); | 198 | int inodes_per_group = EXT3_INODES_PER_GROUP(sb); |
204 | unsigned int freei, avefreei; | 199 | unsigned int freei, avefreei; |
205 | ext3_fsblk_t freeb, avefreeb; | 200 | ext3_fsblk_t freeb, avefreeb; |
206 | ext3_fsblk_t blocks_per_dir; | ||
207 | unsigned int ndirs; | 201 | unsigned int ndirs; |
208 | int max_debt, max_dirs, min_inodes; | 202 | int max_dirs, min_inodes; |
209 | ext3_grpblk_t min_blocks; | 203 | ext3_grpblk_t min_blocks; |
210 | int group = -1, i; | 204 | int group = -1, i; |
211 | struct ext3_group_desc *desc; | 205 | struct ext3_group_desc *desc; |
@@ -242,20 +236,10 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent) | |||
242 | goto fallback; | 236 | goto fallback; |
243 | } | 237 | } |
244 | 238 | ||
245 | blocks_per_dir = (le32_to_cpu(es->s_blocks_count) - freeb) / ndirs; | ||
246 | |||
247 | max_dirs = ndirs / ngroups + inodes_per_group / 16; | 239 | max_dirs = ndirs / ngroups + inodes_per_group / 16; |
248 | min_inodes = avefreei - inodes_per_group / 4; | 240 | min_inodes = avefreei - inodes_per_group / 4; |
249 | min_blocks = avefreeb - EXT3_BLOCKS_PER_GROUP(sb) / 4; | 241 | min_blocks = avefreeb - EXT3_BLOCKS_PER_GROUP(sb) / 4; |
250 | 242 | ||
251 | max_debt = EXT3_BLOCKS_PER_GROUP(sb) / max(blocks_per_dir, (ext3_fsblk_t)BLOCK_COST); | ||
252 | if (max_debt * INODE_COST > inodes_per_group) | ||
253 | max_debt = inodes_per_group / INODE_COST; | ||
254 | if (max_debt > 255) | ||
255 | max_debt = 255; | ||
256 | if (max_debt == 0) | ||
257 | max_debt = 1; | ||
258 | |||
259 | for (i = 0; i < ngroups; i++) { | 243 | for (i = 0; i < ngroups; i++) { |
260 | group = (parent_group + i) % ngroups; | 244 | group = (parent_group + i) % ngroups; |
261 | desc = ext3_get_group_desc (sb, group, NULL); | 245 | desc = ext3_get_group_desc (sb, group, NULL); |