btrfs-image is assuming that every metadata block is the same size. The
super is a special snowflake though. It's 4K even on 64K filesystems.
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
}
while (!md->data && size > 0) {
- eb = read_tree_block(md->root, start, blocksize, 0);
+ u64 this_read = min(blocksize, size);
+ eb = read_tree_block(md->root, start, this_read, 0);
if (!eb) {
free(async->buffer);
free(async);
}
copy_buffer(async->buffer + offset, eb);
free_extent_buffer(eb);
- start += blocksize;
- offset += blocksize;
- size -= blocksize;
+ start += this_read;
+ offset += this_read;
+ size -= this_read;
}
md->pending_start = (u64)-1;