"Bill Rugolsky Jr." wrote: > > On Fri, Mar 01, 2002 at 05:42:02PM -0500, Theodore Tso wrote: > > Well, perhaps it time that someone rewrote the defragger to work with > > 4k blocks, and so that it doens't leave your filesystem a smoking heap > > of debris if your system crashes in the middle of the defrag > > operation. :-) > > Is there a design for a coherent filesystem interface that would allow > ext3 defragging, resizing, bad block handling, etc., to be done online, > incrementally, and safely from userland? > Sort-of. Jeff Garzik is working on an grand plan wherein filesystems will expose their metadata via a meta-filesystem. This would be suitable for reading back filesystem structures, but I'm not sure it's suitable for modifying stuff. My more pragmatic short-term approach is a single ioctl against a file descriptor which says "try to move this page of the file to these blocks". It may fail, and the userspace defrag program would need to cope with that. No inode relocation, no directory defrag, no indirect block relocation. Just file contents. If someone wants to have a shot at the userspace side, please shout out. Nice thing is, you can't wreck the filesystem. -