summaryrefslogtreecommitdiffstats
path: root/fs/ext4
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2011-01-10 18:30:39 +0100
committerTheodore Ts'o <tytso@mit.edu>2011-01-10 18:30:39 +0100
commitca6e909f9bebe709bc65a3ee605ce32969db0452 (patch)
treedb7d324b995ff5fe74dcce00c9bf8c4da3adc5e3 /fs/ext4
parentext4: fix uninitialized variable in ext4_register_li_request (diff)
downloadlinux-ca6e909f9bebe709bc65a3ee605ce32969db0452.tar.xz
linux-ca6e909f9bebe709bc65a3ee605ce32969db0452.zip
ext4: fix trimming of a single group
When ext4_trim_fs() is called to trim a part of a single group, the logic will wrongly set last block of the interval to 'len' instead of 'first_block + len'. Thus a shorter interval is possibly trimmed. Fix it. CC: Lukas Czerner <lczerner@redhat.com> Cc: stable@kernel.org Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
-rw-r--r--fs/ext4/mballoc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index d47a80ec231d..21ee30b86de5 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -4860,7 +4860,7 @@ int ext4_trim_fs(struct super_block *sb, struct fstrim_range *range)
if (len >= EXT4_BLOCKS_PER_GROUP(sb))
len -= (EXT4_BLOCKS_PER_GROUP(sb) - first_block);
else
- last_block = len;
+ last_block = first_block + len;
if (e4b.bd_info->bb_free >= minlen) {
cnt = ext4_trim_all_free(sb, &e4b, first_block,