stefbon@gmail.com wrote:
Hi,
I'm writing FUSE fs's, and need a method for doing lookups for of dentries and inodes. To start with dentries, a FUSE lookup uses the parent inode ino (an uint64_t) and the name.
Now I've expirmented a lttle creating a key like:
- first 8 bytes used by parent inode ino, left padded with zeros.
- rest the name of the entry
like
00000001dexample
which is the directory dexample in directory with ino 1. (to make this work custom locking is required)
What locking is required?
It works, but is it a good idea to do? Or are there other methods better?
Keeping LMDB keysize limits in mind, it will work. But you'd probably do better using LMDB's DUPSORT feature. Use the parent inode as the key, use the name as the value.