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
pgpaVH8dkk8cF.pgp
Description: PGP signature