All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] zbd: fix zonemode=zbd with NDEBUG
@ 2020-04-10 19:06 Alexey Dobriyan
  2020-04-13  5:37 ` Damien Le Moal
  2020-04-13 14:20 ` Jens Axboe
  0 siblings, 2 replies; 3+ messages in thread
From: Alexey Dobriyan @ 2020-04-10 19:06 UTC (permalink / raw)
  To: axboe; +Cc: damien.lemoal, fio

assert() with NDEBUG doesn't evaluate argument.

Signed-off-by: Alexey Dobriyan (SK hynix) <adobriyan@gmail.com>
---

 zbd.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/zbd.c
+++ b/zbd.c
@@ -1220,6 +1220,7 @@ static void zbd_put_io(const struct io_u *io_u)
 	struct zoned_block_device_info *zbd_info = f->zbd_info;
 	struct fio_zone_info *z;
 	uint32_t zone_idx;
+	int ret;
 
 	if (!zbd_info)
 		return;
@@ -1235,7 +1236,8 @@ static void zbd_put_io(const struct io_u *io_u)
 	       "%s: terminate I/O (%lld, %llu) for zone %u\n",
 	       f->file_name, io_u->offset, io_u->buflen, zone_idx);
 
-	assert(pthread_mutex_unlock(&z->mutex) == 0);
+	ret = pthread_mutex_unlock(&z->mutex);
+	assert(ret == 0);
 	zbd_check_swd(f);
 }
 


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

* Re: [PATCH] zbd: fix zonemode=zbd with NDEBUG
  2020-04-10 19:06 [PATCH] zbd: fix zonemode=zbd with NDEBUG Alexey Dobriyan
@ 2020-04-13  5:37 ` Damien Le Moal
  2020-04-13 14:20 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Damien Le Moal @ 2020-04-13  5:37 UTC (permalink / raw)
  To: Alexey Dobriyan, axboe; +Cc: fio

On 2020/04/11 4:06, Alexey Dobriyan wrote:
> assert() with NDEBUG doesn't evaluate argument.
> 
> Signed-off-by: Alexey Dobriyan (SK hynix) <adobriyan@gmail.com>
> ---
> 
>  zbd.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> --- a/zbd.c
> +++ b/zbd.c
> @@ -1220,6 +1220,7 @@ static void zbd_put_io(const struct io_u *io_u)
>  	struct zoned_block_device_info *zbd_info = f->zbd_info;
>  	struct fio_zone_info *z;
>  	uint32_t zone_idx;
> +	int ret;
>  
>  	if (!zbd_info)
>  		return;
> @@ -1235,7 +1236,8 @@ static void zbd_put_io(const struct io_u *io_u)
>  	       "%s: terminate I/O (%lld, %llu) for zone %u\n",
>  	       f->file_name, io_u->offset, io_u->buflen, zone_idx);
>  
> -	assert(pthread_mutex_unlock(&z->mutex) == 0);
> +	ret = pthread_mutex_unlock(&z->mutex);
> +	assert(ret == 0);
>  	zbd_check_swd(f);
>  }
>  
> 

Looks good. And that may actually be the reason for the fio hang reported on
github issues. Will ping the issue submitter to try this.

Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>

-- 
Damien Le Moal
Western Digital Research


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

* Re: [PATCH] zbd: fix zonemode=zbd with NDEBUG
  2020-04-10 19:06 [PATCH] zbd: fix zonemode=zbd with NDEBUG Alexey Dobriyan
  2020-04-13  5:37 ` Damien Le Moal
@ 2020-04-13 14:20 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2020-04-13 14:20 UTC (permalink / raw)
  To: Alexey Dobriyan; +Cc: damien.lemoal, fio

On 4/10/20 1:06 PM, Alexey Dobriyan wrote:
> assert() with NDEBUG doesn't evaluate argument.

Thanks, that's exactly why assert/debug calls to statements with
side effects is a really bad idea.

-- 
Jens Axboe



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

end of thread, other threads:[~2020-04-13 14:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-10 19:06 [PATCH] zbd: fix zonemode=zbd with NDEBUG Alexey Dobriyan
2020-04-13  5:37 ` Damien Le Moal
2020-04-13 14:20 ` Jens Axboe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.