xfs: add quota-driven speculative preallocation throttling
authorBrian Foster <bfoster@redhat.com>
Mon, 18 Mar 2013 14:51:47 +0000 (10:51 -0400)
committerBen Myers <bpm@sgi.com>
Fri, 22 Mar 2013 21:07:21 +0000 (16:07 -0500)
commit76a4202a388690e664668c4f668ee12d709100b3
treec10ea589bed0223d520d3ff843dd65a7e72c5115
parentb136645116e5471cf0b037a1759dc83620236631
xfs: add quota-driven speculative preallocation throttling

Introduce the need_throttle() and calc_throttle() functions to
independently check whether throttling is required for a particular
dquot and if so, calculate the associated throttling metrics based
on the state of the quota. We use the same general algorithm to
calculate the throttle shift as for global free space with the
exception of using three stages rather than five.

Update xfs_iomap_prealloc_size() to use the smallest available
prealloc size based on each of the constraints and apply the
maximum shift to obtain the throttled preallocation size.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Mark Tinguely <tinguely@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
fs/xfs/xfs_iomap.c