bcachefs: Add subvolume to ei_inode_info
authorKent Overstreet <kent.overstreet@gmail.com>
Tue, 16 Mar 2021 05:33:39 +0000 (01:33 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:12 +0000 (17:09 -0400)
commit284ae18c1d7aa44232baedf860a004ceb32fea62
tree424d11916b230ab44050126a250d8e81bf032bb9
parent81ed9ce3671125ee384c1a205747a853ca2a1739
bcachefs: Add subvolume to ei_inode_info

Filesystem operations generally operate within a subvolume: at the start
of every btree transaction we'll be looking up (and locking) the
subvolume to get the current snapshot ID, which we then use for our
other btree lookups in BTREE_ITER_FILTER_SNAPSHOTS mode.

But inodes don't record what subvolume they're in - they can't, because
if they did we'd have to update every single inode within a subvolume
when taking a snapshot in order to keep that field up to date. So it
needs to be tracked in memory, based on how we got to that inode.

Hence this patch adds a subvolume field to ei_inode_info, and switches
to iget5() so we can index by it in the inode hash table.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
fs/bcachefs/fs-ioctl.c
fs/bcachefs/fs.c
fs/bcachefs/fs.h