aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext3
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext3')
-rw-r--r--fs/ext3/ialloc.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/fs/ext3/ialloc.c b/fs/ext3/ialloc.c
index e45dbd651736..1bc8cd89c51d 100644
--- a/fs/ext3/ialloc.c
+++ b/fs/ext3/ialloc.c
@@ -204,14 +204,13 @@ static int find_group_dir(struct super_block *sb, struct inode *parent)
204 int ngroups = EXT3_SB(sb)->s_groups_count; 204 int ngroups = EXT3_SB(sb)->s_groups_count;
205 unsigned int freei, avefreei; 205 unsigned int freei, avefreei;
206 struct ext3_group_desc *desc, *best_desc = NULL; 206 struct ext3_group_desc *desc, *best_desc = NULL;
207 struct buffer_head *bh;
208 int group, best_group = -1; 207 int group, best_group = -1;
209 208
210 freei = percpu_counter_read_positive(&EXT3_SB(sb)->s_freeinodes_counter); 209 freei = percpu_counter_read_positive(&EXT3_SB(sb)->s_freeinodes_counter);
211 avefreei = freei / ngroups; 210 avefreei = freei / ngroups;
212 211
213 for (group = 0; group < ngroups; group++) { 212 for (group = 0; group < ngroups; group++) {
214 desc = ext3_get_group_desc (sb, group, &bh); 213 desc = ext3_get_group_desc (sb, group, NULL);
215 if (!desc || !desc->bg_free_inodes_count) 214 if (!desc || !desc->bg_free_inodes_count)
216 continue; 215 continue;
217 if (le16_to_cpu(desc->bg_free_inodes_count) < avefreei) 216 if (le16_to_cpu(desc->bg_free_inodes_count) < avefreei)
@@ -269,7 +268,6 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent)
269 ext3_grpblk_t min_blocks; 268 ext3_grpblk_t min_blocks;
270 int group = -1, i; 269 int group = -1, i;
271 struct ext3_group_desc *desc; 270 struct ext3_group_desc *desc;
272 struct buffer_head *bh;
273 271
274 freei = percpu_counter_read_positive(&sbi->s_freeinodes_counter); 272 freei = percpu_counter_read_positive(&sbi->s_freeinodes_counter);
275 avefreei = freei / ngroups; 273 avefreei = freei / ngroups;
@@ -286,7 +284,7 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent)
286 parent_group = (unsigned)group % ngroups; 284 parent_group = (unsigned)group % ngroups;
287 for (i = 0; i < ngroups; i++) { 285 for (i = 0; i < ngroups; i++) {
288 group = (parent_group + i) % ngroups; 286 group = (parent_group + i) % ngroups;
289 desc = ext3_get_group_desc (sb, group, &bh); 287 desc = ext3_get_group_desc (sb, group, NULL);
290 if (!desc || !desc->bg_free_inodes_count) 288 if (!desc || !desc->bg_free_inodes_count)
291 continue; 289 continue;
292 if (le16_to_cpu(desc->bg_used_dirs_count) >= best_ndir) 290 if (le16_to_cpu(desc->bg_used_dirs_count) >= best_ndir)
@@ -319,7 +317,7 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent)
319 317
320 for (i = 0; i < ngroups; i++) { 318 for (i = 0; i < ngroups; i++) {
321 group = (parent_group + i) % ngroups; 319 group = (parent_group + i) % ngroups;
322 desc = ext3_get_group_desc (sb, group, &bh); 320 desc = ext3_get_group_desc (sb, group, NULL);
323 if (!desc || !desc->bg_free_inodes_count) 321 if (!desc || !desc->bg_free_inodes_count)
324 continue; 322 continue;
325 if (le16_to_cpu(desc->bg_used_dirs_count) >= max_dirs) 323 if (le16_to_cpu(desc->bg_used_dirs_count) >= max_dirs)
@@ -334,7 +332,7 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent)
334fallback: 332fallback:
335 for (i = 0; i < ngroups; i++) { 333 for (i = 0; i < ngroups; i++) {
336 group = (parent_group + i) % ngroups; 334 group = (parent_group + i) % ngroups;
337 desc = ext3_get_group_desc (sb, group, &bh); 335 desc = ext3_get_group_desc (sb, group, NULL);
338 if (!desc || !desc->bg_free_inodes_count) 336 if (!desc || !desc->bg_free_inodes_count)
339 continue; 337 continue;
340 if (le16_to_cpu(desc->bg_free_inodes_count) >= avefreei) 338 if (le16_to_cpu(desc->bg_free_inodes_count) >= avefreei)
@@ -358,14 +356,13 @@ static int find_group_other(struct super_block *sb, struct inode *parent)
358 int parent_group = EXT3_I(parent)->i_block_group; 356 int parent_group = EXT3_I(parent)->i_block_group;
359 int ngroups = EXT3_SB(sb)->s_groups_count; 357 int ngroups = EXT3_SB(sb)->s_groups_count;
360 struct ext3_group_desc *desc; 358 struct ext3_group_desc *desc;
361 struct buffer_head *bh;
362 int group, i; 359 int group, i;
363 360
364 /* 361 /*
365 * Try to place the inode in its parent directory 362 * Try to place the inode in its parent directory
366 */ 363 */
367 group = parent_group; 364 group = parent_group;
368 desc = ext3_get_group_desc (sb, group, &bh); 365 desc = ext3_get_group_desc (sb, group, NULL);
369 if (desc && le16_to_cpu(desc->bg_free_inodes_count) && 366 if (desc && le16_to_cpu(desc->bg_free_inodes_count) &&
370 le16_to_cpu(desc->bg_free_blocks_count)) 367 le16_to_cpu(desc->bg_free_blocks_count))
371 return group; 368 return group;
@@ -389,7 +386,7 @@ static int find_group_other(struct super_block *sb, struct inode *parent)
389 group += i; 386 group += i;
390 if (group >= ngroups) 387 if (group >= ngroups)
391 group -= ngroups; 388 group -= ngroups;
392 desc = ext3_get_group_desc (sb, group, &bh); 389 desc = ext3_get_group_desc (sb, group, NULL);
393 if (desc && le16_to_cpu(desc->bg_free_inodes_count) && 390 if (desc && le16_to_cpu(desc->bg_free_inodes_count) &&
394 le16_to_cpu(desc->bg_free_blocks_count)) 391 le16_to_cpu(desc->bg_free_blocks_count))
395 return group; 392 return group;
@@ -403,7 +400,7 @@ static int find_group_other(struct super_block *sb, struct inode *parent)
403 for (i = 0; i < ngroups; i++) { 400 for (i = 0; i < ngroups; i++) {
404 if (++group >= ngroups) 401 if (++group >= ngroups)
405 group = 0; 402 group = 0;
406 desc = ext3_get_group_desc (sb, group, &bh); 403 desc = ext3_get_group_desc (sb, group, NULL);
407 if (desc && le16_to_cpu(desc->bg_free_inodes_count)) 404 if (desc && le16_to_cpu(desc->bg_free_inodes_count))
408 return group; 405 return group;
409 } 406 }