Linux-Block Archive on lore.kernel.org
 help / Atom feed
* [PATCH] blk-sysfs: Rework documention of __blk_release_queue
@ 2019-01-31  1:11 Marcos Paulo de Souza
  2019-02-09 18:34 ` Marcos Paulo de Souza
  0 siblings, 1 reply; 4+ messages in thread
From: Marcos Paulo de Souza @ 2019-01-31  1:11 UTC (permalink / raw)
  To: linux-kernel; +Cc: Marcos Paulo de Souza, Jens Axboe, linux-block

The Notes section of the comment was removed, because now
blk_release_queue can only be executed from blk_cleanup_queue (being
called when the q->kobj reaches zero), and also blk_init_queue was removed
in a1ce35fa4985.

Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
---
 This is basically a v2 of https://lkml.org/lkml/2019/1/14/1098

 But, I tried to describe when this function is called, removing redundancies.
 Maybe it would be better placed in blk-core.c, where the q->kobj is initialized
 with blk_queue_ktype (which .release pointer points to blk_release_queue)?

 block/blk-sysfs.c | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index 590d1ef2f961..d4dea9179fa6 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -817,21 +817,16 @@ static void blk_free_queue_rcu(struct rcu_head *rcu_head)
 }
 
 /**
- * __blk_release_queue - release a request queue when it is no longer needed
+ * __blk_release_queue - release a request queue
  * @work: pointer to the release_work member of the request queue to be released
  *
  * Description:
- *     blk_release_queue is the counterpart of blk_init_queue(). It should be
- *     called when a request queue is being released; typically when a block
- *     device is being de-registered. Its primary task it to free the queue
- *     itself.
- *
- * Notes:
- *     The low level driver must have finished any outstanding requests first
- *     via blk_cleanup_queue().
- *
- *     Although blk_release_queue() may be called with preemption disabled,
- *     __blk_release_queue() may sleep.
+ *     This function is called when a block device is being de-registered. The
+ *     process of releasing a request queue starts with blk_cleanup_queue, which
+ *     set the appropriate flags and the calls blk_put_queue, that decrements
+ *     the reference counter of the request queue. Once the reference counter
+ *     of the request queue reaches zero, blk_release_queue is called to release
+ *     all allocated resources of the request queue.
  */
 static void __blk_release_queue(struct work_struct *work)
 {
-- 
2.16.4


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] blk-sysfs: Rework documention of __blk_release_queue
  2019-01-31  1:11 [PATCH] blk-sysfs: Rework documention of __blk_release_queue Marcos Paulo de Souza
@ 2019-02-09 18:34 ` Marcos Paulo de Souza
  2019-02-10 15:23   ` Jens Axboe
  0 siblings, 1 reply; 4+ messages in thread
From: Marcos Paulo de Souza @ 2019-02-09 18:34 UTC (permalink / raw)
  To: linux-kernel; +Cc: Jens Axboe, open list:BLOCK LAYER

[-- Attachment #1: Type: text/plain, Size: 2382 bytes --]

Ping :)

On 1/30/19 11:11 PM, Marcos Paulo de Souza wrote:
> The Notes section of the comment was removed, because now
> blk_release_queue can only be executed from blk_cleanup_queue (being
> called when the q->kobj reaches zero), and also blk_init_queue was removed
> in a1ce35fa4985.
> 
> Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
> ---
>  This is basically a v2 of https://lkml.org/lkml/2019/1/14/1098
> 
>  But, I tried to describe when this function is called, removing redundancies.
>  Maybe it would be better placed in blk-core.c, where the q->kobj is initialized
>  with blk_queue_ktype (which .release pointer points to blk_release_queue)?
> 
>  block/blk-sysfs.c | 19 +++++++------------
>  1 file changed, 7 insertions(+), 12 deletions(-)
> 
> diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
> index 590d1ef2f961..d4dea9179fa6 100644
> --- a/block/blk-sysfs.c
> +++ b/block/blk-sysfs.c
> @@ -817,21 +817,16 @@ static void blk_free_queue_rcu(struct rcu_head *rcu_head)
>  }
>  
>  /**
> - * __blk_release_queue - release a request queue when it is no longer needed
> + * __blk_release_queue - release a request queue
>   * @work: pointer to the release_work member of the request queue to be released
>   *
>   * Description:
> - *     blk_release_queue is the counterpart of blk_init_queue(). It should be
> - *     called when a request queue is being released; typically when a block
> - *     device is being de-registered. Its primary task it to free the queue
> - *     itself.
> - *
> - * Notes:
> - *     The low level driver must have finished any outstanding requests first
> - *     via blk_cleanup_queue().
> - *
> - *     Although blk_release_queue() may be called with preemption disabled,
> - *     __blk_release_queue() may sleep.
> + *     This function is called when a block device is being de-registered. The
> + *     process of releasing a request queue starts with blk_cleanup_queue, which
> + *     set the appropriate flags and the calls blk_put_queue, that decrements
> + *     the reference counter of the request queue. Once the reference counter
> + *     of the request queue reaches zero, blk_release_queue is called to release
> + *     all allocated resources of the request queue.
>   */
>  static void __blk_release_queue(struct work_struct *work)
>  {
> 

[-- Attachment #2: pEpkey.asc --]
[-- Type: application/pgp-keys, Size: 1817 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] blk-sysfs: Rework documention of __blk_release_queue
  2019-02-09 18:34 ` Marcos Paulo de Souza
@ 2019-02-10 15:23   ` Jens Axboe
       [not found]     ` <CAH0vN5JF6p0B+uO2CQ-+Bv_cEtBRtWdpLJHD9mYAf3Ht2GncdA@mail.gmail.com>
  0 siblings, 1 reply; 4+ messages in thread
From: Jens Axboe @ 2019-02-10 15:23 UTC (permalink / raw)
  To: Marcos Paulo de Souza, linux-kernel; +Cc: open list:BLOCK LAYER

On 2/9/19 11:34 AM, Marcos Paulo de Souza wrote:
> Ping :)
> 
> On 1/30/19 11:11 PM, Marcos Paulo de Souza wrote:
>> The Notes section of the comment was removed, because now
>> blk_release_queue can only be executed from blk_cleanup_queue (being
>> called when the q->kobj reaches zero), and also blk_init_queue was removed
>> in a1ce35fa4985.
>>
>> Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
>> ---
>>  This is basically a v2 of https://lkml.org/lkml/2019/1/14/1098
>>
>>  But, I tried to describe when this function is called, removing redundancies.
>>  Maybe it would be better placed in blk-core.c, where the q->kobj is initialized
>>  with blk_queue_ktype (which .release pointer points to blk_release_queue)?
>>
>>  block/blk-sysfs.c | 19 +++++++------------
>>  1 file changed, 7 insertions(+), 12 deletions(-)
>>
>> diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
>> index 590d1ef2f961..d4dea9179fa6 100644
>> --- a/block/blk-sysfs.c
>> +++ b/block/blk-sysfs.c
>> @@ -817,21 +817,16 @@ static void blk_free_queue_rcu(struct rcu_head *rcu_head)
>>  }
>>  
>>  /**
>> - * __blk_release_queue - release a request queue when it is no longer needed
>> + * __blk_release_queue - release a request queue
>>   * @work: pointer to the release_work member of the request queue to be released
>>   *
>>   * Description:
>> - *     blk_release_queue is the counterpart of blk_init_queue(). It should be
>> - *     called when a request queue is being released; typically when a block
>> - *     device is being de-registered. Its primary task it to free the queue
>> - *     itself.
>> - *
>> - * Notes:
>> - *     The low level driver must have finished any outstanding requests first
>> - *     via blk_cleanup_queue().
>> - *
>> - *     Although blk_release_queue() may be called with preemption disabled,
>> - *     __blk_release_queue() may sleep.
>> + *     This function is called when a block device is being de-registered. The

unregistered

>> + *     process of releasing a request queue starts with blk_cleanup_queue, which
>> + *     set the appropriate flags and the calls blk_put_queue, that decrements

s/the/then

>> + *     the reference counter of the request queue. Once the reference counter
>> + *     of the request queue reaches zero, blk_release_queue is called to release
>> + *     all allocated resources of the request queue.
>>   */
>>  static void __blk_release_queue(struct work_struct *work)
>>  {
>>


-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] blk-sysfs: Rework documention of __blk_release_queue
       [not found]     ` <CAH0vN5JF6p0B+uO2CQ-+Bv_cEtBRtWdpLJHD9mYAf3Ht2GncdA@mail.gmail.com>
@ 2019-02-10 15:50       ` Jens Axboe
  0 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2019-02-10 15:50 UTC (permalink / raw)
  To: Marcos Souza; +Cc: open list, open list:BLOCK LAYER

On 2/10/19 8:44 AM, Marcos Souza wrote:
> 
> 
> On Sun, Feb 10, 2019, 13:23 Jens Axboe <axboe@kernel.dk <mailto:axboe@kernel.dk> wrote:
> 
>     On 2/9/19 11:34 AM, Marcos Paulo de Souza wrote:
>     > Ping :)
>     >
>     > On 1/30/19 11:11 PM, Marcos Paulo de Souza wrote:
>     >> The Notes section of the comment was removed, because now
>     >> blk_release_queue can only be executed from blk_cleanup_queue (being
>     >> called when the q->kobj reaches zero), and also blk_init_queue was removed
>     >> in a1ce35fa4985.
>     >>
>     >> Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com <mailto:marcos.souza.org@gmail.com>>
>     >> ---
>     >>  This is basically a v2 of https://lkml.org/lkml/2019/1/14/1098
>     >>
>     >>  But, I tried to describe when this function is called, removing redundancies.
>     >>  Maybe it would be better placed in blk-core.c, where the q->kobj is initialized
>     >>  with blk_queue_ktype (which .release pointer points to blk_release_queue)?
>     >>
>     >>  block/blk-sysfs.c | 19 +++++++------------
>     >>  1 file changed, 7 insertions(+), 12 deletions(-)
>     >>
>     >> diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
>     >> index 590d1ef2f961..d4dea9179fa6 100644
>     >> --- a/block/blk-sysfs.c
>     >> +++ b/block/blk-sysfs.c
>     >> @@ -817,21 +817,16 @@ static void blk_free_queue_rcu(struct rcu_head *rcu_head)
>     >>  }
>     >> 
>     >>  /**
>     >> - * __blk_release_queue - release a request queue when it is no longer needed
>     >> + * __blk_release_queue - release a request queue
>     >>   * @work: pointer to the release_work member of the request queue to be released
>     >>   *
>     >>   * Description:
>     >> - *     blk_release_queue is the counterpart of blk_init_queue(). It should be
>     >> - *     called when a request queue is being released; typically when a block
>     >> - *     device is being de-registered. Its primary task it to free the queue
>     >> - *     itself.
>     >> - *
>     >> - * Notes:
>     >> - *     The low level driver must have finished any outstanding requests first
>     >> - *     via blk_cleanup_queue().
>     >> - *
>     >> - *     Although blk_release_queue() may be called with preemption disabled,
>     >> - *     __blk_release_queue() may sleep.
>     >> + *     This function is called when a block device is being de-registered. The
> 
>     unregistered
> 
>     >> + *     process of releasing a request queue starts with blk_cleanup_queue, which
>     >> + *     set the appropriate flags and the calls blk_put_queue, that decrements
> 
>     s/the/then
> 
> 
> Thanks foe the review. Do you want me to send a v2?

Yes please.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-31  1:11 [PATCH] blk-sysfs: Rework documention of __blk_release_queue Marcos Paulo de Souza
2019-02-09 18:34 ` Marcos Paulo de Souza
2019-02-10 15:23   ` Jens Axboe
     [not found]     ` <CAH0vN5JF6p0B+uO2CQ-+Bv_cEtBRtWdpLJHD9mYAf3Ht2GncdA@mail.gmail.com>
2019-02-10 15:50       ` Jens Axboe

Linux-Block Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-block/0 linux-block/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-block linux-block/ https://lore.kernel.org/linux-block \
		linux-block@vger.kernel.org linux-block@archiver.kernel.org
	public-inbox-index linux-block


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-block


AGPL code for this site: git clone https://public-inbox.org/ public-inbox