diff options
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/ialloc.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c index 427f83066a0d..d0c7793d9393 100644 --- a/fs/ext4/ialloc.c +++ b/fs/ext4/ialloc.c | |||
@@ -204,14 +204,13 @@ static int find_group_dir(struct super_block *sb, struct inode *parent) | |||
204 | int ngroups = EXT4_SB(sb)->s_groups_count; | 204 | int ngroups = EXT4_SB(sb)->s_groups_count; |
205 | unsigned int freei, avefreei; | 205 | unsigned int freei, avefreei; |
206 | struct ext4_group_desc *desc, *best_desc = NULL; | 206 | struct ext4_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(&EXT4_SB(sb)->s_freeinodes_counter); | 209 | freei = percpu_counter_read_positive(&EXT4_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 = ext4_get_group_desc (sb, group, &bh); | 213 | desc = ext4_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 | ext4_grpblk_t min_blocks; | 268 | ext4_grpblk_t min_blocks; |
270 | int group = -1, i; | 269 | int group = -1, i; |
271 | struct ext4_group_desc *desc; | 270 | struct ext4_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; |
@@ -287,7 +285,7 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent) | |||
287 | parent_group = (unsigned)group % ngroups; | 285 | parent_group = (unsigned)group % ngroups; |
288 | for (i = 0; i < ngroups; i++) { | 286 | for (i = 0; i < ngroups; i++) { |
289 | group = (parent_group + i) % ngroups; | 287 | group = (parent_group + i) % ngroups; |
290 | desc = ext4_get_group_desc (sb, group, &bh); | 288 | desc = ext4_get_group_desc (sb, group, NULL); |
291 | if (!desc || !desc->bg_free_inodes_count) | 289 | if (!desc || !desc->bg_free_inodes_count) |
292 | continue; | 290 | continue; |
293 | if (le16_to_cpu(desc->bg_used_dirs_count) >= best_ndir) | 291 | if (le16_to_cpu(desc->bg_used_dirs_count) >= best_ndir) |
@@ -322,7 +320,7 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent) | |||
322 | 320 | ||
323 | for (i = 0; i < ngroups; i++) { | 321 | for (i = 0; i < ngroups; i++) { |
324 | group = (parent_group + i) % ngroups; | 322 | group = (parent_group + i) % ngroups; |
325 | desc = ext4_get_group_desc (sb, group, &bh); | 323 | desc = ext4_get_group_desc (sb, group, NULL); |
326 | if (!desc || !desc->bg_free_inodes_count) | 324 | if (!desc || !desc->bg_free_inodes_count) |
327 | continue; | 325 | continue; |
328 | if (le16_to_cpu(desc->bg_used_dirs_count) >= max_dirs) | 326 | if (le16_to_cpu(desc->bg_used_dirs_count) >= max_dirs) |
@@ -337,7 +335,7 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent) | |||
337 | fallback: | 335 | fallback: |
338 | for (i = 0; i < ngroups; i++) { | 336 | for (i = 0; i < ngroups; i++) { |
339 | group = (parent_group + i) % ngroups; | 337 | group = (parent_group + i) % ngroups; |
340 | desc = ext4_get_group_desc (sb, group, &bh); | 338 | desc = ext4_get_group_desc (sb, group, NULL); |
341 | if (!desc || !desc->bg_free_inodes_count) | 339 | if (!desc || !desc->bg_free_inodes_count) |
342 | continue; | 340 | continue; |
343 | if (le16_to_cpu(desc->bg_free_inodes_count) >= avefreei) | 341 | if (le16_to_cpu(desc->bg_free_inodes_count) >= avefreei) |
@@ -361,14 +359,13 @@ static int find_group_other(struct super_block *sb, struct inode *parent) | |||
361 | int parent_group = EXT4_I(parent)->i_block_group; | 359 | int parent_group = EXT4_I(parent)->i_block_group; |
362 | int ngroups = EXT4_SB(sb)->s_groups_count; | 360 | int ngroups = EXT4_SB(sb)->s_groups_count; |
363 | struct ext4_group_desc *desc; | 361 | struct ext4_group_desc *desc; |
364 | struct buffer_head *bh; | ||
365 | int group, i; | 362 | int group, i; |
366 | 363 | ||
367 | /* | 364 | /* |
368 | * Try to place the inode in its parent directory | 365 | * Try to place the inode in its parent directory |
369 | */ | 366 | */ |
370 | group = parent_group; | 367 | group = parent_group; |
371 | desc = ext4_get_group_desc (sb, group, &bh); | 368 | desc = ext4_get_group_desc (sb, group, NULL); |
372 | if (desc && le16_to_cpu(desc->bg_free_inodes_count) && | 369 | if (desc && le16_to_cpu(desc->bg_free_inodes_count) && |
373 | le16_to_cpu(desc->bg_free_blocks_count)) | 370 | le16_to_cpu(desc->bg_free_blocks_count)) |
374 | return group; | 371 | return group; |
@@ -392,7 +389,7 @@ static int find_group_other(struct super_block *sb, struct inode *parent) | |||
392 | group += i; | 389 | group += i; |
393 | if (group >= ngroups) | 390 | if (group >= ngroups) |
394 | group -= ngroups; | 391 | group -= ngroups; |
395 | desc = ext4_get_group_desc (sb, group, &bh); | 392 | desc = ext4_get_group_desc (sb, group, NULL); |
396 | if (desc && le16_to_cpu(desc->bg_free_inodes_count) && | 393 | if (desc && le16_to_cpu(desc->bg_free_inodes_count) && |
397 | le16_to_cpu(desc->bg_free_blocks_count)) | 394 | le16_to_cpu(desc->bg_free_blocks_count)) |
398 | return group; | 395 | return group; |
@@ -406,7 +403,7 @@ static int find_group_other(struct super_block *sb, struct inode *parent) | |||
406 | for (i = 0; i < ngroups; i++) { | 403 | for (i = 0; i < ngroups; i++) { |
407 | if (++group >= ngroups) | 404 | if (++group >= ngroups) |
408 | group = 0; | 405 | group = 0; |
409 | desc = ext4_get_group_desc (sb, group, &bh); | 406 | desc = ext4_get_group_desc (sb, group, NULL); |
410 | if (desc && le16_to_cpu(desc->bg_free_inodes_count)) | 407 | if (desc && le16_to_cpu(desc->bg_free_inodes_count)) |
411 | return group; | 408 | return group; |
412 | } | 409 | } |