Update bcachefs sources to f0ebca18293c bcachefs: bch2_fs_open() now takes a darray

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2025-04-28 14:50:43 -04:00
parent 0589d9f3c3
commit 6d7b47685b
20 changed files with 98 additions and 67 deletions

View File

@ -1 +1 @@
6e73711dc3556f90eefa12d6cc7547d4b0eba5dc f0ebca18293c398beddfd80e2ec3575401e7abc4

View File

@ -9,13 +9,25 @@ pub struct Fs {
} }
impl Fs { impl Fs {
pub fn open(devs: &[PathBuf], opts: c::bch_opts) -> Result<Fs, bch_errcode> { pub fn open(devs: &[PathBuf], mut opts: c::bch_opts) -> Result<Fs, bch_errcode> {
let devs: Vec<_> = devs let devs_cstrs : Vec<_> = devs
.iter() .iter()
.map(|i| CString::new(i.as_os_str().as_bytes()).unwrap().into_raw()) .map(|i| CString::new(i.as_os_str().as_bytes()).unwrap())
.collect(); .collect();
let ret = unsafe { c::bch2_fs_open(devs[..].as_ptr(), devs.len() as u32, opts) }; let mut devs_array: Vec<_> = devs_cstrs
.iter()
.map(|i| i.as_ptr())
.collect();
let ret = unsafe {
let mut devs: c::darray_const_str = std::mem::zeroed();
devs.data = devs_array[..].as_mut_ptr();
devs.nr = devs_array.len();
c::bch2_fs_open(&mut devs, &mut opts)
};
errptr_to_result(ret).map(|fs| Fs { raw: fs }) errptr_to_result(ret).map(|fs| Fs { raw: fs })
} }

View File

@ -515,7 +515,11 @@ static int cmd_device_resize(int argc, char *argv[])
} else { } else {
printf("Doing offline resize of %s\n", dev); printf("Doing offline resize of %s\n", dev);
struct bch_fs *c = bch2_fs_open(&dev, 1, bch2_opts_empty()); darray_const_str devs = {};
darray_push(&devs, dev);
struct bch_opts opts = bch2_opts_empty();
struct bch_fs *c = bch2_fs_open(&devs, &opts);
if (IS_ERR(c)) if (IS_ERR(c))
die("error opening %s: %s", dev, bch2_err_str(PTR_ERR(c))); die("error opening %s: %s", dev, bch2_err_str(PTR_ERR(c)));
@ -612,7 +616,11 @@ static int cmd_device_resize_journal(int argc, char *argv[])
} else { } else {
printf("%s is offline - starting:\n", dev); printf("%s is offline - starting:\n", dev);
struct bch_fs *c = bch2_fs_open(&dev, 1, bch2_opts_empty()); darray_const_str devs = {};
darray_push(&devs, dev);
struct bch_opts opts = bch2_opts_empty();
struct bch_fs *c = bch2_fs_open(&devs, &opts);
if (IS_ERR(c)) if (IS_ERR(c))
die("error opening %s: %s", dev, bch2_err_str(PTR_ERR(c))); die("error opening %s: %s", dev, bch2_err_str(PTR_ERR(c)));

View File

@ -147,7 +147,9 @@ int cmd_dump(int argc, char *argv[])
if (!argc) if (!argc)
die("Please supply device(s) to check"); die("Please supply device(s) to check");
struct bch_fs *c = bch2_fs_open(argv, argc, opts); darray_const_str devs = get_or_split_cmdline_devs(argc, argv);
struct bch_fs *c = bch2_fs_open(&devs, &opts);
if (IS_ERR(c)) if (IS_ERR(c))
die("error opening devices: %s", bch2_err_str(PTR_ERR(c))); die("error opening devices: %s", bch2_err_str(PTR_ERR(c)));
@ -177,5 +179,6 @@ int cmd_dump(int argc, char *argv[])
up_read(&c->state_lock); up_read(&c->state_lock);
bch2_fs_stop(c); bch2_fs_stop(c);
darray_exit(&devs);
return 0; return 0;
} }

View File

@ -123,7 +123,7 @@ static void build_fs(struct bch_fs *c, const char *src_path)
int cmd_format(int argc, char *argv[]) int cmd_format(int argc, char *argv[])
{ {
dev_opts_list devices = {}; dev_opts_list devices = {};
darray_str device_paths = {}; darray_const_str device_paths = {};
struct format_opts opts = format_opts_default(); struct format_opts opts = format_opts_default();
struct dev_opts dev_opts = dev_opts_default(); struct dev_opts dev_opts = dev_opts_default();
bool force = false, no_passphrase = false, quiet = false, initialize = true, verbose = false; bool force = false, no_passphrase = false, quiet = false, initialize = true, verbose = false;
@ -302,9 +302,8 @@ int cmd_format(int argc, char *argv[])
* Start the filesystem once, to allocate the journal and create * Start the filesystem once, to allocate the journal and create
* the root directory: * the root directory:
*/ */
struct bch_fs *c = bch2_fs_open(device_paths.data, struct bch_opts open_opts = bch2_opts_empty();
device_paths.nr, struct bch_fs *c = bch2_fs_open(&device_paths, &open_opts);
bch2_opts_empty());
if (IS_ERR(c)) if (IS_ERR(c))
die("error opening %s: %s", device_paths.data[0], die("error opening %s: %s", device_paths.data[0],
bch2_err_str(PTR_ERR(c))); bch2_err_str(PTR_ERR(c)));

View File

@ -113,7 +113,7 @@ static void append_opt(struct printbuf *out, const char *opt)
prt_str(out, opt); prt_str(out, opt);
} }
static bool should_use_kernel_fsck(darray_str devs) static bool should_use_kernel_fsck(darray_const_str devs)
{ {
system("modprobe bcachefs"); system("modprobe bcachefs");
@ -131,7 +131,7 @@ static bool should_use_kernel_fsck(darray_str devs)
opt_set(opts, nochanges, true); opt_set(opts, nochanges, true);
opt_set(opts, read_only, true); opt_set(opts, read_only, true);
struct bch_fs *c = bch2_fs_open(devs.data, devs.nr, opts); struct bch_fs *c = bch2_fs_open(&devs, &opts);
if (IS_ERR(c)) if (IS_ERR(c))
return false; return false;
@ -265,7 +265,7 @@ int cmd_fsck(int argc, char *argv[])
exit(8); exit(8);
} }
darray_str devs = get_or_split_cmdline_devs(argc, argv); darray_const_str devs = get_or_split_cmdline_devs(argc, argv);
darray_for_each(devs, i) darray_for_each(devs, i)
if (dev_mounted(*i)) { if (dev_mounted(*i)) {
@ -324,7 +324,7 @@ userland_fsck:
if (ret) if (ret)
return ret; return ret;
struct bch_fs *c = bch2_fs_open(devs.data, devs.nr, opts); struct bch_fs *c = bch2_fs_open(&devs, &opts);
if (IS_ERR(c)) if (IS_ERR(c))
exit(8); exit(8);

View File

@ -87,12 +87,13 @@ int cmd_unlock(int argc, char *argv[])
int cmd_set_passphrase(int argc, char *argv[]) int cmd_set_passphrase(int argc, char *argv[])
{ {
struct bch_opts opts = bch2_opts_empty(); args_shift(1);
struct bch_fs *c; if (!argc)
if (argc < 2)
die("Please supply one or more devices"); die("Please supply one or more devices");
darray_const_str devs = get_or_split_cmdline_devs(argc, argv);
struct bch_opts opts = bch2_opts_empty();
opt_set(opts, nostart, true); opt_set(opts, nostart, true);
/* /*
@ -100,7 +101,7 @@ int cmd_set_passphrase(int argc, char *argv[])
* to make sure we're opening and updating every component device: * to make sure we're opening and updating every component device:
*/ */
c = bch2_fs_open(argv + 1, argc - 1, opts); struct bch_fs *c = bch2_fs_open(&devs, &opts);
if (IS_ERR(c)) if (IS_ERR(c))
die("Error opening %s: %s", argv[1], bch2_err_str(PTR_ERR(c))); die("Error opening %s: %s", argv[1], bch2_err_str(PTR_ERR(c)));
@ -126,14 +127,16 @@ int cmd_set_passphrase(int argc, char *argv[])
int cmd_remove_passphrase(int argc, char *argv[]) int cmd_remove_passphrase(int argc, char *argv[])
{ {
struct bch_opts opts = bch2_opts_empty(); args_shift(1);
struct bch_fs *c; if (!argc)
if (argc < 2)
die("Please supply one or more devices"); die("Please supply one or more devices");
darray_const_str devs = get_or_split_cmdline_devs(argc, argv);
struct bch_opts opts = bch2_opts_empty();
opt_set(opts, nostart, true); opt_set(opts, nostart, true);
c = bch2_fs_open(argv + 1, argc - 1, opts);
struct bch_fs *c = bch2_fs_open(&devs, &opts);
if (IS_ERR(c)) if (IS_ERR(c))
die("Error opening %s: %s", argv[1], bch2_err_str(PTR_ERR(c))); die("Error opening %s: %s", argv[1], bch2_err_str(PTR_ERR(c)));

View File

@ -74,7 +74,9 @@ int cmd_kill_btree_node(int argc, char *argv[])
if (!argc) if (!argc)
die("Please supply device(s)"); die("Please supply device(s)");
struct bch_fs *c = bch2_fs_open(argv, argc, opts); darray_const_str devs = get_or_split_cmdline_devs(argc, argv);
struct bch_fs *c = bch2_fs_open(&devs, &opts);
if (IS_ERR(c)) if (IS_ERR(c))
die("error opening %s: %s", argv[0], bch2_err_str(PTR_ERR(c))); die("error opening %s: %s", argv[0], bch2_err_str(PTR_ERR(c)));

View File

@ -319,9 +319,9 @@ int cmd_list_journal(int argc, char *argv[])
if (!argc) if (!argc)
die("Please supply device(s) to open"); die("Please supply device(s) to open");
darray_str devs = get_or_split_cmdline_devs(argc, argv); darray_const_str devs = get_or_split_cmdline_devs(argc, argv);
struct bch_fs *c = bch2_fs_open(devs.data, devs.nr, opts); struct bch_fs *c = bch2_fs_open(&devs, &opts);
if (IS_ERR(c)) if (IS_ERR(c))
die("error opening %s: %s", argv[0], bch2_err_str(PTR_ERR(c))); die("error opening %s: %s", argv[0], bch2_err_str(PTR_ERR(c)));

View File

@ -253,14 +253,15 @@ static int migrate_fs(const char *fs_path,
free(sb); free(sb);
char *path[1] = { dev->path }; darray_const_str dev_paths = {};
darray_push(&dev_paths, dev->path);
struct bch_opts opts = bch2_opts_empty(); struct bch_opts opts = bch2_opts_empty();
opt_set(opts, sb, sb_offset); opt_set(opts, sb, sb_offset);
opt_set(opts, nostart, true); opt_set(opts, nostart, true);
opt_set(opts, noexcl, true); opt_set(opts, noexcl, true);
struct bch_fs *c = bch2_fs_open(path, 1, opts); struct bch_fs *c = bch2_fs_open(&dev_paths, &opts);
if (IS_ERR(c)) if (IS_ERR(c))
die("Error opening new filesystem: %s", bch2_err_str(PTR_ERR(c))); die("Error opening new filesystem: %s", bch2_err_str(PTR_ERR(c)));
@ -295,7 +296,7 @@ static int migrate_fs(const char *fs_path,
opt_set(opts, nochanges, true); opt_set(opts, nochanges, true);
opt_set(opts, read_only, true); opt_set(opts, read_only, true);
c = bch2_fs_open(path, 1, opts); c = bch2_fs_open(&dev_paths, &opts);
if (IS_ERR(c)) if (IS_ERR(c))
die("Error opening new filesystem: %s", bch2_err_str(PTR_ERR(c))); die("Error opening new filesystem: %s", bch2_err_str(PTR_ERR(c)));
@ -377,14 +378,14 @@ static void migrate_superblock_usage(void)
int cmd_migrate_superblock(int argc, char *argv[]) int cmd_migrate_superblock(int argc, char *argv[])
{ {
char *dev = NULL; darray_const_str devs = {};
u64 sb_offset = 0; u64 sb_offset = 0;
int opt, ret; int opt, ret;
while ((opt = getopt(argc, argv, "d:o:h")) != -1) while ((opt = getopt(argc, argv, "d:o:h")) != -1)
switch (opt) { switch (opt) {
case 'd': case 'd':
dev = optarg; darray_push(&devs, optarg);
break; break;
case 'o': case 'o':
ret = kstrtou64(optarg, 10, &sb_offset); ret = kstrtou64(optarg, 10, &sb_offset);
@ -396,13 +397,13 @@ int cmd_migrate_superblock(int argc, char *argv[])
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
} }
if (!dev) if (!devs.nr)
die("Please specify a device"); die("Please specify a device");
if (!sb_offset) if (!sb_offset)
die("Please specify offset of existing superblock"); die("Please specify offset of existing superblock");
int fd = xopen(dev, O_RDWR); int fd = xopen(devs.data[0], O_RDWR);
struct bch_sb *sb = __bch2_super_read(fd, sb_offset); struct bch_sb *sb = __bch2_super_read(fd, sb_offset);
unsigned sb_size = 1U << sb->layout.sb_max_size_bits; unsigned sb_size = 1U << sb->layout.sb_max_size_bits;
@ -435,7 +436,7 @@ int cmd_migrate_superblock(int argc, char *argv[])
opt_set(opts, nostart, true); opt_set(opts, nostart, true);
opt_set(opts, sb, sb_offset); opt_set(opts, sb, sb_offset);
struct bch_fs *c = bch2_fs_open(&dev, 1, opts); struct bch_fs *c = bch2_fs_open(&devs, &opts);
ret = PTR_ERR_OR_ZERO(c) ?: ret = PTR_ERR_OR_ZERO(c) ?:
bch2_buckets_nouse_alloc(c); bch2_buckets_nouse_alloc(c);
if (ret) if (ret)
@ -461,7 +462,7 @@ int cmd_migrate_superblock(int argc, char *argv[])
* inconsequential: * inconsequential:
*/ */
c = bch2_fs_open(&dev, 1, opts); c = bch2_fs_open(&devs, &opts);
ret = PTR_ERR_OR_ZERO(c); ret = PTR_ERR_OR_ZERO(c);
if (ret) if (ret)
die("error opening filesystem: %s", bch2_err_str(ret)); die("error opening filesystem: %s", bch2_err_str(ret));

View File

@ -94,10 +94,12 @@ int cmd_set_option(int argc, char *argv[])
} }
if (!online) { if (!online) {
darray_const_str devs = get_or_split_cmdline_devs(argc, argv);
struct bch_opts open_opts = bch2_opts_empty(); struct bch_opts open_opts = bch2_opts_empty();
opt_set(open_opts, nostart, true); opt_set(open_opts, nostart, true);
struct bch_fs *c = bch2_fs_open(argv, argc, open_opts); struct bch_fs *c = bch2_fs_open(&devs, &open_opts);
if (IS_ERR(c)) { if (IS_ERR(c)) {
fprintf(stderr, "error opening %s: %s\n", argv[0], bch2_err_str(PTR_ERR(c))); fprintf(stderr, "error opening %s: %s\n", argv[0], bch2_err_str(PTR_ERR(c)));
exit(EXIT_FAILURE); exit(EXIT_FAILURE);

View File

@ -547,7 +547,7 @@ char *dev_to_path(dev_t dev)
return path; return path;
} }
struct mntent *dev_to_mount(char *dev) struct mntent *dev_to_mount(const char *dev)
{ {
struct mntent *mnt, *ret = NULL; struct mntent *mnt, *ret = NULL;
FILE *f = setmntent("/proc/mounts", "r"); FILE *f = setmntent("/proc/mounts", "r");
@ -586,7 +586,7 @@ found:
return ret; return ret;
} }
int dev_mounted(char *dev) int dev_mounted(const char *dev)
{ {
struct mntent *mnt = dev_to_mount(dev); struct mntent *mnt = dev_to_mount(dev);
@ -748,9 +748,9 @@ unsigned version_parse(char *buf)
return BCH_VERSION(major, minor); return BCH_VERSION(major, minor);
} }
darray_str get_or_split_cmdline_devs(int argc, char *argv[]) darray_const_str get_or_split_cmdline_devs(int argc, char *argv[])
{ {
darray_str ret = {}; darray_const_str ret = {};
if (argc == 1) { if (argc == 1) {
bch2_split_devs(argv[0], &ret); bch2_split_devs(argv[0], &ret);

View File

@ -186,8 +186,8 @@ u32 crc32c(u32, const void *, size_t);
char *dev_to_name(dev_t); char *dev_to_name(dev_t);
char *dev_to_path(dev_t); char *dev_to_path(dev_t);
struct mntent *dev_to_mount(char *); struct mntent *dev_to_mount(const char *);
int dev_mounted(char *); int dev_mounted(const char *);
char *fd_to_dev_model(int); char *fd_to_dev_model(int);
#define args_shift(_nr) \ #define args_shift(_nr) \
@ -217,7 +217,7 @@ struct bbpos_range bbpos_range_parse(char *);
unsigned version_parse(char *); unsigned version_parse(char *);
darray_str get_or_split_cmdline_devs(int argc, char *argv[]); darray_const_str get_or_split_cmdline_devs(int argc, char *argv[]);
char *pop_cmd(int *argc, char *argv[]); char *pop_cmd(int *argc, char *argv[]);

View File

@ -21,6 +21,7 @@ struct { \
typedef DARRAY(char) darray_char; typedef DARRAY(char) darray_char;
typedef DARRAY(char *) darray_str; typedef DARRAY(char *) darray_str;
typedef DARRAY(const char *) darray_const_str;
typedef DARRAY(u8) darray_u8; typedef DARRAY(u8) darray_u8;
typedef DARRAY(u16) darray_u16; typedef DARRAY(u16) darray_u16;

View File

@ -2463,7 +2463,7 @@ static int bch2_fs_get_tree(struct fs_context *fc)
struct inode *vinode; struct inode *vinode;
struct bch2_opts_parse *opts_parse = fc->fs_private; struct bch2_opts_parse *opts_parse = fc->fs_private;
struct bch_opts opts = opts_parse->opts; struct bch_opts opts = opts_parse->opts;
darray_str devs; darray_const_str devs;
darray_fs devs_to_fs = {}; darray_fs devs_to_fs = {};
int ret; int ret;
@ -2487,7 +2487,7 @@ static int bch2_fs_get_tree(struct fs_context *fc)
if (!IS_ERR(sb)) if (!IS_ERR(sb))
goto got_sb; goto got_sb;
c = bch2_fs_open(devs.data, devs.nr, opts); c = bch2_fs_open(&devs, &opts);
ret = PTR_ERR_OR_ZERO(c); ret = PTR_ERR_OR_ZERO(c);
if (ret) if (ret)
goto err; goto err;

View File

@ -3022,7 +3022,7 @@ long bch2_ioctl_fsck_offline(struct bch_ioctl_fsck_offline __user *user_arg)
{ {
struct bch_ioctl_fsck_offline arg; struct bch_ioctl_fsck_offline arg;
struct fsck_thread *thr = NULL; struct fsck_thread *thr = NULL;
darray_str(devs) = {}; darray_const_str devs = {};
long ret = 0; long ret = 0;
if (copy_from_user(&arg, user_arg, sizeof(arg))) if (copy_from_user(&arg, user_arg, sizeof(arg)))
@ -3080,7 +3080,7 @@ long bch2_ioctl_fsck_offline(struct bch_ioctl_fsck_offline __user *user_arg)
bch2_thread_with_stdio_init(&thr->thr, &bch2_offline_fsck_ops); bch2_thread_with_stdio_init(&thr->thr, &bch2_offline_fsck_ops);
thr->c = bch2_fs_open(devs.data, arg.nr_devs, thr->opts); thr->c = bch2_fs_open(&devs, &thr->opts);
if (!IS_ERR(thr->c) && if (!IS_ERR(thr->c) &&
thr->c->opts.errors == BCH_ON_ERROR_panic) thr->c->opts.errors == BCH_ON_ERROR_panic)

View File

@ -803,7 +803,7 @@ static int bch2_fs_init_rw(struct bch_fs *c)
return 0; return 0;
} }
static struct bch_fs *bch2_fs_alloc(struct bch_sb *sb, struct bch_opts opts, static struct bch_fs *bch2_fs_alloc(struct bch_sb *sb, struct bch_opts *opts,
bch_sb_handles *sbs) bch_sb_handles *sbs)
{ {
struct bch_fs *c; struct bch_fs *c;
@ -817,7 +817,7 @@ static struct bch_fs *bch2_fs_alloc(struct bch_sb *sb, struct bch_opts opts,
goto out; goto out;
} }
c->stdio = (void *)(unsigned long) opts.stdio; c->stdio = (void *)(unsigned long) opts->stdio;
__module_get(THIS_MODULE); __module_get(THIS_MODULE);
@ -917,7 +917,7 @@ static struct bch_fs *bch2_fs_alloc(struct bch_sb *sb, struct bch_opts opts,
if (ret) if (ret)
goto err; goto err;
bch2_opts_apply(&c->opts, opts); bch2_opts_apply(&c->opts, *opts);
c->btree_key_cache_btrees |= 1U << BTREE_ID_alloc; c->btree_key_cache_btrees |= 1U << BTREE_ID_alloc;
if (c->opts.inodes_use_key_cache) if (c->opts.inodes_use_key_cache)
@ -2273,8 +2273,8 @@ static inline int sb_cmp(struct bch_sb *l, struct bch_sb *r)
cmp_int(le64_to_cpu(l->write_time), le64_to_cpu(r->write_time)); cmp_int(le64_to_cpu(l->write_time), le64_to_cpu(r->write_time));
} }
struct bch_fs *bch2_fs_open(char * const *devices, unsigned nr_devices, struct bch_fs *bch2_fs_open(darray_const_str *devices,
struct bch_opts opts) struct bch_opts *opts)
{ {
bch_sb_handles sbs = {}; bch_sb_handles sbs = {};
struct bch_fs *c = NULL; struct bch_fs *c = NULL;
@ -2285,26 +2285,26 @@ struct bch_fs *bch2_fs_open(char * const *devices, unsigned nr_devices,
if (!try_module_get(THIS_MODULE)) if (!try_module_get(THIS_MODULE))
return ERR_PTR(-ENODEV); return ERR_PTR(-ENODEV);
if (!nr_devices) { if (!devices->nr) {
ret = -EINVAL; ret = -EINVAL;
goto err; goto err;
} }
ret = darray_make_room(&sbs, nr_devices); ret = darray_make_room(&sbs, devices->nr);
if (ret) if (ret)
goto err; goto err;
for (unsigned i = 0; i < nr_devices; i++) { darray_for_each(*devices, i) {
struct bch_sb_handle sb = { NULL }; struct bch_sb_handle sb = { NULL };
ret = bch2_read_super(devices[i], &opts, &sb); ret = bch2_read_super(*i, opts, &sb);
if (ret) if (ret)
goto err; goto err;
BUG_ON(darray_push(&sbs, sb)); BUG_ON(darray_push(&sbs, sb));
} }
if (opts.nochanges && !opts.read_only) { if (opts->nochanges && !opts->read_only) {
ret = -BCH_ERR_erofs_nochanges; ret = -BCH_ERR_erofs_nochanges;
goto err_print; goto err_print;
} }
@ -2314,7 +2314,7 @@ struct bch_fs *bch2_fs_open(char * const *devices, unsigned nr_devices,
best = sb; best = sb;
darray_for_each_reverse(sbs, sb) { darray_for_each_reverse(sbs, sb) {
ret = bch2_dev_in_fs(best, sb, &opts); ret = bch2_dev_in_fs(best, sb, opts);
if (ret == -BCH_ERR_device_has_been_removed || if (ret == -BCH_ERR_device_has_been_removed ||
ret == -BCH_ERR_device_splitbrain) { ret == -BCH_ERR_device_splitbrain) {
@ -2358,7 +2358,7 @@ out:
return c; return c;
err_print: err_print:
pr_err("bch_fs_open err opening %s: %s", pr_err("bch_fs_open err opening %s: %s",
devices[0], bch2_err_str(ret)); devices->data[0], bch2_err_str(ret));
err: err:
if (!IS_ERR_OR_NULL(c)) if (!IS_ERR_OR_NULL(c))
bch2_fs_stop(c); bch2_fs_stop(c);

View File

@ -43,7 +43,7 @@ void bch2_fs_free(struct bch_fs *);
void bch2_fs_stop(struct bch_fs *); void bch2_fs_stop(struct bch_fs *);
int bch2_fs_start(struct bch_fs *); int bch2_fs_start(struct bch_fs *);
struct bch_fs *bch2_fs_open(char * const *, unsigned, struct bch_opts); struct bch_fs *bch2_fs_open(darray_const_str *, struct bch_opts *);
extern const struct blk_holder_ops bch2_sb_handle_bdev_ops; extern const struct blk_holder_ops bch2_sb_handle_bdev_ops;

View File

@ -1016,14 +1016,14 @@ u64 *bch2_acc_percpu_u64s(u64 __percpu *p, unsigned nr)
return ret; return ret;
} }
void bch2_darray_str_exit(darray_str *d) void bch2_darray_str_exit(darray_const_str *d)
{ {
darray_for_each(*d, i) darray_for_each(*d, i)
kfree(*i); kfree(*i);
darray_exit(d); darray_exit(d);
} }
int bch2_split_devs(const char *_dev_name, darray_str *ret) int bch2_split_devs(const char *_dev_name, darray_const_str *ret)
{ {
darray_init(ret); darray_init(ret);

View File

@ -690,8 +690,8 @@ static inline bool qstr_eq(const struct qstr l, const struct qstr r)
return l.len == r.len && !memcmp(l.name, r.name, l.len); return l.len == r.len && !memcmp(l.name, r.name, l.len);
} }
void bch2_darray_str_exit(darray_str *); void bch2_darray_str_exit(darray_const_str *);
int bch2_split_devs(const char *, darray_str *); int bch2_split_devs(const char *, darray_const_str *);
#ifdef __KERNEL__ #ifdef __KERNEL__