qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC 5/9] block: add block job transactions


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [RFC 5/9] block: add block job transactions
Date: Thu, 25 Jun 2015 13:50:01 +0100
User-agent: Mutt/1.5.23 (2014-03-12)

On Wed, Jun 24, 2015 at 08:37:43PM +0200, Max Reitz wrote:
> On 12.06.2015 12:09, Stefan Hajnoczi wrote:
> >+void block_job_txn_add_job(BlockJobTxn *txn, BlockJob *job)
> >+{
> >+    if (!txn) {
> >+        return;
> >+    }
> 
> Do you plan on making use of this case? I'm asking because while I'm usually
> in favor of handling everything gracefully as long as it's easy to
> implement, here I can't think of a case where using NULL with this function
> makes sense, that is to me it would seem like the caller made some bad
> mistake. This in turn would mean that dereferencing a NULL pointer or
> failing an assertion were preferable to hiding that mistake.
> 
> Other than this small thing and that it doesn't compile (until patch 7, I
> presume), looks good.

Yes.  It is used by backup_start(), which may be called with txn == NULL
by do_drive_backup() from qmp_drive_backup().

It means that blockjob code never needs to check whether it is running
inside a transaction or not.  Blockjob code always calls add_job() and
prepare_to_complete() regardless.

Stefan

Attachment: pgpEDBj3UlJv3.pgp
Description: PGP signature


reply via email to

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