cmd_migrate: don't link data above i_size

The new filesystem might have a smaller blocksize than the old
blocksize, which trips this.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2023-12-19 20:35:20 -05:00
parent f06fd08067
commit 4158833a51

View File

@ -378,6 +378,10 @@ static void copy_file(struct bch_fs *c, struct bch_inode_unpacked *dst,
fiemap_iter_exit(&iter);
fiemap_for_each(src_fd, iter, e) {
u64 src_max = roundup(src_size, block_bytes(c));
e.fe_length = min(e.fe_length, src_max - e.fe_logical);
if ((e.fe_logical & (block_bytes(c) - 1)) ||
(e.fe_length & (block_bytes(c) - 1)))
die("Unaligned extent in %s - can't handle", src_path);