[Top] [All Lists]

Re: understanding speculative preallocation

To: Ben Myers <bpm@xxxxxxx>
Subject: Re: understanding speculative preallocation
From: Jason Rosenberg <jbr@xxxxxxxxxxxx>
Date: Fri, 26 Jul 2013 17:11:55 -0400
Cc: stan@xxxxxxxxxxxxxxxxx, xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=squareup.com; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=gd28uTxu8qihEx67uEvJ8ByR7KQU/XGFx4aIB3YyuYM=; b=OtxX8MY2Y6ggUqGaamOD5dSjnOvwduAEJUNhGShhKE//38B9KLaR6sx/WWjcSwr8PO gb89PkUFe97JuoCS8e74ltOu+A20ke6sSTKD1zpUc7tUGE7QdOoOYeCZL/PJ2qc0WN9d PrSORdDNAc3kLWz/bKIufgR8eJlUXoPcivzBw=
In-reply-to: <CAA+BczSpn7Cu2rZWJ9Q2b1-Xh0365R9ykGxKHHymtRm2Q7xCuA@xxxxxxxxxxxxxx>
References: <1374823420041-35002.post@xxxxxxxxxxxxx> <20130726115021.GO13468@dastard> <CAA+BczQesNL2VmFmrcBNKXcM-Sfx0bXkXPRP5xMx6=Bv+NWrUA@xxxxxxxxxxxxxx> <51F2CD8B.8080207@xxxxxxxxxxxxxxxxx> <CAA+BczQGYoJVL0twvz2GRhH30teFPSJOsKWtofbXBrom4_Q6hg@xxxxxxxxxxxxxx> <20130726205018.GM3111@xxxxxxx> <CAA+BczSpn7Cu2rZWJ9Q2b1-Xh0365R9ykGxKHHymtRm2Q7xCuA@xxxxxxxxxxxxxx>
Is it safe to say that speculative preallocation will not be used if a file is opened read-only?

It turns out that the kafka server does indeed write lots of log files, and rotate them after they reach a max size, but never closes the files until the app exits, or until it deletes the files.  This is because it needs to make them available for reading, etc.   So, an obvious change for kafka might be to close each log file after rotating, and then re-open it read-only for consumers of the data.  Does that sound like a solution that would pro-actively release pre-allocated storage?



On Fri, Jul 26, 2013 at 5:04 PM, Jason Rosenberg <jbr@xxxxxxxxxxxx> wrote:
Thanks Ben,

This is helpful.

On Fri, Jul 26, 2013 at 4:50 PM, Ben Myers <bpm@xxxxxxx> wrote:
Hi Jason,

On Fri, Jul 26, 2013 at 04:38:21PM -0400, Jason Rosenberg wrote:
> Thanks for the info (most of it was, in fact, news to me).  I'm an
> application developer trying to debug a disk space problem, that's all.  So
> far, I've tracked it down to being an XFS issue.

The speculative block reservations have been an issue for awhile.  You are not
the first person to take issue with it.

> Regardless, is there a version history for XFS vis-a-via mainline Linux?

You can find a full version history for XFS back to 2.6.12 or so here:

If you're interested in going older than that look here:

The function you'll most likely want to track is xfs_iomap_write_delay, which
calls xfs_iomap_eof_want_preallocate, both of which are in fs/xfs/xfs_iomap.c.

Recently Brian Foster added a scanner to remove the speculative block
reservations on a timer which may give you some relief.  See
xfs_queue_eofblocks in fs/xfs/xfs_icache.c


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