[Top] [All Lists]

Re: [PATCH] XFS: fix the description of 'allocsize=' mount option

To: sat <takeuchi_satoru@xxxxxxxxxxxxxx>
Subject: Re: [PATCH] XFS: fix the description of 'allocsize=' mount option
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Mon, 24 Feb 2014 23:06:29 +1100
Cc: xfs@xxxxxxxxxxx, Rob Landley <rob@xxxxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <530AE0E5.1090707@xxxxxxxxxxxxxx>
References: <530AE0E5.1090707@xxxxxxxxxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
On Mon, Feb 24, 2014 at 03:04:21PM +0900, sat wrote:
> From: Satoru Takeuchi <takeuchi_satoru@xxxxxxxxxxxxxx>
> The end-of-file preallocation size is dynamic by default.
> So the description about the default size of preallocation
> should be removed.
> Instead, adding the description about the initial size of
> dynamic preallocation is useful for users.
> Signed-off-by: Satoru Takeuchi <takeuchi_satoru@xxxxxxxxxxxxxx>
> Cc: Dave Chinner <david@xxxxxxxxxxxxx>
> Cc: Rob Landley <rob@xxxxxxxxxxx>
> ---
>  Documentation/filesystems/xfs.txt |   16 ++++++++--------
>  1 files changed, 8 insertions(+), 8 deletions(-)
> diff --git a/Documentation/filesystems/xfs.txt 
> b/Documentation/filesystems/xfs.txt
> index 5be51fd..30e57b0 100644
> --- a/Documentation/filesystems/xfs.txt
> +++ b/Documentation/filesystems/xfs.txt
> @@ -23,16 +23,16 @@ default behaviour.
>    allocsize=size
>       Sets the buffered I/O end-of-file preallocation size when
> -     doing delayed allocation writeout (default size is 64KiB).
> -     Valid values for this option are page size (typically 4KiB)
> -     through to 1GiB, inclusive, in power-of-2 increments.
> +     doing delayed allocation writeout. Valid values for this
> +     option are page size (typically 4KiB) through to 1GiB,
> +     inclusive, in power-of-2 increments.
>       The default behaviour is for dynamic end-of-file
> -     preallocation size, which uses a set of heuristics to
> -     optimise the preallocation size based on the current
> -     allocation patterns within the file and the access patterns
> -     to the file. Specifying a fixed allocsize value turns off
> -     the dynamic behaviour.
> +     preallocation size (initial size is 64KiB), which uses a

Actually, it isn't. The initial size of dynamic prealloc is
determined by a set of heuristics based on file size, filesystem
geometry and the existing extents on the file. It uses a default
of 64k if no optimisation heuristics trigger.

Therefore, it may actually be zero - we don't do any speculative
preallocation for small files until they grow past a specific
threshold. i.e. there is a small file optimisation heuristic that
takes precendence over the default, and so the comment about the
initial prealloc size being 64k is wrong. The initial prealloc size
is zero....

An example at the other end of the spectrumL we preallocate a chunk
of a file, then write past the end of the preallocated region. The
initial speculative preallocation is triggered once we pass the
preallocated region, and the heuristics can result in an initial
size anywhere in the range of zero (small file) to 2^21 blocks
(large, multi-GB file).

Hence I think that the generalised text saying "default is 64k and
is optimised based on heuristics" reflects the behaviour of the
algorithm much better than saying "<algorithmic heuristic>
and is optimised by algorithmic heuristics"....


Dave Chinner

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