]> git.baikalelectronics.ru Git - kernel.git/commit
ext4: fix trimming starting with block 0 with small blocksize
authorJan Kara <jack@suse.cz>
Tue, 11 Jan 2011 20:16:31 +0000 (15:16 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 11 Jan 2011 20:16:31 +0000 (15:16 -0500)
commit177e350a39528dbc57a80a0e7bc39ae3e789f57f
tree9c33ad74ee35181cb6d1a2e82da8df110919e47c
parentf3cb22c94495feeda0ee9683e25ed93eb7b0add4
ext4: fix trimming starting with block 0 with small blocksize

When s_first_data_block is not zero (which happens e.g. when block size is 1KB)
and trim ioctl is called to start trimming from block 0, the math in
ext4_get_group_no_and_offset() overflows. The overall result is that ioctl
returns EINVAL which is kind of unexpected and we probably don't want
userspace tools to bother with internal details of filesystem structure.
So just silently increase starting offset (and shorten length) when starting
block is below s_first_data_block.

CC: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
fs/ext4/mballoc.c