]> www.infradead.org Git - linux.git/commitdiff
bcachefs: bch2_inum_path() now crosses subvolumes correctly
authorKent Overstreet <kent.overstreet@linux.dev>
Tue, 24 Dec 2024 10:16:56 +0000 (05:16 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Fri, 10 Jan 2025 04:38:41 +0000 (23:38 -0500)
The dirent that points to a subvolume root is in the parent subvolume.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/fs-common.c

index 63619318c64a9c388b244778beae7a4be0ee18bd..2c3d46ac70c61353ede8988443b8a55dc5386fb6 100644 (file)
@@ -608,6 +608,9 @@ int bch2_inum_to_path(struct btree_trans *trans, subvol_inum inum, struct printb
                        goto disconnected;
                }
 
+               inum.subvol     = inode.bi_parent_subvol ?: inum.subvol;
+               inum.inum       = inode.bi_dir;
+
                u32 snapshot;
                ret = bch2_subvolume_get_snapshot(trans, inum.subvol, &snapshot);
                if (ret)
@@ -626,10 +629,6 @@ int bch2_inum_to_path(struct btree_trans *trans, subvol_inum inum, struct printb
 
                prt_char(path, '/');
 
-               if (d.v->d_type == DT_SUBVOL)
-                       inum.subvol = le32_to_cpu(d.v->d_parent_subvol);
-               inum.inum = d.k->p.inode;
-
                bch2_trans_iter_exit(trans, &d_iter);
        }