* when their caching thread finishes, now that the policy is on.
*/
stripe_alloc_sweep_groups(fs_info, true);
- btrfs_info(fs_info,
- "using stripe-exclusive allocation for raid56 data");
- if (live)
+ /*
+ * At mount btrfs_fill_super() states the outcome once, for the option
+ * and the property alike, so repeating it here would only double the
+ * line. A property set on a live filesystem has no such reporter.
+ */
+ if (live) {
+ btrfs_info(fs_info,
+ "using stripe-exclusive allocation for raid56 data (filesystem property)");
queue_work(system_unbound_wq, &fs_info->stripe_alloc_enable_work);
+ }
return 0;
}
return 0;
}
+/*
+ * State whether stripe-exclusive allocation is on, and which of the two things
+ * that can turn it on did.
+ *
+ * Neither path said so before. The mount option sets the flag while
+ * btrfs_emit_options() has no entry to print for it, and the
+ * btrfs.stripe_alloc property applies later still, when the root directory's
+ * inode is read. So nothing in the log distinguished a filesystem running the
+ * policy from one that was not: silence meant "off" and "on via the mount
+ * option" equally well, and the only way to answer the question was
+ * /proc/mounts on a live system -- no use at all when reading a log after a
+ * crash. Say it once, whatever turned it on.
+ */
+static void btrfs_emit_stripe_alloc_state(struct btrfs_fs_info *info,
+ bool from_option)
+{
+ if (!btrfs_test_opt(info, STRIPE_ALLOC))
+ return;
+ btrfs_info(info, "using stripe-exclusive allocation for raid56 data (%s)",
+ from_option ? "mount option" : "filesystem property");
+}
+
static int btrfs_fill_super(struct super_block *sb,
struct btrfs_fs_devices *fs_devices)
{
struct btrfs_inode *inode;
struct btrfs_fs_info *fs_info = btrfs_sb(sb);
+ bool stripe_alloc_from_option;
int ret;
sb->s_maxbytes = MAX_LFS_FILESIZE;
return ret;
}
+ /*
+ * Sample what the mount option asked for before open_ctree(): the mount
+ * context has already been copied into fs_info by now, and open_ctree()
+ * goes far enough into the mount to read the root directory's inode and
+ * apply btrfs.stripe_alloc from it. Sampling afterwards would report
+ * every property-enabled filesystem as an option-enabled one.
+ */
+ stripe_alloc_from_option = btrfs_test_opt(fs_info, STRIPE_ALLOC);
+
ret = open_ctree(sb, fs_devices);
if (ret) {
btrfs_err(fs_info, "open_ctree failed: %d", ret);
goto fail_close;
}
+ btrfs_emit_stripe_alloc_state(fs_info, stripe_alloc_from_option);
+
sb->s_root = d_make_root(&inode->vfs_inode);
if (!sb->s_root) {
ret = -ENOMEM;
fc->sb_flags_mask |= SB_POSIXACL;
btrfs_emit_options(fs_info, &old_ctx);
+ /*
+ * A remount can only change this through the option; the property path
+ * reports itself. Say so only when it actually changed.
+ */
+ if (!btrfs_raw_test_opt(old_ctx.mount_opt, STRIPE_ALLOC) !=
+ !btrfs_test_opt(fs_info, STRIPE_ALLOC)) {
+ if (btrfs_test_opt(fs_info, STRIPE_ALLOC))
+ btrfs_emit_stripe_alloc_state(fs_info, true);
+ else
+ btrfs_info(fs_info,
+ "stripe-exclusive allocation for raid56 data is off");
+ }
wake_up_process(fs_info->transaction_kthread);
btrfs_remount_cleanup(fs_info, old_ctx.mount_opt);
btrfs_clear_oneshot_options(fs_info);