On Mon, Sep 22, 2014 at 12:37:59PM +0000, Holger Hoffstätte wrote: > Thanks Dave - that confirms everything I (unscientifically ;) observed so > far, since I also tried to use "find" to warm up (in the hope it would > cache the relevant metadata blocks), but running with strace showed that > it does - of course! - not call stat on each inode, and just quickly reads > the directory entry list (via getdents()). > > This meant that even after a full "find" a subsequent "du" would still be > slow(er). Both the cold "find" and a cold "du" also *sound* noticeably > different, in terms of disk head scratching; find is significantly less > seeky.
The default find still calls some variant of stat quite a lot because it needs to decide whether to recurse to the directories, but when compared to 'du -s' it's still not called for all files. > Interesting that you also mention the readahead. I've run the "du" warmup > under Brendan Gregg's iosnoop and it shows that most stat()-heavy I/O is > done in 16k blocks, while ext4 only seems to use 4k. Most probably, 16k is the size of the metadata blocks, mkfs option --nodesize or default since progs v3.12. -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html