zbd: check write ranges for zone_reset_threshold option
authorShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Thu, 9 Feb 2023 07:09:05 +0000 (16:09 +0900)
committerVincent Fu <vincent.fu@samsung.com>
Tue, 14 Feb 2023 14:52:52 +0000 (09:52 -0500)
commitb3e9bd036a8ce3a81dd03293852de130848beb38
tree02dc0fdd890b89280e78f070a130bf8d57db0807
parent2fb29f27e04d94cd30f8c59554302ace5d69972e
zbd: check write ranges for zone_reset_threshold option

The valid data bytes accounting is used for zone_reset_threshold option.
This accounting usage has two issues. The first issue is unexpected
zone reset due to different IO ranges. The valid data bytes accounting
is done for all IO ranges per device, and shared by all jobs. On the
other hand, the zone_reset_threshold option is defined as the ratio to
each job's IO range. When a job refers to the accounting value, it
includes writes to IO ranges out of the job's IO range. Then zone reset
is triggered earlier than expected.

The second issue is accounting value initialization. The initialization
of the accounting field is repeated for each job, then the value
initialized by the first job is overwritten by other jobs. This works as
expected for single job or multiple jobs with same write range. However,
when multiple jobs have different write ranges, the overwritten value is
wrong except for the last job.

To ensure that the accounting works as expected for the option, check
that write ranges of all jobs are same. If jobs have different write
ranges, report it as an error. Initialize the accounting field only once
for the first job. All jobs have same write range, then one time
initialization is enough. Update man page to clarify this limitation of
the option.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Reviewed-by: Niklas Cassel <niklas.cassel@wdc.com>
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
HOWTO.rst
fio.1
zbd.c
zbd.h