continue;
zone_idx = zbd_zone_idx(f, f->file_offset);
z = &f->zbd_info->zone_info[zone_idx];
continue;
zone_idx = zbd_zone_idx(f, f->file_offset);
z = &f->zbd_info->zone_info[zone_idx];
if (new_offset >= f->file_offset + f->io_size) {
log_info("%s: io_size must be at least one zone\n",
f->file_name);
if (new_offset >= f->file_offset + f->io_size) {
log_info("%s: io_size must be at least one zone\n",
f->file_name);
}
zone_idx = zbd_zone_idx(f, f->file_offset + f->io_size);
z = &f->zbd_info->zone_info[zone_idx];
}
zone_idx = zbd_zone_idx(f, f->file_offset + f->io_size);
z = &f->zbd_info->zone_info[zone_idx];
if (f->file_offset + f->io_size != new_end) {
if (new_end <= f->file_offset) {
log_info("%s: io_size must be at least one zone\n",
if (f->file_offset + f->io_size != new_end) {
if (new_end <= f->file_offset) {
log_info("%s: io_size must be at least one zone\n",
zone_size = f->zbd_info->zone_size;
for (k = 0; k < ARRAY_SIZE(td->o.bs); k++) {
if (td->o.verify != VERIFY_NONE &&
zone_size = f->zbd_info->zone_size;
for (k = 0; k < ARRAY_SIZE(td->o.bs); k++) {
if (td->o.verify != VERIFY_NONE &&
log_info("%s: block size %llu is not a divisor of the zone size %d\n",
f->file_name, td->o.bs[k],
log_info("%s: block size %llu is not a divisor of the zone size %d\n",
f->file_name, td->o.bs[k],
zbd_info = scalloc(1, sizeof(*zbd_info) +
(nr_zones + 1) * sizeof(zbd_info->zone_info[0]));
if (!zbd_info)
zbd_info = scalloc(1, sizeof(*zbd_info) +
(nr_zones + 1) * sizeof(zbd_info->zone_info[0]));
if (!zbd_info)
ret = -EINVAL;
goto close;
}
dprint(FD_ZBD, "Device %s has %d zones of size %lu KB\n", f->file_name,
ret = -EINVAL;
goto close;
}
dprint(FD_ZBD, "Device %s has %d zones of size %lu KB\n", f->file_name,
zbd_info = scalloc(1, sizeof(*zbd_info) +
(nr_zones + 1) * sizeof(zbd_info->zone_info[0]));
zbd_info = scalloc(1, sizeof(*zbd_info) +
(nr_zones + 1) * sizeof(zbd_info->zone_info[0]));
z = (void *)(hdr + 1);
for (i = 0; i < hdr->nr_zones; i++, j++, z++, p++) {
pthread_mutex_init(&p->mutex, &attr);
z = (void *)(hdr + 1);
for (i = 0; i < hdr->nr_zones; i++, j++, z++, p++) {
pthread_mutex_init(&p->mutex, &attr);
* Returns 0 upon success and a negative error code upon failure.
*/
static int zbd_reset_range(struct thread_data *td, const struct fio_file *f,
* Returns 0 upon success and a negative error code upon failure.
*/
static int zbd_reset_range(struct thread_data *td, const struct fio_file *f,
};
uint32_t zone_idx_b, zone_idx_e;
struct fio_zone_info *zb, *ze, *z;
int ret = 0;
assert(f->fd != -1);
};
uint32_t zone_idx_b, zone_idx_e;
struct fio_zone_info *zb, *ze, *z;
int ret = 0;
assert(f->fd != -1);
ze = &f->zbd_info->zone_info[zone_idx_e];
for (z = zb; z < ze; z++) {
pthread_mutex_lock(&z->mutex);
ze = &f->zbd_info->zone_info[zone_idx_e];
for (z = zb; z < ze; z++) {
pthread_mutex_lock(&z->mutex);
struct fio_zone_info *const ze, bool all_zones)
{
struct fio_zone_info *z, *start_z = ze;
struct fio_zone_info *const ze, bool all_zones)
{
struct fio_zone_info *z, *start_z = ze;
/* Wrap-around. */
zone_idx = zbd_zone_idx(f, f->file_offset);
z = &f->zbd_info->zone_info[zone_idx];
}
/* Wrap-around. */
zone_idx = zbd_zone_idx(f, f->file_offset);
z = &f->zbd_info->zone_info[zone_idx];
}
out:
dprint(FD_ZBD, "%s(%s): returning zone %d\n", __func__, f->file_name,
zone_idx);
out:
dprint(FD_ZBD, "%s(%s): returning zone %d\n", __func__, f->file_name,
zone_idx);
if (z->verify_block * min_bs >= f->zbd_info->zone_size)
log_err("%s: %d * %d >= %ld\n", f->file_name, z->verify_block,
min_bs, f->zbd_info->zone_size);
if (z->verify_block * min_bs >= f->zbd_info->zone_size)
log_err("%s: %d * %d >= %ld\n", f->file_name, z->verify_block,
min_bs, f->zbd_info->zone_size);
for (z1 = zb + 1, z2 = zb - 1; z1 < zl || z2 >= zf; z1++, z2--) {
if (z1 < zl && z1->cond != BLK_ZONE_COND_OFFLINE) {
pthread_mutex_lock(&z1->mutex);
for (z1 = zb + 1, z2 = zb - 1; z1 < zl || z2 >= zf; z1++, z2--) {
if (z1 < zl && z1->cond != BLK_ZONE_COND_OFFLINE) {
pthread_mutex_lock(&z1->mutex);
if (td_random(td) && z2 >= zf &&
z2->cond != BLK_ZONE_COND_OFFLINE) {
pthread_mutex_lock(&z2->mutex);
if (td_random(td) && z2 >= zf &&
z2->cond != BLK_ZONE_COND_OFFLINE) {
pthread_mutex_lock(&z2->mutex);
z = &zbd_info->zone_info[zone_idx];
assert(zone_idx < zbd_info->nr_zones);
if (z->type != BLK_ZONE_TYPE_SEQWRITE_REQ)
z = &zbd_info->zone_info[zone_idx];
assert(zone_idx < zbd_info->nr_zones);
if (z->type != BLK_ZONE_TYPE_SEQWRITE_REQ)
pthread_mutex_unlock(&zb->mutex);
zl = &f->zbd_info->zone_info[zbd_zone_idx(f,
f->file_offset + f->io_size)];
pthread_mutex_unlock(&zb->mutex);
zl = &f->zbd_info->zone_info[zbd_zone_idx(f,
f->file_offset + f->io_size)];
}
/*
* Make sure the I/O is within the zone valid data range while
* maximizing the I/O size and preserving randomness.
*/
if (range <= io_u->buflen)
}
/*
* Make sure the I/O is within the zone valid data range while
* maximizing the I/O size and preserving randomness.
*/
if (range <= io_u->buflen)
(range - io_u->buflen)) / min_bs * min_bs;
/*
* Make sure the I/O does not cross over the zone wp position.
*/
new_len = min((unsigned long long)io_u->buflen,
(range - io_u->buflen)) / min_bs * min_bs;
/*
* Make sure the I/O does not cross over the zone wp position.
*/
new_len = min((unsigned long long)io_u->buflen,
new_len = new_len / min_bs * min_bs;
if (new_len < io_u->buflen) {
io_u->buflen = new_len;
dprint(FD_IO, "Changed length from %u into %llu\n",
orig_len, io_u->buflen);
}
new_len = new_len / min_bs * min_bs;
if (new_len < io_u->buflen) {
io_u->buflen = new_len;
dprint(FD_IO, "Changed length from %u into %llu\n",
orig_len, io_u->buflen);
}
goto eof;
if (!zbd_open_zone(td, io_u, zone_idx_b)) {
pthread_mutex_unlock(&zb->mutex);
goto eof;
if (!zbd_open_zone(td, io_u, zone_idx_b)) {
pthread_mutex_unlock(&zb->mutex);
f->io_size * td->o.zrt.u.f &&
zbd_dec_and_reset_write_cnt(td, f)) {
zb->reset_zone = 1;
f->io_size * td->o.zrt.u.f &&
zbd_dec_and_reset_write_cnt(td, f)) {
zb->reset_zone = 1;
}
/* Make writes occur at the write pointer */
assert(!zbd_zone_full(f, zb, min_bs));
}
/* Make writes occur at the write pointer */
assert(!zbd_zone_full(f, zb, min_bs));
if (!is_valid_offset(f, io_u->offset)) {
dprint(FD_ZBD, "Dropped request with offset %llu\n",
io_u->offset);
if (!is_valid_offset(f, io_u->offset)) {
dprint(FD_ZBD, "Dropped request with offset %llu\n",
io_u->offset);