xfs
[Top] [All Lists]

Re: [PATCH v3 3/7] xfs: cap prealloc size to free space before shift

To: Brian Foster <bfoster@xxxxxxxxxx>
Subject: Re: [PATCH v3 3/7] xfs: cap prealloc size to free space before shift
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Wed, 20 Feb 2013 08:48:42 +1100
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1361291851-24714-4-git-send-email-bfoster@xxxxxxxxxx>
References: <1361291851-24714-1-git-send-email-bfoster@xxxxxxxxxx> <1361291851-24714-4-git-send-email-bfoster@xxxxxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
On Tue, Feb 19, 2013 at 11:37:27AM -0500, Brian Foster wrote:
> With the addition of quota preallocation throttling, we want to
> support a general algorithm that considers the maximum allowable
> prealloc size and recommended shift modifier from various sources
> (i.e., global fs state and all applicable quotas for an inode).
> 
> Update the current global free space throttle algorithm to cap the
> preallocation size to the free space available in the filesystem.
> 
> Signed-off-by: Brian Foster <bfoster@xxxxxxxxxx>
> ---
>  fs/xfs/xfs_iomap.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
> index daa08f6..3b41c18 100644
> --- a/fs/xfs/xfs_iomap.c
> +++ b/fs/xfs/xfs_iomap.c
> @@ -412,6 +412,9 @@ xfs_iomap_prealloc_size(
>               if (freesp < mp->m_low_space[XFS_LOWSP_1_PCNT])
>                       shift++;
>       }
> +     if (alloc_blocks > freesp)
> +             alloc_blocks = freesp;
> +
>       if (shift)
>               alloc_blocks >>= shift;

This is redundant with the previous additions of the trailing

        while (alloc_blocks >= freesp)
                alloc_blocks >>= 4;

code. Effectively adding the check will result in preventing the
existing loop from working as alloc_blocks will be brought down to
just under freespc by things like power of 2 rounding, rather than
being thottled to a small fraction of the remaining free space...

Cheers,

Dave.
-- 
Dave Chinner
david@xxxxxxxxxxxxx

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