Am 25.06.2018 um 10:56 hat Stefan Hajnoczi geschrieben:
> 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?At the end of aio_worker(). This is why I even need to malloc it here. Once my other patch is in that removes the callback-based paio_submit(), we could allocate the acb on the stack for all callers instead. Kevin
signature.asc
Description: PGP signature
