[PATCH 06/14] Add parent inode number for directories

Valerie Aurora val at versity.com
Mon Mar 3 09:16:05 PST 2025


On Fri, Feb 28, 2025 at 11:35 PM Zach Brown <zab at zabbo.net> wrote:
>
> On Thu, Feb 27, 2025 at 03:16:15PM +0100, Valerie Aurora wrote:
> > Add a parent inode field to the inode to give us back references for
> > directories. For non-directories, this field is 0 and back references
> > will go in a per-inode btree (TODO).
>
> > @@ -91,6 +91,7 @@ struct ngnfs_inode {
> >       __le64 gen;
> >       __le64 size;
> >       __le64 version;
> > +     __le64 parent_ino; /* only valid for directories */
> >       __le32 nlink;
> >       __le32 uid;
> >       __le32 gid;
>
> To be more specific, this is adding is a reference to a specific
> instance of an inode.  If we bit the bullet and introduced a persistent
> inode/gen reference struct we could use it here.
>
> The nice result of that is that we could return the target inode for
> lookup of ".." without having to actually read the referenced parent
> inode to get its gen.  (As we'll see later.)
>
> Maybe we make it something like:
>
>         struct ngnfs_ino_gen {
>                 __le64 ino;
>                 __le64 gen;
>         };
>
> Too literal?

Yes, I like! I think what you are saying is to replace all inode
numbers with an ino_gen struct, including in say
update_dirent_args_ino(), correct? I have a commit in my stack right
now to correctly copy around the gen number with the ino which I can
easily update to this.

Valerie



More information about the ngnfs-devel mailing list