btrfs_free_fs_info(fs_info);
 }
 
-static const struct fs_context_operations btrfs_fs_context_ops __maybe_unused = {
+static void btrfs_free_fs_context(struct fs_context *fc)
+{
+       struct btrfs_fs_context *ctx = fc->fs_private;
+
+       if (!ctx)
+               return;
+
+       kfree(ctx->subvol_name);
+       kfree(ctx);
+}
+
+static const struct fs_context_operations btrfs_fs_context_ops = {
        .parse_param    = btrfs_parse_param,
+       .free           = btrfs_free_fs_context,
 };
 
+static int __maybe_unused btrfs_init_fs_context(struct fs_context *fc)
+{
+       struct btrfs_fs_context *ctx;
+
+       ctx = kzalloc(sizeof(struct btrfs_fs_context), GFP_KERNEL);
+       if (!ctx)
+               return -ENOMEM;
+
+       ctx->thread_pool_size = min_t(unsigned long, num_online_cpus() + 2, 8);
+       ctx->max_inline = BTRFS_DEFAULT_MAX_INLINE;
+       ctx->commit_interval = BTRFS_DEFAULT_COMMIT_INTERVAL;
+       ctx->subvol_objectid = BTRFS_FS_TREE_OBJECTID;
+#ifndef CONFIG_BTRFS_FS_POSIX_ACL
+       ctx->noacl = true;
+#endif
+
+       fc->fs_private = ctx;
+       fc->ops = &btrfs_fs_context_ops;
+
+       return 0;
+}
+
 static struct file_system_type btrfs_fs_type = {
        .owner          = THIS_MODULE,
        .name           = "btrfs",