Skip to contentSkip to conversation

xfsdocs: Describe Metadump V2's ondisk format structure

PATCH Superseded Chandan Babu R 2 participants 5 messages Nov 6, 2023 – Nov 8, 2023

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

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.

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 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 v1 1/2
#2 lore raw

Re: [PATCH V1 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 to me,

--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 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..782f194 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
+dumping 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 blocks have been dumped.
+
+| +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 lowest 54 bits are used to store 512 byte disk addresses of a
+metadata extent . The next 2 bits are used for indicating the device.
+. 00 - Data device
+. 01 - External log
+
+*xme_len*::
+Length of the Metadata in units of 512 byte blocks.
+
 == Dump Obfuscation
 
 Unless explicitly disabled, the +xfs_metadump+ tool obfuscates empty block
Signature · 1 line
2.39.1
#4 lore raw

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

Quoted 13 lines · 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 +0 -0
index 2f35b7e..782f194 100644

design/XFS_Filesystem_Structure/metadump.asciidoc must be the superblock from AG 0. If the metadump has more blocks than · line 18

Quoted 7 lines
design/XFS_Filesystem_Structure/metadump.asciidoc +3 -1
@@ -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
+dumping data from an external log device.

"...supports capturing data from an external log device."

Quoted 10 lines
design/XFS_Filesystem_Structure/metadump.asciidoc +3 -0
+
+== 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

design/XFS_Filesystem_Structure/metadump.asciidoc An array of disk addresses. Each of the +mb_count+ blocks (of size +(1 · line 79

Quoted 10 lines
design/XFS_Filesystem_Structure/metadump.asciidoc +10 -0
+
+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;

^^^^^ spaces not tabs (yeah, I know...)

Quoted 11 lines
design/XFS_Filesystem_Structure/metadump.asciidoc +11 -0
+        __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.

design/XFS_Filesystem_Structure/metadump.asciidoc An array of disk addresses. Each of the +mb_count+ blocks (of size +(1 · line 100

Quoted 10 lines
design/XFS_Filesystem_Structure/metadump.asciidoc +10 -0
+
+[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 blocks have been dumped.

"Full metadata blocks have been dumped. Without this flag, unused areas of metadata blocks are zeroed."

Quoted 14 lines
design/XFS_Filesystem_Structure/metadump.asciidoc +14 -0
+
+| +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.

design/XFS_Filesystem_Structure/metadump.asciidoc An array of disk addresses. Each of the +mb_count+ blocks (of size +(1 · line 124

Quoted 10 lines
design/XFS_Filesystem_Structure/metadump.asciidoc +10 -0
+
+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;

Inconsistent indenting here too.

design/XFS_Filesystem_Structure/metadump.asciidoc An array of disk addresses. Each of the +mb_count+ blocks (of size +(1 · line 131

Quoted 7 lines
design/XFS_Filesystem_Structure/metadump.asciidoc +7 -0
+} __packed;
+----
+*xme_addr*::
+
+
+The lowest 54 bits are used to store 512 byte disk addresses of a
+metadata extent . The next 2 bits are used for indicating the device.

^ no space here.

"The lower 54 bits are used to store the disk address of a metadata dump extent. The next 2 bits..."

design/XFS_Filesystem_Structure/metadump.asciidoc An array of disk addresses. Each of the +mb_count+ blocks (of size +(1 · line 136

Quoted 5 lines
design/XFS_Filesystem_Structure/metadump.asciidoc +5 -0
+. 00 - Data device
+. 01 - External log
+
+*xme_len*::
+Length of the Metadata in units of 512 byte blocks.

"Length of the metadata dump extent in units of 512 byte blocks."

(Hey, uh, who's the xfs documentation maintainer? Is it still me?)

--D

Quoted 7 lines
design/XFS_Filesystem_Structure/metadump.asciidoc +1 -0
+
 == Dump Obfuscation
 
 Unless explicitly disabled, the +xfs_metadump+ tool obfuscates empty block
Signature · 1 line
2.39.1