xfs
[Top] [All Lists]

Re: disable preallocation

To: Iustin Pop <iusty@xxxxxxxxx>
Subject: Re: disable preallocation
From: Ming Zhang <mingz@xxxxxxxxxxx>
Date: Tue, 18 Apr 2006 20:34:05 -0400
Cc: linux-xfs@xxxxxxxxxxx
In-reply-to: <20060419000409.GD3300@xxxxxxxxxxxxxxxxx>
References: <1145391567.8601.183.camel@xxxxxxxxxxxxxxxxxxxxx> <20060418214252.GA3300@xxxxxxxxxxxxxxxxx> <1145397286.8601.202.camel@xxxxxxxxxxxxxxxxxxxxx> <20060418223553.GB3300@xxxxxxxxxxxxxxxxx> <1145401592.8601.211.camel@xxxxxxxxxxxxxxxxxxxxx> <20060418232920.GC3300@xxxxxxxxxxxxxxxxx> <1145404885.8601.214.camel@xxxxxxxxxxxxxxxxxxxxx> <20060419000409.GD3300@xxxxxxxxxxxxxxxxx>
Reply-to: mingz@xxxxxxxxxxx
Sender: linux-xfs-bounce@xxxxxxxxxxx
On Wed, 2006-04-19 at 02:04 +0200, Iustin Pop wrote:
> On Tue, Apr 18, 2006 at 08:01:25PM -0400, Ming Zhang wrote:
> > On Wed, 2006-04-19 at 01:29 +0200, Iustin Pop wrote:
> > > On Tue, Apr 18, 2006 at 07:06:32PM -0400, Ming Zhang wrote:
> > > > ;) if that block is preserved already, what happen when there is a read
> > > > on that LBA? read return 0 or read from preserved block?
> > > > 
> > > > assume i write LBA 0 4KB and then ext2 preserve LBA 8-16 for this file,
> > > > then a read on that will return what?
> > > 
> > > So - you have a new file. You write 4KB at offset 0. ext2, behind your
> > > back, as an optimisation, will pre-allocate space the next three blocks
> > > (from 4097 to 16385). 
> > > 
> > > And now you try to read them. You will not get 0, you will not get
> > > random data, you will get EOF. Simple as that - preallocation is an
> > > optimisation which is transparent to the userspace. Since you did not
> > > write that data, you are not able to read it. Not as 0, not as random.
> > 
> > so one step further. if i seek to somewhere like LBA=1000, and write
> > some data, then come back and read this LBA 8, what i got? not EOF
> > right?
> 
> No, ignoring rounding issues (holes occur only on entire blocks), there
> will be a hole between lba 8 and 1000. You will get 0 in that range.
> This is mandated by posix standards.  I don't know how pre-allocation
> interacts with that, but you won't get random data.

so u mean even there are preallocated space, file system should be able
to know that is a hole, and that space is preallocated, not prewritten,
and it will return all 0? where is this posix standard i can check? thx

ming



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