diff mbox series

[v6,13/33] include/block/blockjob.h: global state API

Message ID 20220121170544.2049944-14-eesposit@redhat.com (mailing list archive)
State New, archived
Headers show
Series block layer: split block APIs in global state and I/O | expand

Commit Message

Emanuele Giuseppe Esposito Jan. 21, 2022, 5:05 p.m. UTC
blockjob functions run always under the BQL lock.

Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 include/block/blockjob.h | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Kevin Wolf Feb. 7, 2022, 5:26 p.m. UTC | #1
Am 21.01.2022 um 18:05 hat Emanuele Giuseppe Esposito geschrieben:
> blockjob functions run always under the BQL lock.
> 
> Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
>  include/block/blockjob.h | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/include/block/blockjob.h b/include/block/blockjob.h
> index 87fbb3985f..2373dfeb07 100644
> --- a/include/block/blockjob.h
> +++ b/include/block/blockjob.h
> @@ -74,6 +74,13 @@ typedef struct BlockJob {
>      GSList *nodes;
>  } BlockJob;
>  
> +/*
> + * Global state (GS) API. These functions run under the BQL lock.
> + *
> + * See include/block/block-global-state.h for more information about
> + * the GS API.
> + */
> +
>  /**
>   * block_job_next:
>   * @job: A block job, or %NULL.
> @@ -155,6 +162,8 @@ BlockJobInfo *block_job_query(BlockJob *job, Error **errp);
>   */
>  void block_job_iostatus_reset(BlockJob *job);
>  
> +/* Common functions that are neither I/O nor Global State */
> +
>  /**
>   * block_job_is_internal:
>   * @job: The job to determine if it is user-visible or not.

It's a bit random to comment on it for this patch specifically, but I
feel that the comments that separate different categories of interfaces
in a single file are not very easy to visually register.

I don't think we're doing this anywhere yet, but I wonder if it wouldn't
be helpful to use a comment style like this which gives more visibility
to the start and end of sections:

/***********************************************************************
 * Common functions that are neither I/O nor Global State
 */

Not sure what checkpatch thinks about it either... ;-)

Kevin
Emanuele Giuseppe Esposito Feb. 8, 2022, 10:50 a.m. UTC | #2
On 07/02/2022 18:26, Kevin Wolf wrote:
> Am 21.01.2022 um 18:05 hat Emanuele Giuseppe Esposito geschrieben:
>> blockjob functions run always under the BQL lock.
>>
>> Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
>> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
>> ---
>>  include/block/blockjob.h | 9 +++++++++
>>  1 file changed, 9 insertions(+)
>>
>> diff --git a/include/block/blockjob.h b/include/block/blockjob.h
>> index 87fbb3985f..2373dfeb07 100644
>> --- a/include/block/blockjob.h
>> +++ b/include/block/blockjob.h
>> @@ -74,6 +74,13 @@ typedef struct BlockJob {
>>      GSList *nodes;
>>  } BlockJob;
>>  
>> +/*
>> + * Global state (GS) API. These functions run under the BQL lock.
>> + *
>> + * See include/block/block-global-state.h for more information about
>> + * the GS API.
>> + */
>> +
>>  /**
>>   * block_job_next:
>>   * @job: A block job, or %NULL.
>> @@ -155,6 +162,8 @@ BlockJobInfo *block_job_query(BlockJob *job, Error **errp);
>>   */
>>  void block_job_iostatus_reset(BlockJob *job);
>>  
>> +/* Common functions that are neither I/O nor Global State */
>> +
>>  /**
>>   * block_job_is_internal:
>>   * @job: The job to determine if it is user-visible or not.
> 
> It's a bit random to comment on it for this patch specifically, but I
> feel that the comments that separate different categories of interfaces
> in a single file are not very easy to visually register.
> 
> I don't think we're doing this anywhere yet, but I wonder if it wouldn't
> be helpful to use a comment style like this which gives more visibility
> to the start and end of sections:
> 
> /***********************************************************************
>  * Common functions that are neither I/O nor Global State
>  */
> 
> Not sure what checkpatch thinks about it either... ;-)

Checkpatch does not like that:

WARNING: Block comments use a leading /* on a separate line

+/**************************************************************

But adding it like that would be ok
+/*
+ **************************************************************

I honestly don't find it very beautiful, but let me know if I should add it.

Emanuele

> 
> Kevin
>
diff mbox series

Patch

diff --git a/include/block/blockjob.h b/include/block/blockjob.h
index 87fbb3985f..2373dfeb07 100644
--- a/include/block/blockjob.h
+++ b/include/block/blockjob.h
@@ -74,6 +74,13 @@  typedef struct BlockJob {
     GSList *nodes;
 } BlockJob;
 
+/*
+ * Global state (GS) API. These functions run under the BQL lock.
+ *
+ * See include/block/block-global-state.h for more information about
+ * the GS API.
+ */
+
 /**
  * block_job_next:
  * @job: A block job, or %NULL.
@@ -155,6 +162,8 @@  BlockJobInfo *block_job_query(BlockJob *job, Error **errp);
  */
 void block_job_iostatus_reset(BlockJob *job);
 
+/* Common functions that are neither I/O nor Global State */
+
 /**
  * block_job_is_internal:
  * @job: The job to determine if it is user-visible or not.