[Top] [All Lists]

Re: Preallocation with direct IO?

To: "amit.sahrawat83@xxxxxxxxx" <amit.sahrawat83@xxxxxxxxx>
Subject: Re: Preallocation with direct IO?
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Fri, 30 Dec 2011 07:57:45 +1100
Cc: "hch@xxxxxxxxxxxxx" <hch@xxxxxxxxxxxxx>, "xfs@xxxxxxxxxxx" <xfs@xxxxxxxxxxx>
In-reply-to: <4efc665b.d139e30a.2f32.fffff97a@xxxxxxxxxxxxx>
References: <4efc665b.d139e30a.2f32.fffff97a@xxxxxxxxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
On Thu, Dec 29, 2011 at 01:10:49PM +0000, amit.sahrawat83@xxxxxxxxx wrote:
> Hi, I am using a test setup which is doing write using multiple
> threads using direct IO. The buffer size which is used to write is
> 512KB.  After continously running this for long duration - i
> observe that number of extents in each file is getting
> huge(2K..4K..). I observed that each extent is of 512KB(aligned to
> write buffer size). I wish to have low number of extents(i.e,
> reduce fragmentation)... In case of buffered IO- preallocation
> works good alongwith the mount option 'allocsize'. Is there
> anything which can be done for Direct IO?  Please advice for
> reducing fragmentation with direct IO.

Direct IO does not do any implicit preallocation. The filesystem
simply gets out of the way of direct IO as it is assumed you know
what you are doing.

i.e. you know how to use the fallocate() or ioctl(XFS_IOC_RESVSP64)
calls to preallocate space or to set up extent size hints to use
larger allocations than the IO being done during syscalls...


Dave Chinner

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