Re: file system defragmentation

Chris Wedgwood
2006-07-18T21:33:54Z

On Tue, Jul 18, 2006 at 12:59:39AM -0700, Cosmo Nova wrote:

> Hi, can I summarize by saying that, XFS still partition the volume
> into different allocation groups, but there is NO locking.

the allocator has per-AG locks

> Two files may write in the same allocation group and introduce
> fragments?

i'm not sure what you mean, but any number of files can be writing to
a single AG at once, the degree of fragmentation you will see depends
on the IO patterns and where there are writing

in the case of writing multiple large files in parallel in the same
directory the blocks do tend to interleave

> What is the maximum and typical number of allocation groups please?
> I can't find the numbers in the source code...

It's a 32-bit value, I'm not sure how practical very large values are
though.

> And for the buffer, Is preallocation the same as delayed allocation?

No, preallocation allocates space a head of time on disk so that later
when it's written the allocation process is simpler (or not needed)
and ideally also to reduce fragmentation by doing as much allocation
as possible at once.

Delayed allocation is simply the idea of doing the allocation as late
as possible so when you do have to flush the data to disk you can try
to make better decisions about where to place the blocks.

> If a file space allocation is delayed, what is the upper bound of
> the delayed size?

It depends on the platform and how often data is flushed from the OS.