diff mbox series

[12/14] xfs: parse both remote attr name on-disk formats

Message ID 20241229133836.1194272-13-aalbersh@kernel.org (mailing list archive)
State New
Headers show
Series Direct mapped extended attribute data | expand

Commit Message

Andrey Albershteyn Dec. 29, 2024, 1:38 p.m. UTC
The new format has ->crc[2] field. This field is overlapped with
anything what is before this remote attr name, for filesystems
without dxattr.

Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
---
 fs/xfs/libxfs/xfs_da_format.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/fs/xfs/libxfs/xfs_da_format.h b/fs/xfs/libxfs/xfs_da_format.h
index bf0f73624446..4034530ad023 100644
--- a/fs/xfs/libxfs/xfs_da_format.h
+++ b/fs/xfs/libxfs/xfs_da_format.h
@@ -781,7 +781,13 @@  xfs_attr3_leaf_name_remote(
 		xfs_attr_leafblock_t	*leafp,
 		int			idx)
 {
-	return (xfs_attr_leaf_name_remote_t *)xfs_attr3_leaf_name(leafp, idx);
+	char *leaf = xfs_attr3_leaf_name(leafp, idx);
+	/* Overlap xfs_attr_leaf_name_remote_t with anything which is before.
+	 * The overlap is created by ->crc[2] and is not used for filesystem
+	 * without DXATTR. */
+	if (!xfs_sb_has_incompat_feature(sb, XFS_SB_FEAT_INCOMPAT_DXATTR))
+		return (xfs_attr_leaf_name_remote_t *)(leaf - 2*sizeof(__be32));
+	return (xfs_attr_leaf_name_remote_t *)leaf;
 }
 
 static inline xfs_attr_leaf_name_local_t *