• Allison Henderson's avatar
    xfs: define parent pointer ondisk extended attribute format · 8337d58a
    Allison Henderson authored
    We need to define the parent pointer attribute format before we start
    adding support for it into all the code that needs to use it. The EA
    format we will use encodes the following information:
    
            name={dirent name}
            value={parent inumber, parent inode generation}
            hash=xfs_dir2_hashname(dirent name) ^ (parent_inumber)
    
    The inode/gen gives all the information we need to reliably identify the
    parent without requiring child->parent lock ordering, and allows
    userspace to do pathname component level reconstruction without the
    kernel ever needing to verify the parent itself as part of ioctl calls.
    
    By using the name-value lookup mode in the extended attribute code to
    match parent pointers using both the xattr name and value, we can
    identify the exact parent pointer EA we need to modify/remove in
    rename/unlink operations without searching the entire EA space.
    
    By storing the dirent name, we have enough information to be able to
    validate and reconstruct damaged directory trees.  Earlier iterations of
    this patchset encoded the directory offset in the parent pointer key,
    but this format required repair to keep that in sync across directory
    rebuilds, which is unnecessary complexity.
    Signed-off-by: default avatarAllison Henderson <allison.henderson@oracle.com>
    Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
    Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
    Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
    8337d58a
xfs_da_format.h 30.3 KB