gfs2: allow fallocate to max out quotas/fs efficiently
authorAbhi Das <adas@redhat.com>
Wed, 18 Mar 2015 17:05:15 +0000 (12:05 -0500)
committerBob Peterson <rpeterso@redhat.com>
Wed, 18 Mar 2015 17:48:02 +0000 (12:48 -0500)
commitd9be0cda774e7fe36651b04a89a42e9e354e43c3
tree4ead90ff02660236e445fe0666f5c57e39761e67
parent25435e5ed611f310dda889940cbc4c45b3ecd9ec
gfs2: allow fallocate to max out quotas/fs efficiently

We can quickly get an estimate of how many blocks are available
for allocation restricted by quota and fs size respectively, using
the ap->allowed field in the gfs2_alloc_parms structure.
gfs2_quota_check() and gfs2_inplace_reserve() provide these values.

Once we have the total number of blocks available to us, we can
compute how many bytes of data can be written using those blocks
instead of guessing inefficiently.

Signed-off-by: Abhi Das <adas@redhat.com>
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Acked-by: Steven Whitehouse <swhiteho@redhat.com>
fs/gfs2/file.c