diff mbox series

[2/5] btrfs-progs: mkfs: add support for RAID56J creation

Message ID ca02098b92b797eb94a098e6773123280e27ca7c.1652611957.git.wqu@suse.com (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: almost full support for RAID56J profiles | expand

Commit Message

Qu Wenruo May 15, 2022, 10:54 a.m. UTC
The major part is already done in the RAID56J feature introduce commit,
for mkfs the only special part is about setting the
BTRFS_FEATURE_INCOMPAT_RAID56_JOURNAL flag and the extra incompat flags.

Unlike kernel, btrfs-progs doesn't automatically set the flag based on
the chunk type, but has to do it at mkfs time.

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 common/fsfeatures.c | 9 +++++++++
 mkfs/main.c         | 3 +++
 2 files changed, 12 insertions(+)
diff mbox series

Patch

diff --git a/common/fsfeatures.c b/common/fsfeatures.c
index 23a92c21a2cc..86637606e6af 100644
--- a/common/fsfeatures.c
+++ b/common/fsfeatures.c
@@ -142,6 +142,15 @@  static const struct btrfs_feature mkfs_features[] = {
 		VERSION_NULL(default),
 		.desc		= "new extent tree format"
 	},
+	{
+		.name		= "raid56-journal",
+		.flag		= BTRFS_FEATURE_INCOMPAT_RAID56_JOURNAL,
+		.sysfs_name	= "raid56_journal",
+		VERSION_TO_STRING2(compat, 6,10),
+		VERSION_NULL(safe),
+		VERSION_NULL(default),
+		.desc		= "write-ahead journal for RAID56"
+	},
 #endif
 	/* Keep this one last */
 	{
diff --git a/mkfs/main.c b/mkfs/main.c
index 4e0a46a77aa5..1187440c8db2 100644
--- a/mkfs/main.c
+++ b/mkfs/main.c
@@ -1286,6 +1286,9 @@  int BOX_MAIN(mkfs)(int argc, char **argv)
 			"\t to be used besides testing or evaluation.\n");
 	}
 
+	if ((data_profile | metadata_profile) & BTRFS_BLOCK_GROUP_JOURNAL_MASK)
+		features |= BTRFS_FEATURE_INCOMPAT_RAID56_JOURNAL;
+
 	if ((data_profile | metadata_profile) &
 	    (BTRFS_BLOCK_GROUP_RAID1C3 | BTRFS_BLOCK_GROUP_RAID1C4)) {
 		features |= BTRFS_FEATURE_INCOMPAT_RAID1C34;