[Top] [All Lists]

Re: [PATCH v4 5/6] xfs: add quota-driven speculative preallocation throt

To: Brian Foster <bfoster@xxxxxxxxxx>
Subject: Re: [PATCH v4 5/6] xfs: add quota-driven speculative preallocation throttling
From: Mark Tinguely <tinguely@xxxxxxx>
Date: Mon, 25 Feb 2013 15:44:10 -0600
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1361373019-30891-6-git-send-email-bfoster@xxxxxxxxxx>
References: <1361373019-30891-1-git-send-email-bfoster@xxxxxxxxxx> <1361373019-30891-6-git-send-email-bfoster@xxxxxxxxxx>
User-agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:9.0) Gecko/20120122 Thunderbird/9.0
On 02/20/13 09:10, Brian Foster wrote:
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@xxxxxxxxxx>

         * MAXEXTLEN is not a power of two value but we round the prealloc down
@@ -412,6 +472,28 @@ xfs_iomap_prealloc_size(
                if (freesp<  mp->m_low_space[XFS_LOWSP_1_PCNT])
+       /*
+        * Check each quota to cap the prealloc size and provide a shift
+        * value to throttle with.
+        */
+       if (xfs_quota_need_throttle(ip, XFS_DQ_USER, alloc_blocks))
+               xfs_quota_calc_throttle(ip, XFS_DQ_USER,&qblocks,&qshift);
+       if (xfs_quota_need_throttle(ip, XFS_DQ_GROUP, alloc_blocks))
+               xfs_quota_calc_throttle(ip, XFS_DQ_GROUP,&qblocks,&qshift);
+       if (xfs_quota_need_throttle(ip, XFS_DQ_PROJ, alloc_blocks))
+               xfs_quota_calc_throttle(ip, XFS_DQ_PROJ,&qblocks,&qshift);
+       /*
+        * The final prealloc size is set to the minimum of free space available
+        * in each of the quotas and the overall filesystem.
+        *
+        * The shift throttle value is set to the maximum value as determined by
+        * the global low free space values and per-quota low free space values.
+        */
+       alloc_blocks = MIN(alloc_blocks, qblocks);
+       shift = MAX(shift, qshift);
        if (shift)
                alloc_blocks>>= shift;

All the limits are applied from previous extents, quota and then the code from commit 055388a3 is applied:
        if (alloc_blocks < mp->m_writeio_blocks)
                alloc_blocks = mp->m_writeio_blocks;

we may not have mp->m_writeio_blocks left in the filesytem.
Doesn't the following make more sense?:

        if (alloc_blocks < mp->m_writeio_blocks)
                alloc_blocks = 0;



<Prev in Thread] Current Thread [Next in Thread>