return write_cnt == 0;
}
-enum swd_action {
- CHECK_SWD,
- SET_SWD,
-};
-
-/* Calculate the number of sectors with data (swd) and perform action 'a' */
-static uint64_t zbd_process_swd(struct thread_data *td,
- const struct fio_file *f, enum swd_action a)
+static uint64_t zbd_set_swd(struct thread_data *td, const struct fio_file *f)
{
struct fio_zone_info *zb, *ze, *z;
uint64_t wp_swd = 0;
}
pthread_mutex_lock(&f->zbd_info->mutex);
- switch (a) {
- case CHECK_SWD:
- assert(f->zbd_info->wp_sectors_with_data == wp_swd);
- break;
- case SET_SWD:
- f->zbd_info->wp_sectors_with_data = wp_swd;
- break;
- }
+ f->zbd_info->wp_sectors_with_data = wp_swd;
pthread_mutex_unlock(&f->zbd_info->mutex);
for (z = zb; z < ze; z++)
return wp_swd;
}
-/*
- * The swd check is useful for debugging but takes too much time to leave
- * it enabled all the time. Hence it is disabled by default.
- */
-static const bool enable_check_swd = false;
-
-/* Check whether the values of zbd_info.*sectors_with_data are correct. */
-static void zbd_check_swd(struct thread_data *td, const struct fio_file *f)
-{
- if (!enable_check_swd)
- return;
-
- zbd_process_swd(td, f, CHECK_SWD);
-}
-
void zbd_file_reset(struct thread_data *td, struct fio_file *f)
{
struct fio_zone_info *zb, *ze;
zb = zbd_get_zone(f, f->min_zone);
ze = zbd_get_zone(f, f->max_zone);
- swd = zbd_process_swd(td, f, SET_SWD);
+ swd = zbd_set_swd(td, f);
dprint(FD_ZBD, "%s(%s): swd = %" PRIu64 "\n",
__func__, f->file_name, swd);
zbd_end_zone_io(td, io_u, z);
zone_unlock(z);
- zbd_check_swd(td, f);
}
/*
io_u->ddir == DDIR_READ && td->o.read_beyond_wp)
return io_u_accept;
- zbd_check_swd(td, f);
-
zone_lock(td, f, zb);
switch (io_u->ddir) {