diff options
author | Lukas Czerner <lczerner@redhat.com> | 2012-03-05 08:49:34 +0100 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2012-03-11 15:38:23 -0400 |
commit | deae60a087fceb3418efb8dd23ab557b767f925a (patch) | |
tree | 47b0c96845d0e5f8749c326bba0464adac30ab0a | |
parent | 467953263ebb406dcf27c92146d6e394bf2f94e5 (diff) | |
download | e2fsprogs-deae60a087fceb3418efb8dd23ab557b767f925a.tar.gz |
e2fsck: do not forget to discard last block group
Previously when running e2fsck with '-E discard' argument the end of
the last group has not been discarded. This patch fixes it so we
always discard the end of the last group if needed.
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r-- | e2fsck/pass5.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/e2fsck/pass5.c b/e2fsck/pass5.c index ca438cb8..e25f0804 100644 --- a/e2fsck/pass5.c +++ b/e2fsck/pass5.c @@ -387,6 +387,15 @@ redo_counts: if ((blocks == fs->super->s_clusters_per_group) || (EXT2FS_B2C(fs, i) == EXT2FS_B2C(fs, ext2fs_blocks_count(fs->super)-1))) { + /* + * If the last block of this group is free, then we can + * discard it as well. + */ + if (!bitmap && i >= first_free) + e2fsck_discard_blocks(ctx, first_free, + (i - first_free) + 1); + first_free = ext2fs_blocks_count(fs->super); + free_array[group] = group_free; group ++; blocks = 0; |