xfs
[Top] [All Lists]

Re: howto preallocate to minimize fragmentation

To: Eric Sandeen <sandeen@xxxxxxx>
Subject: Re: howto preallocate to minimize fragmentation
From: Ying-Hung Chen <ying@xxxxxxxxxxxxxx>
Date: Fri, 23 Sep 2005 14:31:12 +0800
Cc: linux-xfs@xxxxxxxxxxx
In-reply-to: <4332D17E.6060608@xxxxxxx>
References: <43329839.2070005@xxxxxxxxxxxxxx> <4332A22B.6070708@xxxxxxx> <4332BFCC.8050803@xxxxxxxxxxxxxx> <4332C248.70503@xxxxxxx> <4332C636.9070509@xxxxxxxxxxxxxx> <4332CE65.2000500@xxxxxxxxxxxxx> <4332CF04.2060604@xxxxxxxxxxxxxx> <4332D17E.6060608@xxxxxxx>
Sender: linux-xfs-bounce@xxxxxxxxxxx
User-agent: Mozilla Thunderbird 1.0.6 (Windows/20050716)
> 
> run xfs_bmap on a few files, and see how bad it really is.  That number
> can be misleading, sometimes.
> 
> but preallocation is an easy way to mitigate any fragmentation problems.
> 
> something like this:
> 

when I run the sample code, and created "testfile"

[yhchen@fc3 ~]$ ./xfs_fcntl testfile
[yhchen@fc3 ~]$ ls -l testfile
-rwx------  1 yhchen yhchen 0 Sep 23 14:17 testfile
[yhchen@fc3 ~]$ du testfile
20480   testfile
[yhchen@fc3 ~]$ du -h testfile
20M     testfile

I see the filesize is 0, but du does show 20MB

However, when I try to determine the file size via fseek, it returns 0.

so, what does this kind of allocation mean? does it really mean that it
DID allocate 20MB for this file so, if I write anything within this 20MB
range, it will be writing to the allocated space and hence no
fragmentation? what happens if I go over? my guess is if i go over, xfs
allocation algorithm will be and there will be fragamentation?

Thanks,

-Ying


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