xfs: condense extended attributes after a mapping exchange operation
authorDarrick J. Wong <djwong@kernel.org>
Mon, 15 Apr 2024 21:54:20 +0000 (14:54 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Mon, 15 Apr 2024 21:54:20 +0000 (14:54 -0700)
commit497d7a2608f8b7329e92bdaaf745ca127a582ad9
tree306acd059a60199aa3e7eeb8ff4100c5dcf1b1c9
parent5fd022ec7d420dfca1eaaf997923a5d4dd0dcf62
xfs: condense extended attributes after a mapping exchange operation

Add a new file mapping exchange flag that enables us to perform
post-exchange processing on file2 once we're done exchanging the extent
mappings.  If we were swapping mappings between extended attribute
forks, we want to be able to convert file2's attr fork from block to
inline format.

(This implies that all fork contents are exchanged.)

This isn't used anywhere right now, but we need to have the basic ondisk
flags in place so that a future online xattr repair feature can create
salvaged attrs in a temporary file and exchange the attr fork mappings
when ready.  If one file is in extents format and the other is inline,
we will have to promote both to extents format to perform the exchange.
After the exchange, we can try to condense the fixed file's attr fork
back down to inline format if possible.

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