struct bch_inode_unpacked inode;
int ret = bch2_trans_do(c, NULL, NULL, 0,
- bch2_link_trans(&trans, parent->bi_inum, inum,
- &parent_u, &inode, &qstr));
+ bch2_link_trans(&trans,
+ (subvol_inum) { 1, parent->bi_inum }, &parent_u,
+ (subvol_inum) { 1, inum }, &inode, &qstr));
if (ret)
die("error creating hardlink: %s", strerror(-ret));
}
int ret = bch2_trans_do(c, NULL, NULL, 0,
bch2_create_trans(&trans,
- parent->bi_inum, parent,
+ (subvol_inum) { 1, parent->bi_inum }, parent,
&new_inode, &qstr,
- uid, gid, mode, rdev, NULL, NULL));
+ uid, gid, mode, rdev, NULL, NULL,
+ (subvol_inum) {}, 0));
if (ret)
die("error creating file: %s", strerror(-ret));
const struct xattr_handler *h = xattr_resolve_name(&attr);
int ret = bch2_trans_do(c, NULL, NULL, 0,
- bch2_xattr_set(&trans, dst->bi_inum, &hash_info, attr,
+ bch2_xattr_set(&trans,
+ (subvol_inum) { 1, dst->bi_inum },
+ &hash_info, attr,
val, val_size, h->flags, 0));
if (ret < 0)
die("error creating xattr: %s", strerror(-ret));
syncfs(src_fd);
struct bch_inode_unpacked root_inode;
- int ret = bch2_inode_find_by_inum(c, BCACHEFS_ROOT_INO, &root_inode);
+ int ret = bch2_inode_find_by_inum(c, (subvol_inum) { 1, BCACHEFS_ROOT_INO },
+ &root_inode);
if (ret)
die("error looking up root directory: %s", strerror(-ret));
bch2_alloc_write(c, false);
}
-static void find_superblock_space(ranges extents, struct dev_opts *dev)
+static void find_superblock_space(ranges extents,
+ struct format_opts opts,
+ struct dev_opts *dev)
{
struct range *i;
u64 end = round_down(i->end,
dev->bucket_size << 9);
- if (start + (128 << 10) <= end) {
+ /* Need space for two superblocks: */
+ if (start + (opts.superblock_size << 9) * 2 <= end) {
dev->sb_offset = start >> 9;
- dev->sb_end = dev->sb_offset + 256;
+ dev->sb_end = dev->sb_offset + opts.superblock_size * 2;
return;
}
}
get_size(dev.path, dev.fd) / 5,
&bcachefs_inum, stat.st_dev, force);
- find_superblock_space(extents, &dev);
+ find_superblock_space(extents, format_opts, &dev);
struct bch_sb *sb = bch2_format(fs_opt_strs,
fs_opts,format_opts, &dev, 1);
if (format_opts.encrypted && !no_passphrase)
format_opts.passphrase = read_passphrase_twice("Enter passphrase: ");
- return migrate_fs(fs_path,
- fs_opt_strs,
- fs_opts,
- format_opts, force);
+ int ret = migrate_fs(fs_path,
+ fs_opt_strs,
+ fs_opts,
+ format_opts, force);
+ bch2_opt_strs_free(&fs_opt_strs);
+ return ret;
}
static void migrate_superblock_usage(void)