summaryrefslogtreecommitdiff
path: root/convert
diff options
context:
space:
mode:
authorDimitri John Ledkov <xnox@ubuntu.com>2018-05-08 14:17:29 -0700
committerDimitri John Ledkov <xnox@ubuntu.com>2018-05-08 14:17:29 -0700
commitd00c9550da1801a0eaff5cedf4312e24691b31ea (patch)
tree3881ca1764ef792259e1b70f12c884a3ac0c0715 /convert
parentdab6d2181f1f194ec3a76d900cf2c6533379cbea (diff)
New upstream release.
Diffstat (limited to 'convert')
-rw-r--r--convert/common.c4
-rw-r--r--convert/main.c6
-rw-r--r--convert/source-ext2.c5
-rw-r--r--convert/source-reiserfs.c6
4 files changed, 10 insertions, 11 deletions
diff --git a/convert/common.c b/convert/common.c
index 3860f3b9..6ddf4a46 100644
--- a/convert/common.c
+++ b/convert/common.c
@@ -116,7 +116,7 @@ static int setup_temp_super(int fd, struct btrfs_mkfs_config *cfg,
btrfs_set_super_bytenr(super, cfg->super_bytenr);
btrfs_set_super_num_devices(super, 1);
- btrfs_set_super_magic(super, BTRFS_MAGIC_PARTIAL);
+ btrfs_set_super_magic(super, BTRFS_MAGIC_TEMPORARY);
btrfs_set_super_generation(super, 1);
btrfs_set_super_root(super, root_bytenr);
btrfs_set_super_chunk_root(super, chunk_bytenr);
@@ -219,7 +219,7 @@ static inline int write_temp_extent_buffer(int fd, struct extent_buffer *buf,
{
int ret;
- csum_tree_block_size(buf, BTRFS_CRC32_SIZE, 0);
+ csum_tree_block_size(buf, btrfs_csum_sizes[BTRFS_CSUM_TYPE_CRC32], 0);
/* Temporary extent buffer is always mapped 1:1 on disk */
ret = pwrite(fd, buf->data, buf->len, bytenr);
diff --git a/convert/main.c b/convert/main.c
index b3ea31d7..80f3bed8 100644
--- a/convert/main.c
+++ b/convert/main.c
@@ -1026,7 +1026,7 @@ static int migrate_super_block(int fd, u64 old_bytenr)
BUG_ON(btrfs_super_bytenr(super) != old_bytenr);
btrfs_set_super_bytenr(super, BTRFS_SUPER_INFO_OFFSET);
- csum_tree_block_size(buf, BTRFS_CRC32_SIZE, 0);
+ csum_tree_block_size(buf, btrfs_csum_sizes[BTRFS_CSUM_TYPE_CRC32], 0);
ret = pwrite(fd, buf->data, BTRFS_SUPER_INFO_SIZE,
BTRFS_SUPER_INFO_OFFSET);
if (ret != BTRFS_SUPER_INFO_SIZE)
@@ -1140,7 +1140,7 @@ static int do_convert(const char *devname, u32 convert_flags, u32 nodesize,
}
root = open_ctree_fd(fd, devname, mkfs_cfg.super_bytenr,
- OPEN_CTREE_WRITES | OPEN_CTREE_FS_PARTIAL);
+ OPEN_CTREE_WRITES | OPEN_CTREE_TEMPORARY_SUPER);
if (!root) {
error("unable to open ctree");
goto fail;
@@ -1230,7 +1230,7 @@ static int do_convert(const char *devname, u32 convert_flags, u32 nodesize,
}
root = open_ctree_fd(fd, devname, 0,
- OPEN_CTREE_WRITES | OPEN_CTREE_FS_PARTIAL);
+ OPEN_CTREE_WRITES | OPEN_CTREE_TEMPORARY_SUPER);
if (!root) {
error("unable to open ctree for finalization");
goto fail;
diff --git a/convert/source-ext2.c b/convert/source-ext2.c
index b1492c78..a2af1212 100644
--- a/convert/source-ext2.c
+++ b/convert/source-ext2.c
@@ -310,7 +310,7 @@ static int ext2_create_file_extents(struct btrfs_trans_handle *trans,
if (ret)
goto fail;
if ((convert_flags & CONVERT_FLAG_INLINE_DATA) && data.first_block == 0
- && data.num_blocks > 0
+ && data.num_blocks > 0 && inode_size < sectorsize
&& inode_size <= BTRFS_MAX_INLINE_DATA_SIZE(root->fs_info)) {
u64 num_bytes = data.num_blocks * sectorsize;
u64 disk_bytenr = data.disk_block * sectorsize;
@@ -422,8 +422,7 @@ static int ext2_xattr_check_entry(struct ext2_ext_attr_entry *entry,
{
size_t value_size = entry->e_value_size;
- if (entry->e_value_block != 0 || value_size > size ||
- entry->e_value_offs + value_size > size)
+ if (value_size > size || entry->e_value_offs + value_size > size)
return -EIO;
return 0;
}
diff --git a/convert/source-reiserfs.c b/convert/source-reiserfs.c
index 39d6f072..e0b3b685 100644
--- a/convert/source-reiserfs.c
+++ b/convert/source-reiserfs.c
@@ -350,8 +350,7 @@ static int convert_direct(struct btrfs_trans_handle *trans,
if (ret)
return ret;
- eb = alloc_extent_buffer(&root->fs_info->extent_cache, key.objectid,
- sectorsize);
+ eb = alloc_extent_buffer(root->fs_info, key.objectid, sectorsize);
if (!eb)
return -ENOMEM;
@@ -376,7 +375,8 @@ static int reiserfs_convert_tail(struct btrfs_trans_handle *trans,
u64 isize;
int ret;
- if (length >= BTRFS_MAX_INLINE_DATA_SIZE(root->fs_info))
+ 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);