Getting fully qualified path from inode entry

Been writing a defrag util for the Tek4404. Its been fun getting deep into the guts of a filesystem!

Once I build a set of candidate FileDescriptors to defrag, I want to show the filename associated with it. I’m finding it incredibly fiddly to go from a directory block file entry to the full pathname - in that you have to seek to the parent FDn, then get its inode and find the directory blocks associated with it and then search through to find an entry that references your original inodes block and then recurse…

Am I missing something? Is there an easier way? And just for reference, I want to implement this.

I don’t see an easier way that would still work if the user uses “mount” differently tomorrow. The absolute paths will all change.