Skip to content

Commit

Permalink
ext4: fix trimmed block count accunting
Browse files Browse the repository at this point in the history
Currently when there is not enough free blocks in the block group to
discard (grp->bb_free < minlen) the 'trimmed' is bumped up anyway with
the number of discarded blocks from the previous iteration. Fix this
by bumping up 'trimmed' only if the ext4_trim_all_free() was actually
run.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
  • Loading branch information
Lukas Czerner authored and Theodore Ts'o committed Mar 22, 2012
1 parent 913eed8 commit 21e7fd2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/ext4/mballoc.c
Original file line number Diff line number Diff line change
Expand Up @@ -5026,8 +5026,8 @@ int ext4_trim_fs(struct super_block *sb, struct fstrim_range *range)
ret = cnt;
break;
}
trimmed += cnt;
}
trimmed += cnt;

/*
* For every group except the first one, we are sure
Expand Down

0 comments on commit 21e7fd2

Please sign in to comment.