Messages in this thread | | | Date | Thu, 19 Feb 2004 21:30:57 -0500 | From | Theodore Ts'o <> | Subject | Re: Eureka! (was Re: UTF-8 and case-insensitivity) |
| |
On Thu, Feb 19, 2004 at 11:48:50AM -0800, Linus Torvalds wrote: > Let's leave the "check_or_create_name()" thing for now, and see how we can > use this in user space (and realize that we only do this on cache failure, > so this is the "slow case"): > > set_bit_one(dir); > lseek(dir, 0, SEEK_SET); > while (readdir(dir, de)) { > stat(de->d_name); > .. might also compare the name here with whatever it is > working on right now.. > } > set_bit_two_if_one_is_set(dirfd); > > Notice what the above does? After the above loop, bit two will be set IFF > the dentry cache now contains every single name in the directory. > Otherwise it will be clear. Bit two will basically be a "dcache complete" > bit.
Why do this in user space? The set_bit_one() and set_bit_two_if_one_is_set() can't really be used for anything else, really, so why not let check_or_create_name() do the above loop if necessary to populate all of the dcache entries in the dentry cache?
That way we only expose one system call (check_or_create_name()), and we let the internal dcache flags be an internal implementation detail. It will also make it much easier to avoid races.
- Ted - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |