Fastest way to walk through a file tree on reiser4
Hi,
i followed the reiser4 development for over a year and i'm really pleased about it :-)
Once i written about a performance bottelneck on reiser3 when requesting stats from files and wonder if the reiser4 api could increase the process.
The program should walk through a file tree and return a list of all files their link count is 1. What would be the fastest way to realize this ?
regards
Daniel
Quoted 2 lines · daniel.poelzleithner
The program should walk through a file tree and return a list of all files their link count is 1. What would be the fastest way to realize this ?
Depends. Which matters more, correctness or speed? ;)
Many programs perform an *inverse* optimization - If you're looking for all subdirectories, and find a directory with link count == 2, there's no need to recurse down into it looking for subdirs (if you have a directory 'a', that has a subdir 'a/b', it will have a link count of at least 3 - if 'a' has exactly 2 links, it's a leaf directory).
Also, looking for "exactly one link" doesn't work right for hardlinks:
cd your_sub_dir
cp /datatree/some_file ./name1
ln ./name1 ./name2