Skip to contentSkip to conversation

xfsdocs: Describe Metadump V2's ondisk format structure

PATCH In review Chandan Babu R 2 participants 5 messages Nov 8, 2023

lore
Share & tools
lore
#0 lore raw

v2 cover xfsdocs: Describe Metadump V2's ondisk format structure

Hi all,

This patchset adds description for the newly introduced Metadump V2's ondisk format structure. It also describes each of the flags stored in Metadump V1's mb_info field.

Changelog:
V1 -> V2:
1. Address review comments given for V1.

Chandan Babu R (2):
metadump.asciidoc: Add description for version v1's mb_info field metadump.asciidoc: Add description for metadump v2 ondisk format

 .../metadump.asciidoc                         | 98 ++++++++++++++++++-
 1 file changed, 94 insertions(+), 4 deletions(-)
Signature · 1 line
2.39.1
#1 lore raw

PATCH v2 1/2 metadump.asciidoc: Add description for version v1's mb_info field

mb_reserved has been replaced with mb_info in upstream xfsprogs. This commit adds description for valid bits of mb_info field.

---
 .../metadump.asciidoc                         | 23 ++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)
design/XFS_Filesystem_Structure/metadump.asciidoc +20 -3
index 2bddb77..2f35b7e 100644
@@ -21,7 +21,7 @@ struct xfs_metablock {
 	__be32		mb_magic;
 	__be16		mb_count;
 	uint8_t		mb_blocklog;
-	uint8_t		mb_reserved;
+	uint8_t		mb_info;
 	__be64		mb_daddr[];
 };
 ----
@@ -37,8 +37,25 @@ Number of blocks indexed by this record.  This value must not exceed +(1
 The log size of a metadump block.  This size of a metadump block 512
 bytes, so this value should be 9.
 
-*mb_reserved*::
-Reserved.  Should be zero.
+*mb_info*::
+Flags describing a metadata dump.
+
+[options="header"]
+|=====
+| Flag				| Description
+| +XFS_METADUMP_INFO_FLAGS+ |
+The remaining bits in this field are valid.
+
+| +XFS_METADUMP_OBFUSCATED+ |
+File names and extended attributes have been obfuscated.
+
+| +XFS_METADUMP_FULLBLOCKS+ |
+Metadata blocks have been copied in full i.e. stale bytes have not
+been zeroed out.
+
+| +XFS_METADUMP_DIRTYLOG+ |
+Log was dirty.
+|=====
 
 *mb_daddr*::
 An array of disk addresses.  Each of the +mb_count+ blocks (of size +(1
Signature · 1 line
2.39.1
Reviewed-by on v2 1/2
#2 lore raw

Re: [PATCH V2 1/2] metadump.asciidoc: Add description for version v1's mb_info field

Quoted 4 lines · Chandan Babu R

mb_reserved has been replaced with mb_info in upstream xfsprogs. This commit adds description for valid bits of mb_info field.

Looks good,

--D

Quoted 48 lines
---
 .../metadump.asciidoc                         | 23 ++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)
design/XFS_Filesystem_Structure/metadump.asciidoc +20 -3
index 2bddb77..2f35b7e 100644
@@ -21,7 +21,7 @@ struct xfs_metablock {
 	__be32		mb_magic;
 	__be16		mb_count;
 	uint8_t		mb_blocklog;
-	uint8_t		mb_reserved;
+	uint8_t		mb_info;
 	__be64		mb_daddr[];
 };
 ----
@@ -37,8 +37,25 @@ Number of blocks indexed by this record.  This value must not exceed +(1
 The log size of a metadump block.  This size of a metadump block 512
 bytes, so this value should be 9.
 
-*mb_reserved*::
-Reserved.  Should be zero.
+*mb_info*::
+Flags describing a metadata dump.
+
+[options="header"]
+|=====
+| Flag				| Description
+| +XFS_METADUMP_INFO_FLAGS+ |
+The remaining bits in this field are valid.
+
+| +XFS_METADUMP_OBFUSCATED+ |
+File names and extended attributes have been obfuscated.
+
+| +XFS_METADUMP_FULLBLOCKS+ |
+Metadata blocks have been copied in full i.e. stale bytes have not
+been zeroed out.
+
+| +XFS_METADUMP_DIRTYLOG+ |
+Log was dirty.
+|=====
 
 *mb_daddr*::
 An array of disk addresses.  Each of the +mb_count+ blocks (of size +(1
Signature · 1 line
2.39.1
#3 lore raw

PATCH v2 2/2 metadump.asciidoc: Add description for metadump v2 ondisk format

In reply to Chandan Babu R

Metadump v2 is the new metadata dump format introduced in upstream xfsprogs. This commit describes V2 format's ondisk structure.

---
 .../metadump.asciidoc                         | 75 ++++++++++++++++++-
 1 file changed, 74 insertions(+), 1 deletion(-)
design/XFS_Filesystem_Structure/metadump.asciidoc +74 -1
index 2f35b7e..7ce993c 100644
@@ -13,7 +13,11 @@ must be the superblock from AG 0.  If the metadump has more blocks than
 can be pointed to by the +xfs_metablock.mb_daddr+ area, the sequence
 of +xfs_metablock+ followed by metadata blocks is repeated.
 
-.Metadata Dump Format
+Two metadump file formats are supported: +V1+ and +V2+. In addition to
+the features supported by the +V1+ format, the +V2+ format supports
+capturing data from an external log device.
+
+== Metadata Dump v1 Format
 
 [source, c]
 ----
@@ -62,6 +66,75 @@ An array of disk addresses.  Each of the +mb_count+ blocks (of size +(1
 << mb_blocklog+) following the +xfs_metablock+ should be written back to
 the address pointed to by the corresponding +mb_daddr+ entry.
 
+== Metadata Dump v2 Format
+
+A Metadump Dump in the V2 format begins with a header represented by
++struct xfs_metadump_header+.
+[source, c]
+----
+struct xfs_metadump_header {
+        __be32          xmh_magic;
+        __be32          xmh_version;
+        __be32          xmh_compat_flags;
+        __be32          xmh_incompat_flags;
+        __be64          xmh_reserved;
+} __packed;
+----
+*xmh_magic*::
+The magic number, ``XMD2'' (0x584D4432)
+
+*xmh_version*::
+The version number, i.e. 2.
+
+*xmh_compat flags*::
+Compat flags describing a metadata dump.
+
+[options="header"]
+|=====
+| Flag				| Description
+| +XFS_MD2_COMPAT_OBFUSCATED+ |
+Directory entry and extended attribute names have been obscured and
+extended attribute values are zeroed to protect privacy.
+
+| +XFS_MD2_COMPAT_FULLBLOCKS+ |
+Full metadata blocks have been dumped.  Without this flag, unused areas
+of metadata blocks are zeroed.
+
+| +XFS_MD2_COMPAT_DIRTYLOG+ |
+Log was dirty.
+
+| +XFS_MD2_COMPAT_EXTERNALLOG+ |
+Metadata dump contains contents from an external log.
+|=====
+
+*xmh_incompat_flags*::
+Incompat flags describing a metadata dump. At present, this field must
+be set to zero.
+
+*xmh_reserved*::
+Reserved. Should be zero.
+
+The header is followed by an alternating sequence of +struct
+xfs_meta_extent+ and the contents from the corresponding variable
+length extent.
+
+[source, c]
+----
+struct xfs_meta_extent {
+        __be64 xme_addr;
+        __be32 xme_len;
+} __packed;
+----
+*xme_addr*::
+
+The lower 54 bits are used to store the disk address of a metadata dump
+extent.  The next 2 bits are used for indicating the device.
+. 00 - Data device
+. 01 - External log
+
+*xme_len*::
+Length of the metadata dump extent in units of 512 byte blocks.
+
 == Dump Obfuscation
 
 Unless explicitly disabled, the +xfs_metadump+ tool obfuscates empty block
Signature · 1 line
2.39.1
Reviewed-by on v2 2/2
#4 lore raw

Re: [PATCH V2 2/2] metadump.asciidoc: Add description for metadump v2 ondisk format

Quoted 4 lines · Chandan Babu R

Metadump v2 is the new metadata dump format introduced in upstream xfsprogs. This commit describes V2 format's ondisk structure.

This is consistent with the C structures in the metadump2 patchset, so

(But I'll wait until cem merges that patchset before taking this.)

((Assuming I'm still xfs-docs maintainer :P))

(((Ok I declare I still am)))

--D

Quoted 100 lines
---
 .../metadump.asciidoc                         | 75 ++++++++++++++++++-
 1 file changed, 74 insertions(+), 1 deletion(-)
design/XFS_Filesystem_Structure/metadump.asciidoc +74 -1
index 2f35b7e..7ce993c 100644
@@ -13,7 +13,11 @@ must be the superblock from AG 0.  If the metadump has more blocks than
 can be pointed to by the +xfs_metablock.mb_daddr+ area, the sequence
 of +xfs_metablock+ followed by metadata blocks is repeated.
 
-.Metadata Dump Format
+Two metadump file formats are supported: +V1+ and +V2+. In addition to
+the features supported by the +V1+ format, the +V2+ format supports
+capturing data from an external log device.
+
+== Metadata Dump v1 Format
 
 [source, c]
 ----
@@ -62,6 +66,75 @@ An array of disk addresses.  Each of the +mb_count+ blocks (of size +(1
 << mb_blocklog+) following the +xfs_metablock+ should be written back to
 the address pointed to by the corresponding +mb_daddr+ entry.
 
+== Metadata Dump v2 Format
+
+A Metadump Dump in the V2 format begins with a header represented by
++struct xfs_metadump_header+.
+[source, c]
+----
+struct xfs_metadump_header {
+        __be32          xmh_magic;
+        __be32          xmh_version;
+        __be32          xmh_compat_flags;
+        __be32          xmh_incompat_flags;
+        __be64          xmh_reserved;
+} __packed;
+----
+*xmh_magic*::
+The magic number, ``XMD2'' (0x584D4432)
+
+*xmh_version*::
+The version number, i.e. 2.
+
+*xmh_compat flags*::
+Compat flags describing a metadata dump.
+
+[options="header"]
+|=====
+| Flag				| Description
+| +XFS_MD2_COMPAT_OBFUSCATED+ |
+Directory entry and extended attribute names have been obscured and
+extended attribute values are zeroed to protect privacy.
+
+| +XFS_MD2_COMPAT_FULLBLOCKS+ |
+Full metadata blocks have been dumped.  Without this flag, unused areas
+of metadata blocks are zeroed.
+
+| +XFS_MD2_COMPAT_DIRTYLOG+ |
+Log was dirty.
+
+| +XFS_MD2_COMPAT_EXTERNALLOG+ |
+Metadata dump contains contents from an external log.
+|=====
+
+*xmh_incompat_flags*::
+Incompat flags describing a metadata dump. At present, this field must
+be set to zero.
+
+*xmh_reserved*::
+Reserved. Should be zero.
+
+The header is followed by an alternating sequence of +struct
+xfs_meta_extent+ and the contents from the corresponding variable
+length extent.
+
+[source, c]
+----
+struct xfs_meta_extent {
+        __be64 xme_addr;
+        __be32 xme_len;
+} __packed;
+----
+*xme_addr*::
+
+The lower 54 bits are used to store the disk address of a metadata dump
+extent.  The next 2 bits are used for indicating the device.
+. 00 - Data device
+. 01 - External log
+
+*xme_len*::
+Length of the metadata dump extent in units of 512 byte blocks.
+
 == Dump Obfuscation
 
 Unless explicitly disabled, the +xfs_metadump+ tool obfuscates empty block
Signature · 1 line
2.39.1