Currently JcrResourceProvider.getParent is using JcrItemResourceFactory.getItemOrNull(String path), which eventually is using JCR session to retrieve parent node using absolute path.
I propose using javax.jcr.Item.getParent() instead.
Reasoning wold be to utilise potential improvements in JCR implementation that would for a given node retrieve the whole subtree. That can be configured for example by using particular node type or node path.
If node 'a' in picture above, is matching desired configuration, then code below would return the whole subtree.
That further means retrieved subtree can be traversed in memory, without the need to communicate with the JCR repository storage.
(!)That is particularly important when remote (cloud) storage is used for repository in JCR implementation, and tree traversal can be done without doing additional network roundtrips.
Also going from child to parent, is resolved in memory as well (proposal relates to this fact)
Jackrabbit Oak, for document node store is supporting node bundling for configured node type