defragmentation of swap file?
Posted Feb 5, 2009 2:21 UTC (Thu) by brouhaha
Parent article: Online defragmentation for ext4
While it's obviously possible, I've never had any serious problem with the swap file getting extremely fragmented. It would be fine by me if online defragmentation of the swap file wasn't allowed. Instead of building complicated mechanisms for file systems to support that, and requiring file systems to use it, a relatively simple piece of kernel code could check whether the file in question was an active swap file, and deny the request from user space.
If you really need to do it, the user space utility could create a replacement swap file, defragment it (if necessary), enable swapping on the new file, then disable swapping on the old file and delete it. That's not significantly worse than the way the defragmentation patch works with regard to normal (non-swap) files. The user-space program could determine whether the file in question is a swap file, and deal with it appropriately.
to post comments)