zbd: engines/libzbc: don't fail on assert for offline zones
authorDmitry Fomichev <dmitry.fomichev@wdc.com>
Wed, 27 Jan 2021 04:19:12 +0000 (13:19 +0900)
committerJens Axboe <axboe@kernel.dk>
Fri, 29 Jan 2021 15:14:00 +0000 (08:14 -0700)
If fio is run against a zoned device that has any zones in OFFLINE
condition, the following assertion is raised -

fio: zbd.c:473: parse_zone_info: Assertion `z->wp <= z->start + zone_size' failed.

This happens because offline zones have no valid write pointer and
it is reported by libzbc and blkzoned as (uint64_t)(-1). To avoid
violating this assertion, set the write pointer in all offline zones
to point at the start of the zone.

Signed-off-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Reviewed-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
engines/libzbc.c
oslib/linux-blkzoned.c

index 4b9002330dcfd66d106087d1dc9275c6402fe1d3..552aab65242e634bf63ae05a0b8f957fc5dcc2d3 100644 (file)
@@ -283,7 +283,7 @@ static int libzbc_report_zones(struct thread_data *td, struct fio_file *f,
                default:
                        /* Treat all these conditions as offline (don't use!) */
                        zbdz->cond = ZBD_ZONE_COND_OFFLINE;
-                       break;
+                       zbdz->wp = zbdz->start;
                }
        }
 
index 0a8a577a59e9d0f8488d34454af15f2c220ea034..f37c67fc86953cadab7eaab2c539c79dbf81027d 100644 (file)
@@ -203,7 +203,7 @@ int blkzoned_report_zones(struct thread_data *td, struct fio_file *f,
                default:
                        /* Treat all these conditions as offline (don't use!) */
                        z->cond = ZBD_ZONE_COND_OFFLINE;
-                       break;
+                       z->wp = z->start;
                }
        }