qemu-block
[Top][All Lists]
Advanced

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

Re: [Qemu-block] [PATCH 31/42] job: Move transactions to Job


From: Max Reitz
Subject: Re: [Qemu-block] [PATCH 31/42] job: Move transactions to Job
Date: Mon, 14 May 2018 22:28:50 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0

On 2018-05-09 18:26, Kevin Wolf wrote:
> This moves the logic that implements job transactions from BlockJob to
> Job.
> 
> Signed-off-by: Kevin Wolf <address@hidden>
> ---
>  include/block/blockjob.h     |  54 ----------
>  include/block/blockjob_int.h |  10 --
>  include/qemu/job.h           |  71 +++++++++++--
>  blockdev.c                   |   6 +-
>  blockjob.c                   | 238 
> +------------------------------------------
>  job.c                        | 235 ++++++++++++++++++++++++++++++++++++++++--
>  tests/test-blockjob-txn.c    |  12 +--
>  tests/test-blockjob.c        |   2 +-
>  8 files changed, 304 insertions(+), 324 deletions(-)

[...]

> diff --git a/include/qemu/job.h b/include/qemu/job.h
> index 614a2dea92..84a9eb7980 100644
> --- a/include/qemu/job.h
> +++ b/include/qemu/job.h

[...]

> @@ -227,20 +242,52 @@ typedef enum JobCreateFlags {

[...]

> +/**
> + * @txn: The transaction (may be NULL)
> + * @job: Job to add to the transaction
> + *
> + * Add @job to the transaction.  The @job must not already be in a 
> transaction.
> + * The caller must call either block_job_txn_unref() or block_job_completed()

*job_txn_unref()

(and maybe even job_completed() in preparation for the next patches)

> + * to release the reference that is automatically grabbed here.
> + *
> + * If @txn is NULL, the function does nothing.
> + */
> +void job_txn_add_job(JobTxn *txn, Job *job);

[...]

> diff --git a/job.c b/job.c
> index 49dce57c9e..2d782859ac 100644
> --- a/job.c
> +++ b/job.c

[...]

> @@ -80,6 +93,71 @@ static void __attribute__((__constructor__)) job_init(void)

[...]

> +static int job_txn_apply(JobTxn *txn, int fn(Job *), bool lock)

(“6.7.6.3. (8) A declaration of a parameter as ‘function returning type’
shall be adjusted to ‘pointer to function returning type’, as in 6.3.2.1.”

Interesting.  Didn't know that worked.)

[...]

> @@ -542,12 +632,141 @@ int job_finalize_single(Job *job)

[...]

> +static int job_prepare(Job *job)
> +{
> +    if (job->ret == 0 && job->driver->prepare) {
> +        job->ret = job->driver->prepare(job);
> +    }
> +    return job->ret;
> +}

I'd have put this above job_commit() and the like, but it's not like it
matters functionally...

Well, you know me.  With the comment fixed:

Reviewed-by: Max Reitz <address@hidden>

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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