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

Damien Le Moal
2024-11-19T07:58:07Z

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. */

--
Damien Le Moal
Western Digital Research