From: Kevin Wolf <kwolf@redhat.com>
To: Stefan Hajnoczi <stefanha@gmail.com>
Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org, mreitz@redhat.com
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH 2/2] file-posix: Make .bdrv_co_truncate asynchronous
Date: Mon, 25 Jun 2018 11:18:57 +0200 [thread overview]
Message-ID: <20180625091857.GC5024@localhost.localdomain> (raw)
In-Reply-To: <20180625085631.GA29002@stefanha-x1.localdomain>
[-- Attachment #1: Type: text/plain, Size: 1270 bytes --]
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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
next prev parent reply other threads:[~2018-06-25 9:19 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-21 17:06 [Qemu-devel] [PATCH 0/2] file-posix: Make truncate/preallocate asynchronous Kevin Wolf
2018-06-21 17:06 ` [Qemu-devel] [PATCH 1/2] block: Convert .bdrv_truncate callback to coroutine_fn Kevin Wolf
2018-06-25 9:02 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2018-06-25 9:51 ` Kevin Wolf
2018-06-25 14:15 ` Max Reitz
2018-06-21 17:06 ` [Qemu-devel] [PATCH 2/2] file-posix: Make .bdrv_co_truncate asynchronous Kevin Wolf
2018-06-25 8:56 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2018-06-25 9:18 ` Kevin Wolf [this message]
2018-06-25 14:24 ` [Qemu-devel] " Max Reitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180625091857.GC5024@localhost.localdomain \
--to=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).