Tracy Nelson on Sun, 25 Apr 1999 06:58:47 -0400 (EDT) |
Steven J. Pulito wrote: > I've heard that there is no need to defrag a linux hard drive because the > file system does it automatically. Could someone verify this and possibly > elaborate on the technical details? Disclaimer: I haven't really studied ext2fs, but I implemented the UNIX V7 filesystem (in Pascal!) once. Basically, the filesystem is just a long string of blocks. When the filesystem is created, all these blocks are in a big linked list known as the free space list. You allocate blocks from one end of this list and when you free blocks they are appended to the other. One optimization the free routine can do is to see if the blocks being freed are adjacent to some other free blocks. If so, then instead of linking them to the end of the list, they are linked right after the free blocks to which they are adjacent. This creates a larger chunk of contiguous free space, which is always handy. Of course, this doesn't handle the problem of files being split into multiple chunks, so I don't know if ext2fs handles this, or if _read() is smart enough to pre-fetch during idle I/O, or what. Cheers! -- Tracy Nelson -- To unsubscribe, send a message with the word 'unsubscribe' in the subject or body of your message to plug-request@lists.nothinbut.net
|
|