On 2018-06-21 19:06, Kevin Wolf wrote: > This moves the code to resize an image file to the thread pool to avoid > blocking. > > Creating large images with preallocation with blockdev-create is now > actually a background job instead of blocking the monitor (and most > other things) until the preallocation has completed. > > Signed-off-by: Kevin Wolf <[email protected]> > --- > include/block/raw-aio.h | 4 +- > block/file-posix.c | 265 > +++++++++++++++++++++++++++--------------------- > 2 files changed, 153 insertions(+), 116 deletions(-)
[...]
> diff --git a/block/file-posix.c b/block/file-posix.c
> index 6223a8bccc..fa918f2bdb 100644
> --- a/block/file-posix.c
> +++ b/block/file-posix.c
> @@ -188,8 +188,16 @@ typedef struct RawPosixAIOData {
> #define aio_ioctl_cmd aio_nbytes /* for QEMU_AIO_IOCTL */
> off_t aio_offset;
> int aio_type;
> - int aio_fd2;
> - off_t aio_offset2;
> + union {
> + struct {
> + int aio_fd2;
> + off_t aio_offset2;
> + };
> + struct {
> + PreallocMode prealloc;
> + Error **errp;
> + };
> + };
Comments might help (that the first struct is for *_COPY_RANGE and the
second one is for *_TRUNCATE).
But in general (without having actual knowledge of file-posix's AIO pool):
Reviewed-by: Max Reitz <[email protected]>
> } RawPosixAIOData;
>
> #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
signature.asc
Description: OpenPGP digital signature
