1 // SPDX-License-Identifier: GPL-2.0
2 #ifndef NO_BCACHEFS_CHARDEV
5 #include "bcachefs_ioctl.h"
15 #include <linux/cdev.h>
16 #include <linux/device.h>
18 #include <linux/ioctl.h>
19 #include <linux/major.h>
20 #include <linux/sched/task.h>
21 #include <linux/slab.h>
22 #include <linux/thread_with_file.h>
23 #include <linux/uaccess.h>
26 static int copy_to_user_errcode(void __user *to, const void *from, unsigned long n)
28 return copy_to_user(to, from, n) ? -EFAULT : 0;
31 /* returns with ref on ca->ref */
32 static struct bch_dev *bch2_device_lookup(struct bch_fs *c, u64 dev,
37 if (flags & BCH_BY_INDEX) {
38 if (dev >= c->sb.nr_devices)
39 return ERR_PTR(-EINVAL);
42 ca = rcu_dereference(c->devs[dev]);
44 percpu_ref_get(&ca->ref);
48 return ERR_PTR(-EINVAL);
52 path = strndup_user((const char __user *)
53 (unsigned long) dev, PATH_MAX);
55 return ERR_CAST(path);
57 ca = bch2_dev_lookup(c, path);
65 static long bch2_ioctl_assemble(struct bch_ioctl_assemble __user *user_arg)
67 struct bch_ioctl_assemble arg;
69 u64 *user_devs = NULL;
74 if (copy_from_user(&arg, user_arg, sizeof(arg)))
77 if (arg.flags || arg.pad)
80 user_devs = kmalloc_array(arg.nr_devs, sizeof(u64), GFP_KERNEL);
84 devs = kcalloc(arg.nr_devs, sizeof(char *), GFP_KERNEL);
86 if (copy_from_user(user_devs, user_arg->devs,
87 sizeof(u64) * arg.nr_devs))
90 for (i = 0; i < arg.nr_devs; i++) {
91 devs[i] = strndup_user((const char __user *)(unsigned long)
94 ret= PTR_ERR_OR_ZERO(devs[i]);
99 c = bch2_fs_open(devs, arg.nr_devs, bch2_opts_empty());
100 ret = PTR_ERR_OR_ZERO(c);
105 for (i = 0; i < arg.nr_devs; i++)
111 static long bch2_ioctl_incremental(struct bch_ioctl_incremental __user *user_arg)
113 struct bch_ioctl_incremental arg;
117 if (copy_from_user(&arg, user_arg, sizeof(arg)))
120 if (arg.flags || arg.pad)
123 path = strndup_user((const char __user *)(unsigned long) arg.dev, PATH_MAX);
124 ret = PTR_ERR_OR_ZERO(path);
128 err = bch2_fs_open_incremental(path);
132 pr_err("Could not register bcachefs devices: %s", err);
141 struct thread_with_stdio thr;
145 struct bch_opts opts;
148 static void bch2_fsck_thread_exit(struct thread_with_stdio *_thr)
150 struct fsck_thread *thr = container_of(_thr, struct fsck_thread, thr);
152 for (size_t i = 0; i < thr->nr_devs; i++)
158 static int bch2_fsck_offline_thread_fn(struct thread_with_stdio *stdio)
160 struct fsck_thread *thr = container_of(stdio, struct fsck_thread, thr);
161 struct bch_fs *c = bch2_fs_open(thr->devs, thr->nr_devs, thr->opts);
167 if (test_bit(BCH_FS_errors_fixed, &c->flags))
169 if (test_bit(BCH_FS_error, &c->flags))
175 stdio_redirect_printf(&stdio->stdio, false, "%s: errors fixed\n", c->name);
177 stdio_redirect_printf(&stdio->stdio, false, "%s: still has errors\n", c->name);
182 static const struct thread_with_stdio_ops bch2_offline_fsck_ops = {
183 .exit = bch2_fsck_thread_exit,
184 .fn = bch2_fsck_offline_thread_fn,
187 static long bch2_ioctl_fsck_offline(struct bch_ioctl_fsck_offline __user *user_arg)
189 struct bch_ioctl_fsck_offline arg;
190 struct fsck_thread *thr = NULL;
194 if (copy_from_user(&arg, user_arg, sizeof(arg)))
200 if (!capable(CAP_SYS_ADMIN))
203 if (!(devs = kcalloc(arg.nr_devs, sizeof(*devs), GFP_KERNEL)) ||
204 !(thr = kzalloc(sizeof(*thr), GFP_KERNEL)) ||
205 !(thr->devs = kcalloc(arg.nr_devs, sizeof(*thr->devs), GFP_KERNEL))) {
210 thr->opts = bch2_opts_empty();
211 thr->nr_devs = arg.nr_devs;
213 if (copy_from_user(devs, &user_arg->devs[0],
214 array_size(sizeof(user_arg->devs[0]), arg.nr_devs))) {
219 for (size_t i = 0; i < arg.nr_devs; i++) {
220 thr->devs[i] = strndup_user((char __user *)(unsigned long) devs[i], PATH_MAX);
221 ret = PTR_ERR_OR_ZERO(thr->devs[i]);
227 char *optstr = strndup_user((char __user *)(unsigned long) arg.opts, 1 << 16);
229 ret = PTR_ERR_OR_ZERO(optstr) ?:
230 bch2_parse_mount_opts(NULL, &thr->opts, optstr);
237 opt_set(thr->opts, stdio, (u64)(unsigned long)&thr->thr.stdio);
239 ret = run_thread_with_stdio(&thr->thr, &bch2_offline_fsck_ops);
243 bch2_fsck_thread_exit(&thr->thr);
244 pr_err("ret %s", bch2_err_str(ret));
250 static long bch2_global_ioctl(unsigned cmd, void __user *arg)
256 case BCH_IOCTL_ASSEMBLE:
257 return bch2_ioctl_assemble(arg);
258 case BCH_IOCTL_INCREMENTAL:
259 return bch2_ioctl_incremental(arg);
261 case BCH_IOCTL_FSCK_OFFLINE: {
262 ret = bch2_ioctl_fsck_offline(arg);
271 ret = bch2_err_class(ret);
275 static long bch2_ioctl_query_uuid(struct bch_fs *c,
276 struct bch_ioctl_query_uuid __user *user_arg)
278 return copy_to_user_errcode(&user_arg->uuid, &c->sb.user_uuid,
279 sizeof(c->sb.user_uuid));
283 static long bch2_ioctl_start(struct bch_fs *c, struct bch_ioctl_start arg)
285 if (!capable(CAP_SYS_ADMIN))
288 if (arg.flags || arg.pad)
291 return bch2_fs_start(c);
294 static long bch2_ioctl_stop(struct bch_fs *c)
296 if (!capable(CAP_SYS_ADMIN))
304 static long bch2_ioctl_disk_add(struct bch_fs *c, struct bch_ioctl_disk arg)
309 if (!capable(CAP_SYS_ADMIN))
312 if (arg.flags || arg.pad)
315 path = strndup_user((const char __user *)(unsigned long) arg.dev, PATH_MAX);
316 ret = PTR_ERR_OR_ZERO(path);
320 ret = bch2_dev_add(c, path);
326 static long bch2_ioctl_disk_remove(struct bch_fs *c, struct bch_ioctl_disk arg)
330 if (!capable(CAP_SYS_ADMIN))
333 if ((arg.flags & ~(BCH_FORCE_IF_DATA_LOST|
334 BCH_FORCE_IF_METADATA_LOST|
335 BCH_FORCE_IF_DEGRADED|
340 ca = bch2_device_lookup(c, arg.dev, arg.flags);
344 return bch2_dev_remove(c, ca, arg.flags);
347 static long bch2_ioctl_disk_online(struct bch_fs *c, struct bch_ioctl_disk arg)
352 if (!capable(CAP_SYS_ADMIN))
355 if (arg.flags || arg.pad)
358 path = strndup_user((const char __user *)(unsigned long) arg.dev, PATH_MAX);
359 ret = PTR_ERR_OR_ZERO(path);
363 ret = bch2_dev_online(c, path);
368 static long bch2_ioctl_disk_offline(struct bch_fs *c, struct bch_ioctl_disk arg)
373 if (!capable(CAP_SYS_ADMIN))
376 if ((arg.flags & ~(BCH_FORCE_IF_DATA_LOST|
377 BCH_FORCE_IF_METADATA_LOST|
378 BCH_FORCE_IF_DEGRADED|
383 ca = bch2_device_lookup(c, arg.dev, arg.flags);
387 ret = bch2_dev_offline(c, ca, arg.flags);
388 percpu_ref_put(&ca->ref);
392 static long bch2_ioctl_disk_set_state(struct bch_fs *c,
393 struct bch_ioctl_disk_set_state arg)
398 if (!capable(CAP_SYS_ADMIN))
401 if ((arg.flags & ~(BCH_FORCE_IF_DATA_LOST|
402 BCH_FORCE_IF_METADATA_LOST|
403 BCH_FORCE_IF_DEGRADED|
405 arg.pad[0] || arg.pad[1] || arg.pad[2] ||
406 arg.new_state >= BCH_MEMBER_STATE_NR)
409 ca = bch2_device_lookup(c, arg.dev, arg.flags);
413 ret = bch2_dev_set_state(c, ca, arg.new_state, arg.flags);
415 bch_err(c, "Error setting device state: %s", bch2_err_str(ret));
417 percpu_ref_put(&ca->ref);
421 struct bch_data_ctx {
422 struct thread_with_file thr;
425 struct bch_ioctl_data arg;
426 struct bch_move_stats stats;
429 static int bch2_data_thread(void *arg)
431 struct bch_data_ctx *ctx = container_of(arg, struct bch_data_ctx, thr);
433 ctx->thr.ret = bch2_data_job(ctx->c, &ctx->stats, ctx->arg);
434 ctx->stats.data_type = U8_MAX;
438 static int bch2_data_job_release(struct inode *inode, struct file *file)
440 struct bch_data_ctx *ctx = container_of(file->private_data, struct bch_data_ctx, thr);
442 thread_with_file_exit(&ctx->thr);
447 static ssize_t bch2_data_job_read(struct file *file, char __user *buf,
448 size_t len, loff_t *ppos)
450 struct bch_data_ctx *ctx = container_of(file->private_data, struct bch_data_ctx, thr);
451 struct bch_fs *c = ctx->c;
452 struct bch_ioctl_data_event e = {
453 .type = BCH_DATA_EVENT_PROGRESS,
454 .p.data_type = ctx->stats.data_type,
455 .p.btree_id = ctx->stats.pos.btree,
456 .p.pos = ctx->stats.pos.pos,
457 .p.sectors_done = atomic64_read(&ctx->stats.sectors_seen),
458 .p.sectors_total = bch2_fs_usage_read_short(c).used,
464 return copy_to_user_errcode(buf, &e, sizeof(e)) ?: sizeof(e);
467 static const struct file_operations bcachefs_data_ops = {
468 .release = bch2_data_job_release,
469 .read = bch2_data_job_read,
473 static long bch2_ioctl_data(struct bch_fs *c,
474 struct bch_ioctl_data arg)
476 struct bch_data_ctx *ctx;
479 if (!capable(CAP_SYS_ADMIN))
482 if (arg.op >= BCH_DATA_OP_NR || arg.flags)
485 ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
492 ret = run_thread_with_file(&ctx->thr,
500 static long bch2_ioctl_fs_usage(struct bch_fs *c,
501 struct bch_ioctl_fs_usage __user *user_arg)
503 struct bch_ioctl_fs_usage *arg = NULL;
504 struct bch_replicas_usage *dst_e, *dst_end;
505 struct bch_fs_usage_online *src;
506 u32 replica_entries_bytes;
510 if (!test_bit(BCH_FS_started, &c->flags))
513 if (get_user(replica_entries_bytes, &user_arg->replica_entries_bytes))
516 arg = kzalloc(size_add(sizeof(*arg), replica_entries_bytes), GFP_KERNEL);
520 src = bch2_fs_usage_read(c);
526 arg->capacity = c->capacity;
527 arg->used = bch2_fs_sectors_used(c, src);
528 arg->online_reserved = src->online_reserved;
530 for (i = 0; i < BCH_REPLICAS_MAX; i++)
531 arg->persistent_reserved[i] = src->u.persistent_reserved[i];
533 dst_e = arg->replicas;
534 dst_end = (void *) arg->replicas + replica_entries_bytes;
536 for (i = 0; i < c->replicas.nr; i++) {
537 struct bch_replicas_entry_v1 *src_e =
538 cpu_replicas_entry(&c->replicas, i);
540 /* check that we have enough space for one replicas entry */
541 if (dst_e + 1 > dst_end) {
546 dst_e->sectors = src->u.replicas[i];
549 /* recheck after setting nr_devs: */
550 if (replicas_usage_next(dst_e) > dst_end) {
555 memcpy(dst_e->r.devs, src_e->devs, src_e->nr_devs);
557 dst_e = replicas_usage_next(dst_e);
560 arg->replica_entries_bytes = (void *) dst_e - (void *) arg->replicas;
562 percpu_up_read(&c->mark_lock);
568 ret = copy_to_user_errcode(user_arg, arg,
569 sizeof(*arg) + arg->replica_entries_bytes);
575 /* obsolete, didn't allow for new data types: */
576 static long bch2_ioctl_dev_usage(struct bch_fs *c,
577 struct bch_ioctl_dev_usage __user *user_arg)
579 struct bch_ioctl_dev_usage arg;
580 struct bch_dev_usage src;
584 if (!test_bit(BCH_FS_started, &c->flags))
587 if (copy_from_user(&arg, user_arg, sizeof(arg)))
590 if ((arg.flags & ~BCH_BY_INDEX) ||
596 ca = bch2_device_lookup(c, arg.dev, arg.flags);
600 src = bch2_dev_usage_read(ca);
602 arg.state = ca->mi.state;
603 arg.bucket_size = ca->mi.bucket_size;
604 arg.nr_buckets = ca->mi.nbuckets - ca->mi.first_bucket;
606 for (i = 0; i < BCH_DATA_NR; i++) {
607 arg.d[i].buckets = src.d[i].buckets;
608 arg.d[i].sectors = src.d[i].sectors;
609 arg.d[i].fragmented = src.d[i].fragmented;
612 percpu_ref_put(&ca->ref);
614 return copy_to_user_errcode(user_arg, &arg, sizeof(arg));
617 static long bch2_ioctl_dev_usage_v2(struct bch_fs *c,
618 struct bch_ioctl_dev_usage_v2 __user *user_arg)
620 struct bch_ioctl_dev_usage_v2 arg;
621 struct bch_dev_usage src;
625 if (!test_bit(BCH_FS_started, &c->flags))
628 if (copy_from_user(&arg, user_arg, sizeof(arg)))
631 if ((arg.flags & ~BCH_BY_INDEX) ||
637 ca = bch2_device_lookup(c, arg.dev, arg.flags);
641 src = bch2_dev_usage_read(ca);
643 arg.state = ca->mi.state;
644 arg.bucket_size = ca->mi.bucket_size;
645 arg.nr_data_types = min(arg.nr_data_types, BCH_DATA_NR);
646 arg.nr_buckets = ca->mi.nbuckets - ca->mi.first_bucket;
648 ret = copy_to_user_errcode(user_arg, &arg, sizeof(arg));
652 for (unsigned i = 0; i < arg.nr_data_types; i++) {
653 struct bch_ioctl_dev_usage_type t = {
654 .buckets = src.d[i].buckets,
655 .sectors = src.d[i].sectors,
656 .fragmented = src.d[i].fragmented,
659 ret = copy_to_user_errcode(&user_arg->d[i], &t, sizeof(t));
664 percpu_ref_put(&ca->ref);
668 static long bch2_ioctl_read_super(struct bch_fs *c,
669 struct bch_ioctl_read_super arg)
671 struct bch_dev *ca = NULL;
675 if (!capable(CAP_SYS_ADMIN))
678 if ((arg.flags & ~(BCH_BY_INDEX|BCH_READ_DEV)) ||
682 mutex_lock(&c->sb_lock);
684 if (arg.flags & BCH_READ_DEV) {
685 ca = bch2_device_lookup(c, arg.dev, arg.flags);
697 if (vstruct_bytes(sb) > arg.size) {
702 ret = copy_to_user_errcode((void __user *)(unsigned long)arg.sb, sb,
705 if (!IS_ERR_OR_NULL(ca))
706 percpu_ref_put(&ca->ref);
707 mutex_unlock(&c->sb_lock);
711 static long bch2_ioctl_disk_get_idx(struct bch_fs *c,
712 struct bch_ioctl_disk_get_idx arg)
714 dev_t dev = huge_decode_dev(arg.dev);
716 if (!capable(CAP_SYS_ADMIN))
722 for_each_online_member(c, ca)
723 if (ca->dev == dev) {
724 percpu_ref_put(&ca->io_ref);
728 return -BCH_ERR_ENOENT_dev_idx_not_found;
731 static long bch2_ioctl_disk_resize(struct bch_fs *c,
732 struct bch_ioctl_disk_resize arg)
737 if (!capable(CAP_SYS_ADMIN))
740 if ((arg.flags & ~BCH_BY_INDEX) ||
744 ca = bch2_device_lookup(c, arg.dev, arg.flags);
748 ret = bch2_dev_resize(c, ca, arg.nbuckets);
750 percpu_ref_put(&ca->ref);
754 static long bch2_ioctl_disk_resize_journal(struct bch_fs *c,
755 struct bch_ioctl_disk_resize_journal arg)
760 if (!capable(CAP_SYS_ADMIN))
763 if ((arg.flags & ~BCH_BY_INDEX) ||
767 if (arg.nbuckets > U32_MAX)
770 ca = bch2_device_lookup(c, arg.dev, arg.flags);
774 ret = bch2_set_nr_journal_buckets(c, ca, arg.nbuckets);
776 percpu_ref_put(&ca->ref);
780 static int bch2_fsck_online_thread_fn(struct thread_with_stdio *stdio)
782 struct fsck_thread *thr = container_of(stdio, struct fsck_thread, thr);
783 struct bch_fs *c = thr->c;
785 c->stdio_filter = current;
786 c->stdio = &thr->thr.stdio;
789 * XXX: can we figure out a way to do this without mucking with c->opts?
791 unsigned old_fix_errors = c->opts.fix_errors;
792 if (opt_defined(thr->opts, fix_errors))
793 c->opts.fix_errors = thr->opts.fix_errors;
795 c->opts.fix_errors = FSCK_FIX_ask;
798 set_bit(BCH_FS_fsck_running, &c->flags);
800 c->curr_recovery_pass = BCH_RECOVERY_PASS_check_alloc_info;
801 int ret = bch2_run_online_recovery_passes(c);
803 clear_bit(BCH_FS_fsck_running, &c->flags);
807 c->stdio_filter = NULL;
808 c->opts.fix_errors = old_fix_errors;
810 up(&c->online_fsck_mutex);
815 static const struct thread_with_stdio_ops bch2_online_fsck_ops = {
816 .exit = bch2_fsck_thread_exit,
817 .fn = bch2_fsck_online_thread_fn,
820 static long bch2_ioctl_fsck_online(struct bch_fs *c,
821 struct bch_ioctl_fsck_online arg)
823 struct fsck_thread *thr = NULL;
829 if (!capable(CAP_SYS_ADMIN))
832 if (!bch2_ro_ref_tryget(c))
835 if (down_trylock(&c->online_fsck_mutex)) {
840 thr = kzalloc(sizeof(*thr), GFP_KERNEL);
847 thr->opts = bch2_opts_empty();
850 char *optstr = strndup_user((char __user *)(unsigned long) arg.opts, 1 << 16);
852 ret = PTR_ERR_OR_ZERO(optstr) ?:
853 bch2_parse_mount_opts(c, &thr->opts, optstr);
860 ret = run_thread_with_stdio(&thr->thr, &bch2_online_fsck_ops);
865 bch2_fsck_thread_exit(&thr->thr);
866 up(&c->online_fsck_mutex);
872 #define BCH_IOCTL(_name, _argtype) \
876 if (copy_from_user(&i, arg, sizeof(i))) \
878 ret = bch2_ioctl_##_name(c, i); \
882 long bch2_fs_ioctl(struct bch_fs *c, unsigned cmd, void __user *arg)
887 case BCH_IOCTL_QUERY_UUID:
888 return bch2_ioctl_query_uuid(c, arg);
889 case BCH_IOCTL_FS_USAGE:
890 return bch2_ioctl_fs_usage(c, arg);
891 case BCH_IOCTL_DEV_USAGE:
892 return bch2_ioctl_dev_usage(c, arg);
893 case BCH_IOCTL_DEV_USAGE_V2:
894 return bch2_ioctl_dev_usage_v2(c, arg);
896 case BCH_IOCTL_START:
897 BCH_IOCTL(start, struct bch_ioctl_start);
899 return bch2_ioctl_stop(c);
901 case BCH_IOCTL_READ_SUPER:
902 BCH_IOCTL(read_super, struct bch_ioctl_read_super);
903 case BCH_IOCTL_DISK_GET_IDX:
904 BCH_IOCTL(disk_get_idx, struct bch_ioctl_disk_get_idx);
907 if (!test_bit(BCH_FS_started, &c->flags))
911 case BCH_IOCTL_DISK_ADD:
912 BCH_IOCTL(disk_add, struct bch_ioctl_disk);
913 case BCH_IOCTL_DISK_REMOVE:
914 BCH_IOCTL(disk_remove, struct bch_ioctl_disk);
915 case BCH_IOCTL_DISK_ONLINE:
916 BCH_IOCTL(disk_online, struct bch_ioctl_disk);
917 case BCH_IOCTL_DISK_OFFLINE:
918 BCH_IOCTL(disk_offline, struct bch_ioctl_disk);
919 case BCH_IOCTL_DISK_SET_STATE:
920 BCH_IOCTL(disk_set_state, struct bch_ioctl_disk_set_state);
922 BCH_IOCTL(data, struct bch_ioctl_data);
923 case BCH_IOCTL_DISK_RESIZE:
924 BCH_IOCTL(disk_resize, struct bch_ioctl_disk_resize);
925 case BCH_IOCTL_DISK_RESIZE_JOURNAL:
926 BCH_IOCTL(disk_resize_journal, struct bch_ioctl_disk_resize_journal);
927 case BCH_IOCTL_FSCK_ONLINE:
928 BCH_IOCTL(fsck_online, struct bch_ioctl_fsck_online);
934 ret = bch2_err_class(ret);
938 static DEFINE_IDR(bch_chardev_minor);
940 static long bch2_chardev_ioctl(struct file *filp, unsigned cmd, unsigned long v)
942 unsigned minor = iminor(file_inode(filp));
943 struct bch_fs *c = minor < U8_MAX ? idr_find(&bch_chardev_minor, minor) : NULL;
944 void __user *arg = (void __user *) v;
947 ? bch2_fs_ioctl(c, cmd, arg)
948 : bch2_global_ioctl(cmd, arg);
951 static const struct file_operations bch_chardev_fops = {
952 .owner = THIS_MODULE,
953 .unlocked_ioctl = bch2_chardev_ioctl,
954 .open = nonseekable_open,
957 static int bch_chardev_major;
958 static struct class *bch_chardev_class;
959 static struct device *bch_chardev;
961 void bch2_fs_chardev_exit(struct bch_fs *c)
963 if (!IS_ERR_OR_NULL(c->chardev))
964 device_unregister(c->chardev);
966 idr_remove(&bch_chardev_minor, c->minor);
969 int bch2_fs_chardev_init(struct bch_fs *c)
971 c->minor = idr_alloc(&bch_chardev_minor, c, 0, 0, GFP_KERNEL);
975 c->chardev = device_create(bch_chardev_class, NULL,
976 MKDEV(bch_chardev_major, c->minor), c,
977 "bcachefs%u-ctl", c->minor);
978 if (IS_ERR(c->chardev))
979 return PTR_ERR(c->chardev);
984 void bch2_chardev_exit(void)
986 if (!IS_ERR_OR_NULL(bch_chardev_class))
987 device_destroy(bch_chardev_class,
988 MKDEV(bch_chardev_major, U8_MAX));
989 if (!IS_ERR_OR_NULL(bch_chardev_class))
990 class_destroy(bch_chardev_class);
991 if (bch_chardev_major > 0)
992 unregister_chrdev(bch_chardev_major, "bcachefs");
995 int __init bch2_chardev_init(void)
997 bch_chardev_major = register_chrdev(0, "bcachefs-ctl", &bch_chardev_fops);
998 if (bch_chardev_major < 0)
999 return bch_chardev_major;
1001 bch_chardev_class = class_create("bcachefs");
1002 if (IS_ERR(bch_chardev_class))
1003 return PTR_ERR(bch_chardev_class);
1005 bch_chardev = device_create(bch_chardev_class, NULL,
1006 MKDEV(bch_chardev_major, U8_MAX),
1007 NULL, "bcachefs-ctl");
1008 if (IS_ERR(bch_chardev))
1009 return PTR_ERR(bch_chardev);
1014 #endif /* NO_BCACHEFS_CHARDEV */