[PATCH 16/38] xfs_repair: preserve the metadirino field when zeroing supers

Darrick J. Wong
2024-10-11T01:18:20Z

The metadata directory root inumber is now the last field in the
superblock, so extend the zeroing code to know about that.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
repair/agheader.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/repair/agheader.c b/repair/agheader.c
index 3930a0ac0919b4..5d4ca26cfb6155 100644
--- a/repair/agheader.c
+++ b/repair/agheader.c
@@ -357,7 +357,10 @@ secondary_sb_whack(
*
* size is the size of data which is valid for this sb.
*/
- if (xfs_sb_version_hasmetauuid(sb))
+ if (xfs_sb_version_hasmetadir(sb))
+ size = offsetof(struct xfs_dsb, sb_metadirino)
+ + sizeof(sb->sb_metadirino);
+ else if (xfs_sb_version_hasmetauuid(sb))
size = offsetof(struct xfs_dsb, sb_meta_uuid)
+ sizeof(sb->sb_meta_uuid);
else if (xfs_sb_version_hascrc(sb))