From: Kevin Wolf <kwolf@redhat.com>
To: Changlong Xie <xiecl.fnst@cn.fujitsu.com>
Cc: Eric Blake <eblake@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
qemu devel <qemu-devel@nongnu.org>, Jeff Cody <jcody@redhat.com>,
Fam Zheng <famz@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
Max Reitz <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 1/2] blockjob: assert(cb) in the entry functions of blockjob
Date: Thu, 23 Jun 2016 08:21:46 +0200 [thread overview]
Message-ID: <20160623062146.GA4848@noname.redhat.com> (raw)
In-Reply-To: <576B3588.1070806@cn.fujitsu.com>
Am 23.06.2016 um 03:04 hat Changlong Xie geschrieben:
> On 06/23/2016 01:31 AM, Eric Blake wrote:
> >On 06/22/2016 04:19 AM, Paolo Bonzini wrote:
> >>
> >>
> >>On 22/06/2016 12:12, Changlong Xie wrote:
> >>>
> >>>commit/mirror/stream/backup use block_job_create(..., cb,..) to create
> >>>relevant blockjob. When they finished, these jobs will invoke
> >>>block_job_completed, then invoke job->cb() unconditionally. So i think
> >>>we need this to avoid segment fault. Actually backup has implemented this.
> >>
> >>So this suggests that the right place to put the assertion would be
> >>block_job_create. But it's even better to add a
> >>
> >>#define QEMU_NONNULL __attribute__((__nonnull__))
> >>
> >>to include/qemu/compiler.h and declare the arguments as non-null.
> >
> >Or alternatively fix things to only invoke job->cb() if it is non-NULL,
> >so that callers don't have to pass in a no-op callback just to appease a
> >non-NULL attribute.
>
> Is there any reason, that we should invoke job->cb() unconditionally
> without nonnull check? There is no relevant clue in the historical
> commit messages. If yes, i prefer paolo's suggestion; otherwise
> eric's solution is better.
I don't think no-op callbacks actually exist for jobs.
Kevin
next prev parent reply other threads:[~2016-06-23 6:21 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-22 9:16 [Qemu-devel] [PATCH 0/2] small fix of block job Changlong Xie
2016-06-22 9:16 ` [Qemu-devel] [PATCH 1/2] blockjob: assert(cb) in the entry functions of blockjob Changlong Xie
2016-06-22 9:50 ` Paolo Bonzini
2016-06-22 10:12 ` Changlong Xie
2016-06-22 10:19 ` Paolo Bonzini
2016-06-22 17:31 ` Eric Blake
2016-06-23 1:04 ` Changlong Xie
2016-06-23 6:21 ` Kevin Wolf [this message]
2016-06-23 6:57 ` Changlong Xie
2016-06-22 9:16 ` [Qemu-devel] [PATCH 2/2] mirror: fix misleading comments Changlong Xie
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=20160623062146.GA4848@noname.redhat.com \
--to=kwolf@redhat.com \
--cc=eblake@redhat.com \
--cc=famz@redhat.com \
--cc=jcody@redhat.com \
--cc=mreitz@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=xiecl.fnst@cn.fujitsu.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).