Messages in this thread | | | Date | Thu, 4 Nov 1999 00:19:07 +0100 | From | Jamie Lokier <> | Subject | Results of readdir d_type testing |
| |
Theodore Y. Ts'o wrote: > P.S. It would be good to make the user code check the de_type field > returned from readdir(), and not try the open(fn, O_DIRECTORY) call if > de_type is set. That way, it will be ready for when we get the full > readdir() implementation done
Ok, I have implemented and tested this (tested ext2 only). I did it without a new system call and it's quite backward/forward compatible. I put the d_type value at the end of each record from getdents(), in such a way that it can be recognised unambiguously. Patch available on request.
These are the results:
- You forgot the S_ISSOCK case in ext2_set_de_type. e2fsck knows about it, but new unix domain sockets are untyped...
[treescan is equivalent to "find" with no predicates: it prints the names of all the filesystem entries it can find]
- With nothing in memory, treescan takes about the same time to scan my disks with the d_type information as it does with the O_DIRECTORY filetype optimisation. 2% CPU, ~53 seconds.
This is no surprise. Both methods avoid reading non-directory inodes, and in this case the system is I/O bound.
- With everything in memory, treescan takes 0.41 seconds to scan my disks with d_type information, and 1.06 seconds with the O_DIRECTORY optimisation only. 100% CPU.
This saving must be due to fewer system calls and fewer directory lookups. Note, I do not have any large directories on this system.
-- Jamie
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |