return BTRFS_FT_UNKNOWN;
}
-struct reiserfs_convert_info {
- bool copy_attrs;
- struct reiserfs_key privroot_key;
- struct reiserfs_key xattr_key;
-
- /* only set during copy_inodes */
- struct task_ctx *progress;
-
- /* used to track hardlinks */
- unsigned used_slots;
- unsigned alloced_slots;
- u64 *objectids;
-};
-
static u32 reiserfs_count_objectids(reiserfs_filsys_t fs)
{
struct reiserfs_super_block *sb = fs->fs_ondisk_sb;
btrfs_set_stack_inode_rdev(inode, rdev);
}
-struct reiserfs_blk_iterate_data {
- struct blk_iterate_data blk_data;
- char *inline_data;
- u64 inline_offset;
- u32 inline_length;
-};
-
static void init_reiserfs_blk_iterate_data(
struct reiserfs_blk_iterate_data *data,
struct btrfs_trans_handle *trans,
u64 isize;
int ret;
- if (length >= BTRFS_MAX_INLINE_DATA_SIZE(root))
+ if (length >= BTRFS_MAX_INLINE_DATA_SIZE(root->fs_info) ||
+ length >= root->fs_info->sectorsize)
return convert_direct(trans, root, objectid, inode, body,
length, offset, convert_flags);
return ret;
}
-#define OID_OFFSET (BTRFS_FIRST_FREE_OBJECTID - REISERFS_ROOT_OBJECTID)
static int reiserfs_copy_meta(reiserfs_filsys_t fs, struct btrfs_root *root,
u32 convert_flags, u32 deh_dirid,
u32 deh_objectid, u8 *type);
-struct reiserfs_dirent_data {
- u64 index;
- u32 convert_flags;
- struct btrfs_inode_item *inode;
- struct btrfs_root *root;
-};
-
static int reiserfs_copy_dirent(reiserfs_filsys_t fs,
const struct reiserfs_key *dir_short_key,
const char *name, size_t len,
return ret;
}
trans = btrfs_start_transaction(root, 1);
- if (!trans)
- return -ENOMEM;
+ if (IS_ERR(trans))
+ return PTR_ERR(trans);
ret = convert_insert_dirent(trans, root, name, len, dir_objectid,
objectid, type, dirent_data->index++,
switch (mode & S_IFMT) {
case S_IFREG:
trans = btrfs_start_transaction(root, 1);
- if (!trans) {
- ret = -ENOMEM;
+ if (IS_ERR(trans)) {
+ ret = PTR_ERR(trans);
goto fail;
}
ret = reiserfs_record_file_extents(fs, trans, root, objectid,
if (ret)
goto fail;
trans = btrfs_start_transaction(root, 1);
- if (!trans) {
- ret = -ENOMEM;
+ if (IS_ERR(trans)) {
+ ret = PTR_ERR(trans);
goto fail;
}
break;
case S_IFLNK:
trans = btrfs_start_transaction(root, 1);
- if (!trans) {
- ret = -ENOMEM;
+ if (IS_ERR(trans)) {
+ ret = PTR_ERR(trans);
goto fail;
}
ret = reiserfs_copy_symlink(trans, root, objectid,
break;
default:
trans = btrfs_start_transaction(root, 1);
- if (!trans) {
- ret = -ENOMEM;
+ if (IS_ERR(trans)) {
+ ret = PTR_ERR(trans);
goto fail;
}
}
return ret;
}
-struct reiserfs_xattr_data {
- struct btrfs_root *root;
- struct btrfs_trans_handle *trans;
- u64 target_oid;
- const char *name;
- size_t namelen;
- void *body;
- size_t len;
-};
-
static int reiserfs_xattr_indirect_fn(reiserfs_filsys_t fs, u64 position,
u64 size, int num_blocks,
u32 *blocks, void *data)
size_t alloc = min(position + num_blocks * fs->fs_blocksize, size);
char *body;
- if (size > BTRFS_LEAF_DATA_SIZE(xa_data->root) -
+ if (size > BTRFS_LEAF_DATA_SIZE(xa_data->root->fs_info) -
sizeof(struct btrfs_item) - sizeof(struct btrfs_dir_item)) {
fprintf(stderr, "skip large xattr on objectid %llu name %.*s\n",
xa_data->target_oid, (int)xa_data->namelen,
struct reiserfs_xattr_data *xa_data = data;
char *newbody;
- if (size > BTRFS_LEAF_DATA_SIZE(xa_data->root) -
+ if (size > BTRFS_LEAF_DATA_SIZE(xa_data->root->fs_info) -
sizeof(struct btrfs_item) - sizeof(struct btrfs_dir_item)) {
fprintf(stderr, "skip large xattr on objectid %llu name %.*s\n",
xa_data->target_oid, (int)xa_data->namelen,
xa_data->target_oid += OID_OFFSET;
xa_data->trans = btrfs_start_transaction(xa_data->root, 1);
- if (!xa_data->trans)
- return -ENOMEM;
+ if (IS_ERR(xa_data->trans))
+ return PTR_ERR(xa_data->trans);
ret = reiserfs_iterate_dir(fs, &dir_key,
reiserfs_copy_one_xattr, xa_data);