xfs: create a hashname function for parent pointers
authorDarrick J. Wong <djwong@kernel.org>
Mon, 22 Apr 2024 16:47:46 +0000 (09:47 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 23 Apr 2024 14:46:58 +0000 (07:46 -0700)
commitfb102fe7fe02e70f8a49cc7f74bc0769cdab2912
tree0e47e492d4525dc31e018c8fdfc8578f8105c099
parent7dba4a5fe1c5cdf0859830380c52f29295cbf345
xfs: create a hashname function for parent pointers

Although directory entry and parent pointer recordsets look very similar
(name -> ino), there's one major difference between them: a file can be
hardlinked from multiple parent directories with the same filename.
This is common in shared container environments where a base directory
tree might be hardlink-copied multiple times.  IOWs the same 'ls'
program might be hardlinked to multiple /srv/*/bin/ls paths.

We don't want parent pointer operations to bog down on hash collisions
between the same dirent name, so create a special hash function that
mixes in the parent directory inode number.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
fs/xfs/libxfs/xfs_attr.c
fs/xfs/libxfs/xfs_parent.c
fs/xfs/libxfs/xfs_parent.h
fs/xfs/scrub/attr.c