[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-xfs
Subject:    Re: howto preallocate to minimize fragmentation
From:       Eric Sandeen <sandeen () sgi ! com>
Date:       2005-09-23 12:58:09
Message-ID: 4333FBE1.2080400 () sgi ! com
[Download RAW message or body]

Ying-Hung Chen wrote:
> 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

run xfs_bmap on the resulting file and you'll see...

> so, if I write anything within this 20MB
> range, it will be writing to the allocated space and hence no
> fragmentation? 

right.

> what happens if I go over? my guess is if i go over, xfs
> allocation algorithm will be and there will be fragamentation?

well it depends on what else is going on; if there is plenty of free 
space after that 20M, then no.  but if you have parallel streams 
writing, then fragmentation past the amount of space you allocated is 
likely.

-Eric


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic