Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 139499
b: refs/heads/master
c: 7d39db1
h: refs/heads/master
i:
  139497: 6b9622f
  139495: 113d5f3
v: v3
  • Loading branch information
Theodore Ts'o committed Mar 5, 2009
1 parent fc0af07 commit d58d9ab
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 18 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9f24e4208f7ee2748f157368b63287dc903fcf60
refs/heads/master: 7d39db14a42cbd719c7515b9da8f85a2eb6a0633
1 change: 1 addition & 0 deletions trunk/fs/ext4/ext4.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ struct ext4_group_desc
struct flex_groups {
atomic_t free_inodes;
atomic_t free_blocks;
atomic_t used_dirs;
};

#define EXT4_BG_INODE_UNINIT 0x0001 /* Inode table/bitmap not in use */
Expand Down
45 changes: 28 additions & 17 deletions trunk/fs/ext4/ialloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,13 @@ void ext4_free_inode(handle_t *handle, struct inode *inode)
if (is_directory) {
count = ext4_used_dirs_count(sb, gdp) - 1;
ext4_used_dirs_set(sb, gdp, count);
if (sbi->s_log_groups_per_flex) {
ext4_group_t f;

f = ext4_flex_group(sbi, block_group);
atomic_dec(&sbi->s_flex_groups[f].free_inodes);
}

}
gdp->bg_checksum = ext4_group_desc_csum(sbi,
block_group, gdp);
Expand Down Expand Up @@ -424,25 +431,24 @@ void get_orlov_stats(struct super_block *sb, ext4_group_t g,
int flex_size, struct orlov_stats *stats)
{
struct ext4_group_desc *desc;
ext4_group_t ngroups = EXT4_SB(sb)->s_groups_count;
int i;

stats->free_inodes = 0;
stats->free_blocks = 0;
stats->used_dirs = 0;
struct flex_groups *flex_group = EXT4_SB(sb)->s_flex_groups;

g *= flex_size;

for (i = 0; i < flex_size; i++) {
if (g >= ngroups)
break;
desc = ext4_get_group_desc(sb, g++, NULL);
if (!desc)
continue;
if (flex_size > 1) {
stats->free_inodes = atomic_read(&flex_group[g].free_inodes);
stats->free_blocks = atomic_read(&flex_group[g].free_blocks);
stats->used_dirs = atomic_read(&flex_group[g].used_dirs);
return;
}

stats->free_inodes += ext4_free_inodes_count(sb, desc);
stats->free_blocks += ext4_free_blks_count(sb, desc);
stats->used_dirs += ext4_used_dirs_count(sb, desc);
desc = ext4_get_group_desc(sb, g, NULL);
if (desc) {
stats->free_inodes = ext4_free_inodes_count(sb, desc);
stats->free_blocks = ext4_free_blks_count(sb, desc);
stats->used_dirs = ext4_used_dirs_count(sb, desc);
} else {
stats->free_inodes = 0;
stats->free_blocks = 0;
stats->used_dirs = 0;
}
}

Expand Down Expand Up @@ -765,6 +771,11 @@ static int ext4_claim_inode(struct super_block *sb,
if (S_ISDIR(mode)) {
count = ext4_used_dirs_count(sb, gdp) + 1;
ext4_used_dirs_set(sb, gdp, count);
if (sbi->s_log_groups_per_flex) {
ext4_group_t f = ext4_flex_group(sbi, group);

atomic_inc(&sbi->s_flex_groups[f].free_inodes);
}
}
gdp->bg_checksum = ext4_group_desc_csum(sbi, group, gdp);
err_ret:
Expand Down
2 changes: 2 additions & 0 deletions trunk/fs/ext4/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -1634,6 +1634,8 @@ static int ext4_fill_flex_info(struct super_block *sb)
ext4_free_inodes_count(sb, gdp));
atomic_set(&sbi->s_flex_groups[flex_group].free_blocks,
ext4_free_blks_count(sb, gdp));
atomic_set(&sbi->s_flex_groups[flex_group].used_dirs,
ext4_used_dirs_count(sb, gdp));
}

return 1;
Expand Down

0 comments on commit d58d9ab

Please sign in to comment.