What might be the best way to "defrag" files.
I've noticed a /huge/ speedup when defrag'ing files using the following method:

create a new file in same directory
use ftruncate to set the new file's size the same as existing file
copy data from existing to new file
close both files and rename new file to the old file (atomic replace)


I recently did this to a .iso image for openSUSE 11.2:

openSUSE-11.2-DVD-x86_64.iso: 20517 extents found

turned into:

openSUSE-11.2-DVD-x86_64.iso: 23 extents found


However, how can I do better than that? Is there a way to get "1
extents"?  I have other .iso images of similar size with 1 extent.
I was going to explore using posix_fallocate, but I get ENOTSUPP...


-- 
Jon

------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
Jfs-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jfs-discussion

Reply via email to