diff options
author | Darrick J. Wong <djwong@kernel.org> | 2024-04-22 18:47:46 +0200 |
---|---|---|
committer | Darrick J. Wong <djwong@kernel.org> | 2024-04-23 16:46:58 +0200 |
commit | fb102fe7fe02e70f8a49cc7f74bc0769cdab2912 (patch) | |
tree | 0e47e492d4525dc31e018c8fdfc8578f8105c099 /fs/xfs/libxfs/xfs_attr.c | |
parent | xfs: extend transaction reservations for parent attributes (diff) | |
download | linux-fb102fe7fe02e70f8a49cc7f74bc0769cdab2912.tar.xz linux-fb102fe7fe02e70f8a49cc7f74bc0769cdab2912.zip |
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>
Diffstat (limited to 'fs/xfs/libxfs/xfs_attr.c')
-rw-r--r-- | fs/xfs/libxfs/xfs_attr.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c index 93524efa6e56..8c283e5c2470 100644 --- a/fs/xfs/libxfs/xfs_attr.c +++ b/fs/xfs/libxfs/xfs_attr.c @@ -437,6 +437,9 @@ xfs_attr_hashval( { ASSERT(xfs_attr_check_namespace(attr_flags)); + if (attr_flags & XFS_ATTR_PARENT) + return xfs_parent_hashattr(mp, name, namelen, value, valuelen); + return xfs_attr_hashname(name, namelen); } |