}
}
+/*
+ * stripe_alloc covers raid56 *data* block groups only. A filesystem whose
+ * metadata is also raid56 keeps the write hole there. The data guarantee is
+ * easy to read as a filesystem-wide one, so say once, when the policy turns
+ * on, what is not covered. That is btrfs_enable_stripe_alloc(): at mount the
+ * property applies after the block groups are read, so a report from
+ * btrfs_read_block_groups() would find the flag still clear. (Mixed block
+ * groups cannot get here: the property refuses them.)
+ */
+static void warn_stripe_alloc_uncovered(struct btrfs_fs_info *info)
+{
+ const u64 meta_bits = info->avail_metadata_alloc_bits |
+ info->avail_system_alloc_bits;
+
+ if (!btrfs_test_opt(info, STRIPE_ALLOC))
+ return;
+
+ if (meta_bits & BTRFS_BLOCK_GROUP_RAID56_MASK)
+ btrfs_warn(info,
+"stripe_alloc does not cover raid56 metadata: the write hole remains for metadata, consider converting it to raid1c3/raid1c4");
+}
+
int btrfs_enable_stripe_alloc(struct btrfs_fs_info *fs_info)
{
int ret;
if (ret)
return ret;
btrfs_set_opt(fs_info->mount_opt, STRIPE_ALLOC);
+ warn_stripe_alloc_uncovered(fs_info);
/*
* Arm stripe_unusable accounting for raid56 data groups whose caches
* loaded before the policy was enabled: block groups are read before