diff mbox series

[v8,07/20] job.h: add _locked public functions

Message ID 20220629141538.3400679-8-eesposit@redhat.com
State New
Headers show
Series job: replace AioContext lock with job_mutex | expand

Commit Message

Emanuele Giuseppe Esposito June 29, 2022, 2:15 p.m. UTC
These functions will be used later when we use the job lock.

Note: at this stage, job_{lock/unlock} and job lock guard macros
are *nop*.

Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
 include/qemu/job.h | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

Comments

Stefan Hajnoczi July 5, 2022, 7:44 a.m. UTC | #1
On Wed, Jun 29, 2022 at 10:15:25AM -0400, Emanuele Giuseppe Esposito wrote:
> These functions will be used later when we use the job lock.
> 
> Note: at this stage, job_{lock/unlock} and job lock guard macros
> are *nop*.
> 
> Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
> ---
>  include/qemu/job.h | 15 ++++++++++++---
>  1 file changed, 12 insertions(+), 3 deletions(-)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Vladimir Sementsov-Ogievskiy July 5, 2022, 10:58 a.m. UTC | #2
First, to subject: no function is added in this commit

Second, to my comment on previous patch: so, you decided to add "not held" comment to all functions, even that have public _locked() counterpart.
Not sure we really need it, but it's OK. Anyway, let's just add all these comments together with the functions themselves in patch 05.


On 6/29/22 17:15, Emanuele Giuseppe Esposito wrote:
> These functions will be used later when we use the job lock.
> 
> Note: at this stage, job_{lock/unlock} and job lock guard macros
> are *nop*.
> 
> Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
> ---
>   include/qemu/job.h | 15 ++++++++++++---
>   1 file changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/include/qemu/job.h b/include/qemu/job.h
> index b714236c1a..e887f88cb2 100644
> --- a/include/qemu/job.h
> +++ b/include/qemu/job.h
> @@ -505,7 +505,10 @@ const char *job_type_str(const Job *job);
>   /** Returns true if the job should not be visible to the management layer. */
>   bool job_is_internal(Job *job);
>   
> -/** Returns whether the job is being cancelled. */
> +/**
> + * Returns whether the job is being cancelled.
> + * Called with job_mutex *not* held.
> + */
>   bool job_is_cancelled(Job *job);
>   
>   /* Same as job_is_cancelled(), but called with job lock held. */
> @@ -518,13 +521,19 @@ bool job_is_cancelled_locked(Job *job);
>    */
>   bool job_cancel_requested(Job *job);
>   
> -/** Returns whether the job is in a completed state. */
> +/**
> + * Returns whether the job is in a completed state.
> + * Called with job_mutex *not* held.
> + */
>   bool job_is_completed(Job *job);
>   
>   /* Same as job_is_completed(), but called with job lock held. */
>   bool job_is_completed_locked(Job *job);
>   
> -/** Returns whether the job is ready to be completed. */
> +/**
> + * Returns whether the job is ready to be completed.
> + * Called with job_mutex *not* held.
> + */
>   bool job_is_ready(Job *job);
>   
>   /* Same as job_is_ready(), but called with job lock held. */
diff mbox series

Patch

diff --git a/include/qemu/job.h b/include/qemu/job.h
index b714236c1a..e887f88cb2 100644
--- a/include/qemu/job.h
+++ b/include/qemu/job.h
@@ -505,7 +505,10 @@  const char *job_type_str(const Job *job);
 /** Returns true if the job should not be visible to the management layer. */
 bool job_is_internal(Job *job);
 
-/** Returns whether the job is being cancelled. */
+/**
+ * Returns whether the job is being cancelled.
+ * Called with job_mutex *not* held.
+ */
 bool job_is_cancelled(Job *job);
 
 /* Same as job_is_cancelled(), but called with job lock held. */
@@ -518,13 +521,19 @@  bool job_is_cancelled_locked(Job *job);
  */
 bool job_cancel_requested(Job *job);
 
-/** Returns whether the job is in a completed state. */
+/**
+ * Returns whether the job is in a completed state.
+ * Called with job_mutex *not* held.
+ */
 bool job_is_completed(Job *job);
 
 /* Same as job_is_completed(), but called with job lock held. */
 bool job_is_completed_locked(Job *job);
 
-/** Returns whether the job is ready to be completed. */
+/**
+ * Returns whether the job is ready to be completed.
+ * Called with job_mutex *not* held.
+ */
 bool job_is_ready(Job *job);
 
 /* Same as job_is_ready(), but called with job lock held. */