Patent ID: 7593975

Claim:
A method for defragmenting data blocks on storage devices of a computer configured to implement a file system that logically organizes the blocks as a file on the storage devices, comprising: determining a current layout of selected data blocks on the storage devices; determining a fragmentation of the current layout, the fragmentation calculated as an approximate number of operations necessary to retrieve the selected data blocks; estimating a fragmentation of a potential new layout of the data blocks on the storage devices, wherein the potential new layout is estimated based on an average fullness of a file system of the computer to determine an estimate of write allocation chunk regions necessary for the potential new layout; and relocating the data blocks on the storage devices if the potential new layout has less fragmentation then the current layout, by relocating the data blocks if there is sufficient free space on the storage devices, loading the data blocks into the memory of the computer and dirtying the data blocks, searching a predetermined distance of a first storage device for free blocks, filling those free blocks with the dirtied data blocks jumping to a second storage device, searching the predetermined distance of the second storage device for additional free blocks, and filling those additional free blocks with the dirtied data blocks.