diff mbox series

[v16,18/26] blk-zoned: Make disk_should_remove_zone_wplug() more robust

Message ID 20241119002815.600608-19-bvanassche@acm.org (mailing list archive)
State Not Applicable
Headers show
Series Improve write performance for zoned UFS devices | expand

Commit Message

Bart Van Assche Nov. 19, 2024, 12:28 a.m. UTC
Make the disk_should_remove_zone_wplug() behavior independent of the
number of zwplug references held by the caller.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 block/blk-zoned.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Comments

Damien Le Moal Nov. 19, 2024, 7:58 a.m. UTC | #1
On 11/19/24 09:28, Bart Van Assche wrote:
> Make the disk_should_remove_zone_wplug() behavior independent of the
> number of zwplug references held by the caller.
> 
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
>  block/blk-zoned.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/block/blk-zoned.c b/block/blk-zoned.c
> index 2b4783026450..59f6559b94da 100644
> --- a/block/blk-zoned.c
> +++ b/block/blk-zoned.c
> @@ -457,12 +457,9 @@ static inline bool disk_should_remove_zone_wplug(struct gendisk *disk,
>  	 * blk_zone_write_plug_finish_request() (e.g. with split BIOs
>  	 * that are chained). In such case, disk_zone_wplug_unplug_bio()
>  	 * should not attempt to remove the zone write plug until all BIO
> -	 * completions are seen. Check by looking at the zone write plug
> -	 * reference count, which is 2 when the plug is unused (one reference
> -	 * taken when the plug was allocated and another reference taken by the
> -	 * caller context).
> +	 * completions are seen.
>  	 */
> -	if (refcount_read(&zwplug->ref) > 2)
> +	if (zwplug->wp_offset != zwplug->wp_offset_compl)

See my comment in patch 5 about wp_offset_compl. I do not think it works.


>  		return false;
>  
>  	/* We can remove zone write plugs for zones that are empty or full. */
diff mbox series

Patch

diff --git a/block/blk-zoned.c b/block/blk-zoned.c
index 2b4783026450..59f6559b94da 100644
--- a/block/blk-zoned.c
+++ b/block/blk-zoned.c
@@ -457,12 +457,9 @@  static inline bool disk_should_remove_zone_wplug(struct gendisk *disk,
 	 * blk_zone_write_plug_finish_request() (e.g. with split BIOs
 	 * that are chained). In such case, disk_zone_wplug_unplug_bio()
 	 * should not attempt to remove the zone write plug until all BIO
-	 * completions are seen. Check by looking at the zone write plug
-	 * reference count, which is 2 when the plug is unused (one reference
-	 * taken when the plug was allocated and another reference taken by the
-	 * caller context).
+	 * completions are seen.
 	 */
-	if (refcount_read(&zwplug->ref) > 2)
+	if (zwplug->wp_offset != zwplug->wp_offset_compl)
 		return false;
 
 	/* We can remove zone write plugs for zones that are empty or full. */