X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=t%2Fzbd%2Ffunctions;fp=t%2Fzbd%2Ffunctions;h=fe5b3397f5a5688adaa2b9504667ab011100ef13;hb=00080a1eb135a91e46ff17ea630512d142124708;hp=9a6d699910f2f94acfc95ac5d06aa8720c3ba238;hpb=23a846b389235e5aa0058042319922b7ef7c01fa;p=fio.git diff --git a/t/zbd/functions b/t/zbd/functions index 9a6d6999..fe5b3397 100644 --- a/t/zbd/functions +++ b/t/zbd/functions @@ -4,6 +4,7 @@ blkzone=$(type -p blkzone 2>/dev/null) sg_inq=$(type -p sg_inq 2>/dev/null) zbc_report_zones=$(type -p zbc_report_zones 2>/dev/null) zbc_reset_zone=$(type -p zbc_reset_zone 2>/dev/null) +zbc_close_zone=$(type -p zbc_close_zone 2>/dev/null) zbc_info=$(type -p zbc_info 2>/dev/null) if [ -z "${blkzone}" ] && { [ -z "${zbc_report_zones}" ] || [ -z "${zbc_reset_zone}" ]; }; then @@ -304,6 +305,18 @@ reset_zone() { fi } +# Close the zone on device $1 at offset $2. The offset must be specified in +# units of 512 byte sectors. +close_zone() { + local dev=$1 offset=$2 + + if [ -n "${blkzone}" ] && [ -z "${use_libzbc}" ]; then + ${blkzone} close -o "${offset}" -c 1 "$dev" + else + ${zbc_close_zone} -sector "$dev" "${offset}" >/dev/null + fi +} + # Extract the number of bytes that have been transferred from a line like # READ: bw=6847KiB/s (7011kB/s), 6847KiB/s-6847KiB/s (7011kB/s-7011kB/s), io=257MiB (269MB), run=38406-38406msec fio_io() {