diff options
author | Theodore Ts'o <tytso@mit.edu> | 2011-12-28 20:25:13 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2011-12-28 20:25:13 -0500 |
commit | 14c83c9fddf2e75bdd0c20f1072f35260e356484 (patch) | |
tree | 277c2c78f709048543b5eca3064ce3d98a7a3cf3 /fs | |
parent | 88635ca277adb67db34e88281817d1ce10713553 (diff) |
ext4: avoid counting the number of free inodes twice in find_group_orlov()
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ext4/ialloc.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c index 8fb6844f9734..cdafc05d79c9 100644 --- a/fs/ext4/ialloc.c +++ b/fs/ext4/ialloc.c | |||
@@ -358,7 +358,7 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent, | |||
358 | struct ext4_sb_info *sbi = EXT4_SB(sb); | 358 | struct ext4_sb_info *sbi = EXT4_SB(sb); |
359 | ext4_group_t real_ngroups = ext4_get_groups_count(sb); | 359 | ext4_group_t real_ngroups = ext4_get_groups_count(sb); |
360 | int inodes_per_group = EXT4_INODES_PER_GROUP(sb); | 360 | int inodes_per_group = EXT4_INODES_PER_GROUP(sb); |
361 | unsigned int freei, avefreei; | 361 | unsigned int freei, avefreei, grp_free; |
362 | ext4_fsblk_t freeb, avefreec; | 362 | ext4_fsblk_t freeb, avefreec; |
363 | unsigned int ndirs; | 363 | unsigned int ndirs; |
364 | int max_dirs, min_inodes; | 364 | int max_dirs, min_inodes; |
@@ -477,8 +477,8 @@ fallback_retry: | |||
477 | for (i = 0; i < ngroups; i++) { | 477 | for (i = 0; i < ngroups; i++) { |
478 | grp = (parent_group + i) % ngroups; | 478 | grp = (parent_group + i) % ngroups; |
479 | desc = ext4_get_group_desc(sb, grp, NULL); | 479 | desc = ext4_get_group_desc(sb, grp, NULL); |
480 | if (desc && ext4_free_inodes_count(sb, desc) && | 480 | grp_free = ext4_free_inodes_count(sb, desc); |
481 | ext4_free_inodes_count(sb, desc) >= avefreei) { | 481 | if (desc && grp_free && grp_free >= avefreei) { |
482 | *group = grp; | 482 | *group = grp; |
483 | return 0; | 483 | return 0; |
484 | } | 484 | } |