qemu-block
[Top][All Lists]
Advanced

[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: Stefan Hajnoczi
Subject: Re: [Qemu-block] [PATCH 2/2] file-posix: Make .bdrv_co_truncate asynchronous
Date: Mon, 25 Jun 2018 09:56:31 +0100
User-agent: Mutt/1.10.0 (2018-05-17)

On Thu, Jun 21, 2018 at 07:06:57PM +0200, Kevin Wolf wrote:
> +    RawPosixAIOData *acb = g_new(RawPosixAIOData, 1);
> +    ThreadPool *pool;
>  
> -out:
> -    if (result < 0) {
> -        if (ftruncate(fd, current_length) < 0) {
> -            error_report("Failed to restore old file length: %s",
> -                         strerror(errno));
> -        }
> -    }
> +    *acb = (RawPosixAIOData) {
> +        .bs             = bs,
> +        .aio_fildes     = fd,
> +        .aio_type       = QEMU_AIO_TRUNCATE,
> +        .aio_offset     = offset,
> +        .prealloc       = prealloc,
> +        .errp           = errp,
> +    };
>  
> -    g_free(buf);
> -    return result;
> +    /* @bs can be NULL, bdrv_get_aio_context() returns the main context then 
> */
> +    pool = aio_get_thread_pool(bdrv_get_aio_context(bs));
> +    return thread_pool_submit_co(pool, aio_worker, acb);

Where is acb freed?

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]