Perhaps your d_compare is trying to do too much? The original intent was
just to do a fs-specific name compare, and the parent dentry was passed
to allow for things like case-sensitivity on a per-directory basis.
In the present usage you shouldn't assume that one of the qstrs is
actually embedded in a dentry, as someone might just want to call the
operation to compare two non-dentry qstrs.
Could you explain a little more about what you need to do, and I may be
able to suggest an alternative. If the code is question is in your
lookup function, then the d_compare will already have been called to
determine that no dentry existed with the given name. (I.e. the fs
lookup isn't called unless we really do need a lookup.)