GFS2: make sure fallocate bytes is a multiple of blksize
commite804ff107806d691c7aae6d94a4c64abd53ca05d
authorBenjamin Marzinski <bmarzins@redhat.com>
Tue, 26 Apr 2011 06:13:24 +0000 (26 01:13 -0500)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 3 Aug 2011 19:42:38 +0000 (3 12:42 -0700)
treed6426fd79d4d621fd7da4c181c4b198193ac9000
parent209f2c8170f4a5e96a98c95c0c38489f24eb1858
GFS2: make sure fallocate bytes is a multiple of blksize

commit 6905d9e4dda6112f007e9090bca80507da158e63 upstream.

The GFS2 fallocate code chooses a target size to for allocating chunks of
space.  Whenever it can't find any resource groups with enough space free, it
halves its target. Since this target is in bytes, eventually it will no longer
be a multiple of blksize.  As long as there is more space available in the
resource group than the target, this isn't a problem, since gfs2 will use the
actual space available, which is always a multiple of blksize.  However,
when gfs couldn't fallocate a bigger chunk than the target, it was using the
non-blksize aligned number. This caused a BUG in later code that required
blksize aligned offsets.  GFS2 now ensures that bytes is always a multiple of
blksize

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/gfs2/file.c