zbd: fix zonemode=zbd with NDEBUG
PATCH 1/1 zbd: fix zonemode=zbd with NDEBUG
assert() with NDEBUG doesn't evaluate argument.
Signed-off-by Alexey Dobriyan (SK hynix) <[email protected]>
---
zbd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
zbd.c +3 -1
@@ -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); }
Quoted 20 lines · Alexey Dobriyan
assert()with NDEBUG doesn't evaluate argument.Signed-off-by Alexey Dobriyan (SK hynix) <[email protected]>---
zbd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)zbd.c +1
-0@@ -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 ;
zbd.c static void zbd_put_io(const struct io_u *io_u) · line 1243
Quoted 9 lines
zbd.c +2
-1@@ -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 <[email protected]>
Signature · 2 lines
Damien Le Moal Western Digital Research
Quoted 1 line · Alexey Dobriyan
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.
Signature · 1 line
Jens Axboe