[PATCH v1] Add btrfs fs_info checksum, generation and metadata

Sahil Kang sahil.kang at asilaycomputing.com
Sat Dec 25 05:15:41 UTC 2021


* src/xlat/btrfs_csum_types.in: New file.
* src/xlat/btrfs_fs_info_flags.in: Likewise.
* src/btrfs.c: Print csum_type, csum_size, flags, generation, and
metadata_uuid fields of btrfs_ioctl_fs_info_args struct.
* NEWS: Mention it.

Signed-off-by: Sahil Kang <sahil.kang at asilaycomputing.com>
---
 src/btrfs.c                     | 20 ++++++++++++++++++++
 src/xlat/btrfs_csum_types.in    |  7 +++++++
 src/xlat/btrfs_fs_info_flags.in |  4 ++++
 3 files changed, 31 insertions(+)
 create mode 100644 src/xlat/btrfs_csum_types.in
 create mode 100644 src/xlat/btrfs_fs_info_flags.in

diff --git a/src/btrfs.c b/src/btrfs.c
index ab7e0d3c4..349fee657 100644
--- a/src/btrfs.c
+++ b/src/btrfs.c
@@ -37,6 +37,7 @@ typedef struct btrfs_ioctl_vol_args_v2
 #include "xlat/btrfs_balance_state.h"
 #include "xlat/btrfs_compress_types.h"
 #include "xlat/btrfs_cont_reading_from_srcdev_mode.h"
+#include "xlat/btrfs_csum_types.h"
 #include "xlat/btrfs_defrag_flags.h"
 #include "xlat/btrfs_dev_replace_cmds.h"
 #include "xlat/btrfs_dev_replace_results.h"
@@ -46,6 +47,7 @@ typedef struct btrfs_ioctl_vol_args_v2
 #include "xlat/btrfs_features_compat.h"
 #include "xlat/btrfs_features_compat_ro.h"
 #include "xlat/btrfs_features_incompat.h"
+#include "xlat/btrfs_fs_info_flags.h"
 #include "xlat/btrfs_key_types.h"
 #include "xlat/btrfs_logical_ino_args_flags.h"
 #include "xlat/btrfs_qgroup_ctl_cmds.h"
@@ -790,6 +792,24 @@ MPERS_PRINTER_DECL(int, btrfs_ioctl,
 		PRINT_FIELD_U(args, sectorsize);
 		tprint_struct_next();
 		PRINT_FIELD_U(args, clone_alignment);
+		if (args.flags & BTRFS_FS_INFO_FLAG_CSUM_INFO) {
+			tprint_struct_next();
+			PRINT_FIELD_XVAL(args, csum_type, btrfs_csum_types,
+					 "BTRFS_CSUM_TYPE_???");
+			tprint_struct_next();
+			PRINT_FIELD_U(args, csum_size);
+		}
+		tprint_struct_next();
+		PRINT_FIELD_FLAGS(args, flags, btrfs_fs_info_flags,
+				  "BTRFS_FS_INFO_FLAG_???");
+		if (args.flags & BTRFS_FS_INFO_FLAG_GENERATION) {
+			tprint_struct_next();
+			PRINT_FIELD_U(args, generation);
+		}
+		if (args.flags & BTRFS_FS_INFO_FLAG_METADATA_UUID) {
+			tprint_struct_next();
+			PRINT_FIELD_UUID(args, metadata_uuid);
+		}
 		tprint_struct_end();
 		break;
 	}
diff --git a/src/xlat/btrfs_csum_types.in b/src/xlat/btrfs_csum_types.in
new file mode 100644
index 000000000..73b1c597a
--- /dev/null
+++ b/src/xlat/btrfs_csum_types.in
@@ -0,0 +1,7 @@
+#unconditional
+#value_indexed
+#enum
+BTRFS_CSUM_TYPE_CRC32	0
+BTRFS_CSUM_TYPE_XXHASH	1
+BTRFS_CSUM_TYPE_SHA256	2
+BTRFS_CSUM_TYPE_BLAKE2	3
diff --git a/src/xlat/btrfs_fs_info_flags.in b/src/xlat/btrfs_fs_info_flags.in
new file mode 100644
index 000000000..b1cb4eb89
--- /dev/null
+++ b/src/xlat/btrfs_fs_info_flags.in
@@ -0,0 +1,4 @@
+#unconditional
+BTRFS_FS_INFO_FLAG_CSUM_INFO
+BTRFS_FS_INFO_FLAG_GENERATION
+BTRFS_FS_INFO_FLAG_METADATA_UUID
-- 
2.30.2



More information about the Strace-devel mailing list