summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorngkaho1234 <ngkaho1234@gmail.com>2015-10-27 20:49:44 +0800
committerngkaho1234 <ngkaho1234@gmail.com>2015-10-27 20:49:44 +0800
commit76208824002dca9dffab5ee03fe66239ad4493b3 (patch)
treec4ba9bb7bba4757a82a424fb232b2511f396caf1
parentb5b25a0e9d3ffaa663e3a94540442f19d8df1883 (diff)
FIX: wrong accounting caused by EXT2_BG_INODE_ZEROED
-rw-r--r--lwext4/ext4_ialloc.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/lwext4/ext4_ialloc.c b/lwext4/ext4_ialloc.c
index a837f13..f2863d0 100644
--- a/lwext4/ext4_ialloc.c
+++ b/lwext4/ext4_ialloc.c
@@ -285,22 +285,16 @@ int ext4_ialloc_alloc_inode(struct ext4_fs *fs, uint32_t *index, bool is_dir)
}
/* Decrease unused inodes count */
- if (ext4_bg_has_flag(bg,
- EXT4_BLOCK_GROUP_ITABLE_ZEROED)) {
- uint32_t unused =
- ext4_bg_get_itable_unused(bg, sb);
+ uint32_t unused =
+ ext4_bg_get_itable_unused(bg, sb);
- uint32_t inodes_in_group =
- ext4_inodes_in_group_cnt(sb, bgid);
+ uint32_t free = inodes_in_group - unused;
- uint32_t free = inodes_in_group - unused;
-
- if (index_in_group >= free) {
- unused = inodes_in_group -
- (index_in_group + 1);
- ext4_bg_set_itable_unused(bg, sb,
- unused);
- }
+ if (index_in_group >= free) {
+ unused = inodes_in_group -
+ (index_in_group + 1);
+ ext4_bg_set_itable_unused(bg, sb,
+ unused);
}
/* Save modified block group */