Darrick J. Wong 34c9382c12 xfs: ask the dentry cache if it knows the parent of a directory
It's possible that the dentry cache can tell us the parent of a
directory.  Therefore, when repairing directory dot dot entries, query
the dcache as a last resort before scanning the entire filesystem.

A reviewer asks:

"How high is the chance that we actually have a valid dcache entry for a
file in a corrupted directory?"

There's a decent chance of this actually working.  Say you have a
1000-block directory foo, and block 980 gets corrupted.  Let's further
suppose that block 0 has a correct entry for ".." and "bar".  If someone
accesses /mnt/foo/bar, that will cause the dcache to create a dentry
from /mnt to /mnt/foo whose d_parent points back to /mnt.  If you then
want to rebuild the directory, XFS can obtain the parent from the dcache
without needing to wander into parent pointers or scan the filesystem to
find /mnt's connection to foo.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
2024-04-15 14:58:56 -07:00
..
2024-04-15 14:58:53 -07:00
2024-02-22 12:43:35 -08:00
2024-04-15 14:58:56 -07:00
2024-04-15 14:58:53 -07:00
2024-03-13 13:52:24 -07:00
2023-12-15 10:03:45 -08:00
2024-02-22 12:40:12 -08:00
2024-01-10 08:45:22 -08:00
2023-12-07 14:51:07 +05:30
2024-02-22 12:43:35 -08:00
2024-02-17 09:32:32 +05:30
2024-04-15 14:58:53 -07:00