diff options
Diffstat (limited to 'fs/ext2/ialloc.c')
-rw-r--r-- | fs/ext2/ialloc.c | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c index 4a9746b9afb7..2625a00c4669 100644 --- a/fs/ext2/ialloc.c +++ b/fs/ext2/ialloc.c | |||
@@ -177,7 +177,6 @@ static void ext2_preread_inode(struct inode *inode) | |||
177 | unsigned long block_group; | 177 | unsigned long block_group; |
178 | unsigned long offset; | 178 | unsigned long offset; |
179 | unsigned long block; | 179 | unsigned long block; |
180 | struct buffer_head *bh; | ||
181 | struct ext2_group_desc * gdp; | 180 | struct ext2_group_desc * gdp; |
182 | struct backing_dev_info *bdi; | 181 | struct backing_dev_info *bdi; |
183 | 182 | ||
@@ -188,7 +187,7 @@ static void ext2_preread_inode(struct inode *inode) | |||
188 | return; | 187 | return; |
189 | 188 | ||
190 | block_group = (inode->i_ino - 1) / EXT2_INODES_PER_GROUP(inode->i_sb); | 189 | block_group = (inode->i_ino - 1) / EXT2_INODES_PER_GROUP(inode->i_sb); |
191 | gdp = ext2_get_group_desc(inode->i_sb, block_group, &bh); | 190 | gdp = ext2_get_group_desc(inode->i_sb, block_group, NULL); |
192 | if (gdp == NULL) | 191 | if (gdp == NULL) |
193 | return; | 192 | return; |
194 | 193 | ||
@@ -217,11 +216,10 @@ static int find_group_dir(struct super_block *sb, struct inode *parent) | |||
217 | int ngroups = EXT2_SB(sb)->s_groups_count; | 216 | int ngroups = EXT2_SB(sb)->s_groups_count; |
218 | int avefreei = ext2_count_free_inodes(sb) / ngroups; | 217 | int avefreei = ext2_count_free_inodes(sb) / ngroups; |
219 | struct ext2_group_desc *desc, *best_desc = NULL; | 218 | struct ext2_group_desc *desc, *best_desc = NULL; |
220 | struct buffer_head *bh, *best_bh = NULL; | ||
221 | int group, best_group = -1; | 219 | int group, best_group = -1; |
222 | 220 | ||
223 | for (group = 0; group < ngroups; group++) { | 221 | for (group = 0; group < ngroups; group++) { |
224 | desc = ext2_get_group_desc (sb, group, &bh); | 222 | desc = ext2_get_group_desc (sb, group, NULL); |
225 | if (!desc || !desc->bg_free_inodes_count) | 223 | if (!desc || !desc->bg_free_inodes_count) |
226 | continue; | 224 | continue; |
227 | if (le16_to_cpu(desc->bg_free_inodes_count) < avefreei) | 225 | if (le16_to_cpu(desc->bg_free_inodes_count) < avefreei) |
@@ -231,7 +229,6 @@ static int find_group_dir(struct super_block *sb, struct inode *parent) | |||
231 | le16_to_cpu(best_desc->bg_free_blocks_count))) { | 229 | le16_to_cpu(best_desc->bg_free_blocks_count))) { |
232 | best_group = group; | 230 | best_group = group; |
233 | best_desc = desc; | 231 | best_desc = desc; |
234 | best_bh = bh; | ||
235 | } | 232 | } |
236 | } | 233 | } |
237 | if (!best_desc) | 234 | if (!best_desc) |
@@ -284,7 +281,6 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent) | |||
284 | int max_debt, max_dirs, min_blocks, min_inodes; | 281 | int max_debt, max_dirs, min_blocks, min_inodes; |
285 | int group = -1, i; | 282 | int group = -1, i; |
286 | struct ext2_group_desc *desc; | 283 | struct ext2_group_desc *desc; |
287 | struct buffer_head *bh; | ||
288 | 284 | ||
289 | freei = percpu_counter_read_positive(&sbi->s_freeinodes_counter); | 285 | freei = percpu_counter_read_positive(&sbi->s_freeinodes_counter); |
290 | avefreei = freei / ngroups; | 286 | avefreei = freei / ngroups; |
@@ -295,7 +291,6 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent) | |||
295 | if ((parent == sb->s_root->d_inode) || | 291 | if ((parent == sb->s_root->d_inode) || |
296 | (EXT2_I(parent)->i_flags & EXT2_TOPDIR_FL)) { | 292 | (EXT2_I(parent)->i_flags & EXT2_TOPDIR_FL)) { |
297 | struct ext2_group_desc *best_desc = NULL; | 293 | struct ext2_group_desc *best_desc = NULL; |
298 | struct buffer_head *best_bh = NULL; | ||
299 | int best_ndir = inodes_per_group; | 294 | int best_ndir = inodes_per_group; |
300 | int best_group = -1; | 295 | int best_group = -1; |
301 | 296 | ||
@@ -303,7 +298,7 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent) | |||
303 | parent_group = (unsigned)group % ngroups; | 298 | parent_group = (unsigned)group % ngroups; |
304 | for (i = 0; i < ngroups; i++) { | 299 | for (i = 0; i < ngroups; i++) { |
305 | group = (parent_group + i) % ngroups; | 300 | group = (parent_group + i) % ngroups; |
306 | desc = ext2_get_group_desc (sb, group, &bh); | 301 | desc = ext2_get_group_desc (sb, group, NULL); |
307 | if (!desc || !desc->bg_free_inodes_count) | 302 | if (!desc || !desc->bg_free_inodes_count) |
308 | continue; | 303 | continue; |
309 | if (le16_to_cpu(desc->bg_used_dirs_count) >= best_ndir) | 304 | if (le16_to_cpu(desc->bg_used_dirs_count) >= best_ndir) |
@@ -315,11 +310,9 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent) | |||
315 | best_group = group; | 310 | best_group = group; |
316 | best_ndir = le16_to_cpu(desc->bg_used_dirs_count); | 311 | best_ndir = le16_to_cpu(desc->bg_used_dirs_count); |
317 | best_desc = desc; | 312 | best_desc = desc; |
318 | best_bh = bh; | ||
319 | } | 313 | } |
320 | if (best_group >= 0) { | 314 | if (best_group >= 0) { |
321 | desc = best_desc; | 315 | desc = best_desc; |
322 | bh = best_bh; | ||
323 | group = best_group; | 316 | group = best_group; |
324 | goto found; | 317 | goto found; |
325 | } | 318 | } |
@@ -345,7 +338,7 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent) | |||
345 | 338 | ||
346 | for (i = 0; i < ngroups; i++) { | 339 | for (i = 0; i < ngroups; i++) { |
347 | group = (parent_group + i) % ngroups; | 340 | group = (parent_group + i) % ngroups; |
348 | desc = ext2_get_group_desc (sb, group, &bh); | 341 | desc = ext2_get_group_desc (sb, group, NULL); |
349 | if (!desc || !desc->bg_free_inodes_count) | 342 | if (!desc || !desc->bg_free_inodes_count) |
350 | continue; | 343 | continue; |
351 | if (sbi->s_debts[group] >= max_debt) | 344 | if (sbi->s_debts[group] >= max_debt) |
@@ -362,7 +355,7 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent) | |||
362 | fallback: | 355 | fallback: |
363 | for (i = 0; i < ngroups; i++) { | 356 | for (i = 0; i < ngroups; i++) { |
364 | group = (parent_group + i) % ngroups; | 357 | group = (parent_group + i) % ngroups; |
365 | desc = ext2_get_group_desc (sb, group, &bh); | 358 | desc = ext2_get_group_desc (sb, group, NULL); |
366 | if (!desc || !desc->bg_free_inodes_count) | 359 | if (!desc || !desc->bg_free_inodes_count) |
367 | continue; | 360 | continue; |
368 | if (le16_to_cpu(desc->bg_free_inodes_count) >= avefreei) | 361 | if (le16_to_cpu(desc->bg_free_inodes_count) >= avefreei) |
@@ -389,14 +382,13 @@ static int find_group_other(struct super_block *sb, struct inode *parent) | |||
389 | int parent_group = EXT2_I(parent)->i_block_group; | 382 | int parent_group = EXT2_I(parent)->i_block_group; |
390 | int ngroups = EXT2_SB(sb)->s_groups_count; | 383 | int ngroups = EXT2_SB(sb)->s_groups_count; |
391 | struct ext2_group_desc *desc; | 384 | struct ext2_group_desc *desc; |
392 | struct buffer_head *bh; | ||
393 | int group, i; | 385 | int group, i; |
394 | 386 | ||
395 | /* | 387 | /* |
396 | * Try to place the inode in its parent directory | 388 | * Try to place the inode in its parent directory |
397 | */ | 389 | */ |
398 | group = parent_group; | 390 | group = parent_group; |
399 | desc = ext2_get_group_desc (sb, group, &bh); | 391 | desc = ext2_get_group_desc (sb, group, NULL); |
400 | if (desc && le16_to_cpu(desc->bg_free_inodes_count) && | 392 | if (desc && le16_to_cpu(desc->bg_free_inodes_count) && |
401 | le16_to_cpu(desc->bg_free_blocks_count)) | 393 | le16_to_cpu(desc->bg_free_blocks_count)) |
402 | goto found; | 394 | goto found; |
@@ -420,7 +412,7 @@ static int find_group_other(struct super_block *sb, struct inode *parent) | |||
420 | group += i; | 412 | group += i; |
421 | if (group >= ngroups) | 413 | if (group >= ngroups) |
422 | group -= ngroups; | 414 | group -= ngroups; |
423 | desc = ext2_get_group_desc (sb, group, &bh); | 415 | desc = ext2_get_group_desc (sb, group, NULL); |
424 | if (desc && le16_to_cpu(desc->bg_free_inodes_count) && | 416 | if (desc && le16_to_cpu(desc->bg_free_inodes_count) && |
425 | le16_to_cpu(desc->bg_free_blocks_count)) | 417 | le16_to_cpu(desc->bg_free_blocks_count)) |
426 | goto found; | 418 | goto found; |
@@ -434,7 +426,7 @@ static int find_group_other(struct super_block *sb, struct inode *parent) | |||
434 | for (i = 0; i < ngroups; i++) { | 426 | for (i = 0; i < ngroups; i++) { |
435 | if (++group >= ngroups) | 427 | if (++group >= ngroups) |
436 | group = 0; | 428 | group = 0; |
437 | desc = ext2_get_group_desc (sb, group, &bh); | 429 | desc = ext2_get_group_desc (sb, group, NULL); |
438 | if (desc && le16_to_cpu(desc->bg_free_inodes_count)) | 430 | if (desc && le16_to_cpu(desc->bg_free_inodes_count)) |
439 | goto found; | 431 | goto found; |
440 | } | 432 | } |