On Jul 5, 2011, at 4:53 PM, Wim Lewis wrote: Also, I don't remember whether HFS+ works this way, but on some filesystems the inode number corresponds to its location on disk, and file contents are preferentially stored near their inodes;
No, HFS doesn't work this way. inode numbers are just unique IDs that are generated sequentially (with the potential for wraparound). if you sort your work queue by inode, that might increase locality of reads from the disk.
That would probably better than reading files in some random order, but for a different reason. HFS maintains a persistent "next allocation pointer" that hints where to look next when doing an allocation. If your disk has sufficiently contiguous free space, and you tend to write files all at once (as most files are), then by coincidence, files with nearby inode numbers will tend to be allocated nearby. And in fact, HFS prefers to allocate a file contiguously, even if that means placing it somewhere far away from the "next allocation" pointer.
The allocator's behavior could change in the future, so please don't depend on it.
-Mark
|