[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH 2/2] file-posix: Make .bdrv_co_truncate asynchro
From: |
Max Reitz |
Subject: |
Re: [Qemu-block] [PATCH 2/2] file-posix: Make .bdrv_co_truncate asynchronous |
Date: |
Mon, 25 Jun 2018 16:24:49 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 |
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 <address@hidden>
> ---
> 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 <address@hidden>
> } RawPosixAIOData;
>
> #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
signature.asc
Description: OpenPGP digital signature