diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-07-11 23:23:40 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-08-02 20:30:25 -0400 |
commit | 336de03dadb34801ec11d7d992d56483c00e69af (patch) | |
tree | 4e9c21a7d8f7de093c60fc643cf8b719d08c7e81 /fs/bcachefs/super.c | |
parent | fa5cd59166b536ad3c67ed8261427e77665e736f (diff) |
bcachefs: BCH_IOCTL_FSCKBCH_IOCTL_FSCK
This adds a new ioctl for running fsck on a list of devices.
Normally, if we wish to use the kernel's implementation of fsck we'd run
it at mount time with -o fsck. This ioctl lets us run fsck without
mounting, so that userspace bcachefs-tools can transparently switch to
the kernel's implementation of fsck when appropriate - primarily if the
kernel version of bcachefs better matches the filesystem on disk.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/super.c')
-rw-r--r-- | fs/bcachefs/super.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/fs/bcachefs/super.c b/fs/bcachefs/super.c index eee56969c779..40c903ad29aa 100644 --- a/fs/bcachefs/super.c +++ b/fs/bcachefs/super.c @@ -64,6 +64,25 @@ MODULE_LICENSE("GPL"); MODULE_AUTHOR("Kent Overstreet <kent.overstreet@gmail.com>"); +void __bch2_print(struct bch_fs *c, const char *fmt, ...) +{ + va_list args; + + va_start(args, fmt); + if (likely(!c->output)) { + vprintk(fmt, args); + } else { + unsigned long flags; + + spin_lock_irqsave(&c->output->lock, flags); + prt_vprintf(&c->output->buf, fmt, args); + spin_unlock_irqrestore(&c->output->lock, flags); + + wake_up(&c->output->wait); + } + va_end(args); +} + #define KTYPE(type) \ static const struct attribute_group type ## _group = { \ .attrs = type ## _files \ @@ -667,6 +686,8 @@ static struct bch_fs *bch2_fs_alloc(struct bch_sb *sb, struct bch_opts opts) goto out; } + c->output = (void *)(unsigned long) opts.log_output; + __module_get(THIS_MODULE); closure_init(&c->cl, NULL); |