bcachefs: Inode backpointers
authorKent Overstreet <kent.overstreet@gmail.com>
Tue, 2 Mar 2021 23:35:30 +0000 (18:35 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:08:58 +0000 (17:08 -0400)
commitab2a29ccffd0e9fe62afb8bbd45e1709f9726942
tree506bd3b3614eaf0dd3ee9f94af28c4a81117cf00
parente751c01a8ee1ca934cc0953e2e77ad4ea3e64d5e
bcachefs: Inode backpointers

This patch adds two new inode fields, bi_dir and bi_dir_offset, that
point back to the inode's dirent.

Since we're only adding fields for a single backpointer, files that have
been hardlinked won't necessarily have valid backpointers: we also add a
new inode flag, BCH_INODE_BACKPTR_UNTRUSTED, that's set if an inode has
ever had multiple links to it. That's ok, because we only really need
this functionality for directories, which can never have multiple
hardlinks - when we add subvolumes, we'll need a way to enemurate and
print subvolumes, and this will let us reconstruct a path to a subvolume
root given a subvolume root inode.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/bcachefs_format.h
fs/bcachefs/dirent.c
fs/bcachefs/dirent.h
fs/bcachefs/fs-common.c
fs/bcachefs/fsck.c
fs/bcachefs/inode.c
fs/bcachefs/inode.h