Typically you would create your private data structure and install it in
d_fsdata in the fs lookup routine, or possibly in a d_hash routine. To
free it, you need to have a dentry_ops d_release operation, which is
then called at d_free time.
For examples take a look in nfs/dir.c. The d_fsdata area is now being
used to store the NFS filehandle in the dentry instead of in the inode.
Regards,
Bill