]> git.hungrycats.org Git - linux/commitdiff
btrfs: stripe_alloc: say at mount whether the policy is on
authorZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Sat, 19 Sep 2026 17:18:25 +0000 (13:18 -0400)
committerZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Sun, 8 Nov 2026 23:37:51 +0000 (18:37 -0500)
Nothing announced that stripe-exclusive allocation was on.  The
btrfs.stripe_alloc property applies when btrfs_fill_super() reads the
root directory's inode and its properties, and btrfs_enable_stripe_alloc()
prints its line only for a set on a live filesystem, so mounting a
filesystem whose property was already set said nothing.

An absent line therefore meant "off" and "on" equally well, and the only
way to answer the question was to look at a live filesystem -- no use
when the filesystem is someone else's, or when all that is left is a log
from before a crash.  Analysing a lockup from a filesystem whose
btrfs.stripe_alloc property was set, I read that silence as the policy
being off and said so, which was wrong.

State it once in btrfs_fill_super(), after the root inode has been read
so the property has had its say.  The property path keeps its own line
for a set on a live filesystem, where there is no mount to report.  At
mount that line still comes too, so a mount with the property set logs
the state twice, until "btrfs: stripe_alloc: say at mount whether the
policy is on (debug part)" later in this series quiets it there: it
needs the runtime enable worker of the write-hole checker.

Nothing is printed when the policy is off, which keeps the common mount
quiet and makes the absence of the line mean exactly one thing.

Assisted-by: Claude:claude-fable-5-1
Assisted-by: Claude:claude-opus-5-5
fs/btrfs/super.c

index 89bee38c08d4788908de6cf76533ab44a174e0f9..76e491043df00287175b7878040350c0c02e4e08 100644 (file)
@@ -946,6 +946,18 @@ static int get_default_subvol_objectid(struct btrfs_fs_info *fs_info, u64 *objec
        return 0;
 }
 
+/*
+ * Log once at mount whether stripe-exclusive allocation is on: the property
+ * is applied silently while the root directory's inode is read.
+ */
+static void btrfs_emit_stripe_alloc_state(struct btrfs_fs_info *info)
+{
+       if (!btrfs_test_opt(info, STRIPE_ALLOC))
+               return;
+       btrfs_info(info,
+                  "using stripe-exclusive allocation for raid56 data (filesystem property)");
+}
+
 static int btrfs_fill_super(struct super_block *sb,
                            struct btrfs_fs_devices *fs_devices)
 {
@@ -986,6 +998,8 @@ static int btrfs_fill_super(struct super_block *sb,
                goto fail_close;
        }
 
+       btrfs_emit_stripe_alloc_state(fs_info);
+
        sb->s_root = d_make_root(&inode->vfs_inode);
        if (!sb->s_root) {
                ret = -ENOMEM;