LWN.net Logo

Online defragmentation for ext4

Online defragmentation for ext4

Posted Feb 5, 2009 5:53 UTC (Thu) by dgc (subscriber, #6611)
In reply to: Online defragmentation for ext4 by dtlin
Parent article: Online defragmentation for ext4

The algorithm for creating a new file, preallocating and comparing
extents before doing any data movement is pretty much the same as what
xfs_fsr does. however, they differ in teh method of data exchange
algorithms.

xfs_fsr does all the data movement via direct IO in userspace
(i.e. scales extremely well). It swaps the extents atomically
if the inode has not changed between the start of the data copy
and the completion of it. Hence you can't defragment active files.

This was considered a fundamental blocker for ext4 even though
most active files never need defragmentation (think shared
libraries). Hence the ext4 patchset implements data movement inside
ext4 itself and so the kernel defrag code is much, much more complex
than the XFS swap extents ioctl. Userspace complexity is about the
same, but different APIs were required for ext4 to do it's "a bit at
a time" algorithm....


(Log in to post comments)

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds