* [PATCH 1/7] block/blkio: add io_uring: filename parsing
2023-07-25 14:19 [PATCH 0/7] iotests: add -io_uring support Stefan Hajnoczi
@ 2023-07-25 14:19 ` Stefan Hajnoczi
2023-07-25 14:19 ` [PATCH 2/7] block/blkio: add "simple" creation support Stefan Hajnoczi
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Stefan Hajnoczi @ 2023-07-25 14:19 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-block, Stefan Hajnoczi, Hanna Reitz, Kevin Wolf
The qemu-iotests test suite requires filename parsing because it does
not use image options syntax everywhere. Add it now so that later
patches can enable qemu-iotests for the io_uring block driver.
The blkio.c code has other libblkio-based drivers that could benefit
from filename parsing too. Leave them for now because I am not yet ready
to add qemu-iotests support for them.
Suggested-by: Hanna Czenczek <hreitz@redhat.com>
Suggested-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
block/blkio.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/block/blkio.c b/block/blkio.c
index 1798648134..a0240a5bcc 100644
--- a/block/blkio.c
+++ b/block/blkio.c
@@ -603,6 +603,12 @@ static void blkio_unregister_buf(BlockDriverState *bs, void *host, size_t size)
}
}
+static void blkio_io_uring_parse_filename(const char *filename, QDict *options,
+ Error **errp)
+{
+ bdrv_parse_filename_strip_prefix(filename, "io_uring:", options);
+}
+
static int blkio_io_uring_open(BlockDriverState *bs, QDict *options, int flags,
Error **errp)
{
@@ -1049,6 +1055,7 @@ static BlockDriver bdrv_io_uring = {
.format_name = "io_uring",
.protocol_name = "io_uring",
.bdrv_needs_filename = true,
+ .bdrv_parse_filename = blkio_io_uring_parse_filename,
BLKIO_DRIVER_COMMON
};
--
2.41.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/7] block/blkio: add "simple" creation support
2023-07-25 14:19 [PATCH 0/7] iotests: add -io_uring support Stefan Hajnoczi
2023-07-25 14:19 ` [PATCH 1/7] block/blkio: add io_uring: filename parsing Stefan Hajnoczi
@ 2023-07-25 14:19 ` Stefan Hajnoczi
2023-07-25 14:19 ` [PATCH 3/7] iotests: string substitution order in _filter_img_create_filenames Stefan Hajnoczi
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Stefan Hajnoczi @ 2023-07-25 14:19 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-block, Stefan Hajnoczi, Hanna Reitz, Kevin Wolf
Some block drivers do not support image creation. This is inconvenient
for test cases, which usually want to create an image before testing
various I/O requests.
Use bdrv_co_create_opts_simple(), which initializes a pre-existing image
instead of creating a new image, so that tests will be able to work with
libblkio-based block drivers.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
block/blkio.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/block/blkio.c b/block/blkio.c
index a0240a5bcc..28d11325e6 100644
--- a/block/blkio.c
+++ b/block/blkio.c
@@ -1032,6 +1032,8 @@ static void blkio_refresh_limits(BlockDriverState *bs, Error **errp)
.instance_size = sizeof(BDRVBlkioState), \
.bdrv_file_open = blkio_file_open, \
.bdrv_close = blkio_close, \
+ .bdrv_co_create_opts = bdrv_co_create_opts_simple, \
+ .create_opts = &bdrv_create_opts_simple, \
.bdrv_co_getlength = blkio_co_getlength, \
.bdrv_co_truncate = blkio_truncate, \
.bdrv_co_get_info = blkio_co_get_info, \
--
2.41.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/7] iotests: string substitution order in _filter_img_create_filenames
2023-07-25 14:19 [PATCH 0/7] iotests: add -io_uring support Stefan Hajnoczi
2023-07-25 14:19 ` [PATCH 1/7] block/blkio: add io_uring: filename parsing Stefan Hajnoczi
2023-07-25 14:19 ` [PATCH 2/7] block/blkio: add "simple" creation support Stefan Hajnoczi
@ 2023-07-25 14:19 ` Stefan Hajnoczi
2023-07-25 14:19 ` [PATCH 4/7] iotests: filter img create backing_file when IMGPROTO is modified Stefan Hajnoczi
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Stefan Hajnoczi @ 2023-07-25 14:19 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-block, Stefan Hajnoczi, Hanna Reitz, Kevin Wolf
_filter_img_create_filenames fails to remove $IMGPROTO: when
$REMOTE_TEST_DIR matches. echo "$IMGPROTO:$REMOTE_TEST_DIR" |
_filter_img_create_filenames results in "$IMGPROTO:TEST_DIR" instead of
"TEST_DIR".
Substitute "s#$REMOTE_TEST_DIR#TEST_DIR#g" after
"s#$IMGPROTO:$TEST_DIR#TEST_DIR#g" since the latter matches $TEST_DIR.
This way echo "$IMGPROTO:$REMOTE_TEST_DIR" |
_filter_img_create_filenames results in "TEST_DIR" as expected.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
tests/qemu-iotests/common.filter | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/common.filter
index fc3c64bcb8..4acac16c52 100644
--- a/tests/qemu-iotests/common.filter
+++ b/tests/qemu-iotests/common.filter
@@ -125,8 +125,8 @@ _filter_actual_image_size()
_filter_img_create_filenames()
{
sed \
+ -e "s#$IMGPROTO:$TEST_DIR#TEST_DIR#g" \
-e "s#$REMOTE_TEST_DIR#TEST_DIR#g" \
- -e "s#$IMGPROTO:$TEST_DIR#TEST_DIR#g" \
-e "s#$TEST_DIR#TEST_DIR#g" \
-e "s#$SOCK_DIR#SOCK_DIR#g" \
-e 's#SOCK_DIR/fuse-#TEST_DIR/#g' \
--
2.41.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 4/7] iotests: filter img create backing_file when IMGPROTO is modified
2023-07-25 14:19 [PATCH 0/7] iotests: add -io_uring support Stefan Hajnoczi
` (2 preceding siblings ...)
2023-07-25 14:19 ` [PATCH 3/7] iotests: string substitution order in _filter_img_create_filenames Stefan Hajnoczi
@ 2023-07-25 14:19 ` Stefan Hajnoczi
2023-07-25 14:19 ` [PATCH 5/7] iotests: add -io_uring support Stefan Hajnoczi
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Stefan Hajnoczi @ 2023-07-25 14:19 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-block, Stefan Hajnoczi, Hanna Reitz, Kevin Wolf
197 and 215 modify IMGPROTO, IMGFMT, etc temporarily while creating an
additional image file after the main test image. The backing file name
still has the old IMGPROTO, IMGFMT, etc. This means _filter_img_create
will not filter the backing_file= output from qemu-img.
Add a helper that filters backing_file= output so these test cases are
more robust. This will be necessary in order to enable the io_uring
protocol driver in qemu-iotests.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
tests/qemu-iotests/197 | 4 +++-
tests/qemu-iotests/197.out | 2 +-
tests/qemu-iotests/215 | 4 +++-
tests/qemu-iotests/215.out | 2 +-
tests/qemu-iotests/common.filter | 8 ++++++++
5 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/tests/qemu-iotests/197 b/tests/qemu-iotests/197
index a2547bc280..756603b19e 100755
--- a/tests/qemu-iotests/197
+++ b/tests/qemu-iotests/197
@@ -68,7 +68,9 @@ fi
_make_test_img 4G
$QEMU_IO -c "write -P 55 3G 1k" "$TEST_IMG" | _filter_qemu_io
IMGPROTO=file IMGFMT=qcow2 TEST_IMG_FILE="$TEST_WRAP" \
- _make_test_img --no-opts -F "$IMGFMT" -b "$TEST_IMG" | _filter_img_create
+ _make_test_img --no-opts -F "$IMGFMT" -b "$TEST_IMG" | \
+ _filter_img_create_backing_file | \
+ _filter_img_create
$QEMU_IO -f qcow2 -c "write -z -u 1M 64k" "$TEST_WRAP" | _filter_qemu_io
# Ensure that a read of two clusters, but where one is already allocated,
diff --git a/tests/qemu-iotests/197.out b/tests/qemu-iotests/197.out
index ad414c3b0e..bbfb3413e4 100644
--- a/tests/qemu-iotests/197.out
+++ b/tests/qemu-iotests/197.out
@@ -5,7 +5,7 @@ QA output created by 197
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=4294967296
wrote 1024/1024 bytes at offset 3221225472
1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-Formatting 'TEST_DIR/t.wrap.IMGFMT', fmt=IMGFMT size=4294967296 backing_file=TEST_DIR/t.IMGFMT backing_fmt=IMGFMT
+Formatting 'TEST_DIR/t.wrap.IMGFMT', fmt=IMGFMT size=4294967296 backing_file=BACKING_FILE backing_fmt=IMGFMT
wrote 65536/65536 bytes at offset 1048576
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
read 131072/131072 bytes at offset 1048576
diff --git a/tests/qemu-iotests/215 b/tests/qemu-iotests/215
index d464596f14..145f2bb3eb 100755
--- a/tests/qemu-iotests/215
+++ b/tests/qemu-iotests/215
@@ -65,7 +65,9 @@ fi
_make_test_img 4G
$QEMU_IO -c "write -P 55 3G 1k" "$TEST_IMG" | _filter_qemu_io
IMGPROTO=file IMGFMT=qcow2 TEST_IMG_FILE="$TEST_WRAP" \
- _make_test_img --no-opts -F "$IMGFMT" -b "$TEST_IMG" | _filter_img_create
+ _make_test_img --no-opts -F "$IMGFMT" -b "$TEST_IMG" | \
+ _filter_img_create_backing_file | \
+ _filter_img_create
$QEMU_IO -f qcow2 -c "write -z -u 1M 64k" "$TEST_WRAP" | _filter_qemu_io
# Ensure that a read of two clusters, but where one is already allocated,
diff --git a/tests/qemu-iotests/215.out b/tests/qemu-iotests/215.out
index 5a2fe40d03..d10cce71bc 100644
--- a/tests/qemu-iotests/215.out
+++ b/tests/qemu-iotests/215.out
@@ -5,7 +5,7 @@ QA output created by 215
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=4294967296
wrote 1024/1024 bytes at offset 3221225472
1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-Formatting 'TEST_DIR/t.wrap.IMGFMT', fmt=IMGFMT size=4294967296 backing_file=TEST_DIR/t.IMGFMT backing_fmt=IMGFMT
+Formatting 'TEST_DIR/t.wrap.IMGFMT', fmt=IMGFMT size=4294967296 backing_file=BACKING_FILE backing_fmt=IMGFMT
wrote 65536/65536 bytes at offset 1048576
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
read 131072/131072 bytes at offset 1048576
diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/common.filter
index 4acac16c52..b047fe43a0 100644
--- a/tests/qemu-iotests/common.filter
+++ b/tests/qemu-iotests/common.filter
@@ -206,6 +206,14 @@ _filter_img_create()
done
}
+# When creating additional images with different IMGPROTO, IMGFMT, etc than the
+# main test image, _filter_img_create cannot filter backing_file since it
+# contains different IMGPROTO, IMGFMT, etc values than currently in use.
+_filter_img_create_backing_file()
+{
+ sed -e "s/ backing_file=[^ ]*/ backing_file=BACKING_FILE/g"
+}
+
_filter_img_create_size()
{
gsed -e "s# size=[0-9]\\+# size=SIZE#g"
--
2.41.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 5/7] iotests: add -io_uring support
2023-07-25 14:19 [PATCH 0/7] iotests: add -io_uring support Stefan Hajnoczi
` (3 preceding siblings ...)
2023-07-25 14:19 ` [PATCH 4/7] iotests: filter img create backing_file when IMGPROTO is modified Stefan Hajnoczi
@ 2023-07-25 14:19 ` Stefan Hajnoczi
2023-07-25 14:19 ` [PATCH 6/7] iotests: add io_uring to supported protocols in 012 Stefan Hajnoczi
2023-07-25 14:19 ` [PATCH 7/7] iotests: add io_uring to supported protocols in 052 Stefan Hajnoczi
6 siblings, 0 replies; 8+ messages in thread
From: Stefan Hajnoczi @ 2023-07-25 14:19 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-block, Stefan Hajnoczi, Hanna Reitz, Kevin Wolf
The libblkio-based io_uring block driver currently has no test coverage.
Running existing qemu-iotests with io_uring is possible with just a few
tweaks.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
tests/qemu-iotests/033 | 1 +
tests/qemu-iotests/check | 2 +-
tests/qemu-iotests/common.rc | 12 +++++++++++-
3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/tests/qemu-iotests/033 b/tests/qemu-iotests/033
index da9133c44b..a32af9942f 100755
--- a/tests/qemu-iotests/033
+++ b/tests/qemu-iotests/033
@@ -39,6 +39,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
_supported_fmt generic
_supported_proto generic
+_unsupported_proto io_uring # libblkio 1.3.0 does not support write_zeroes with FUA
_unsupported_imgopts "subformat=streamOptimized"
diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
index f2e9d27dcf..7a3368b768 100755
--- a/tests/qemu-iotests/check
+++ b/tests/qemu-iotests/check
@@ -94,7 +94,7 @@ def make_argparser() -> argparse.ArgumentParser:
mg.add_argument('-' + fmt, dest='imgfmt', action='store_const',
const=fmt, help=f'test {fmt}')
- protocol_list = ['file', 'rbd', 'nbd', 'ssh', 'nfs', 'fuse']
+ protocol_list = ['file', 'rbd', 'nbd', 'ssh', 'nfs', 'fuse', 'io_uring']
g_prt = p.add_argument_group(
' image protocol options',
'The following options set the IMGPROTO environment variable. '
diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
index d145f08201..da4b972ebd 100644
--- a/tests/qemu-iotests/common.rc
+++ b/tests/qemu-iotests/common.rc
@@ -290,6 +290,9 @@ if [ "$IMGOPTSSYNTAX" = "true" ]; then
elif [ "$IMGPROTO" = "fuse" ]; then
TEST_IMG_FILE=$TEST_DIR/t.$IMGFMT
TEST_IMG="$DRIVER,file.filename=$SOCK_DIR/fuse-t.$IMGFMT"
+ elif [ "$IMGPROTO" = "io_uring" ]; then
+ TEST_IMG_FILE=$TEST_DIR/t.$IMGFMT
+ TEST_IMG="$DRIVER,file.driver=$IMGPROTO,file.filename=$TEST_DIR/t.$IMGFMT"
elif [ "$IMGPROTO" = "ssh" ]; then
TEST_IMG_FILE=$TEST_DIR/t.$IMGFMT
TEST_IMG="$DRIVER,file.driver=ssh,file.host=127.0.0.1,file.path=$TEST_IMG_FILE"
@@ -309,6 +312,9 @@ else
elif [ "$IMGPROTO" = "fuse" ]; then
TEST_IMG_FILE=$TEST_DIR/t.$IMGFMT
TEST_IMG="$SOCK_DIR/fuse-t.$IMGFMT"
+ elif [ "$IMGPROTO" = "io_uring" ]; then
+ TEST_IMG_FILE=$TEST_DIR/t.$IMGFMT
+ TEST_IMG=io_uring:$TEST_DIR/t.$IMGFMT
elif [ "$IMGPROTO" = "ssh" ]; then
TEST_IMG_FILE=$TEST_DIR/t.$IMGFMT
REMOTE_TEST_DIR="ssh://\\($USER@\\)\\?127.0.0.1\\(:[0-9]\\+\\)\\?$TEST_DIR"
@@ -400,6 +406,10 @@ _test_img_to_test_img_file()
echo "$1" | sed -e "s#$SOCK_DIR/fuse-#$TEST_DIR/#"
;;
+ io_uring)
+ echo "$1" | sed -e "s#io_uring:##"
+ ;;
+
nfs)
echo "$1" | sed -e "s#nfs://127.0.0.1##"
;;
@@ -653,7 +663,7 @@ _cleanup_test_img()
FUSE_EXPORTS=()
;;
- file)
+ file|io_uring)
_rm_test_img "$TEST_DIR/t.$IMGFMT"
_rm_test_img "$TEST_DIR/t.$IMGFMT.orig"
_rm_test_img "$TEST_DIR/t.$IMGFMT.base"
--
2.41.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 6/7] iotests: add io_uring to supported protocols in 012
2023-07-25 14:19 [PATCH 0/7] iotests: add -io_uring support Stefan Hajnoczi
` (4 preceding siblings ...)
2023-07-25 14:19 ` [PATCH 5/7] iotests: add -io_uring support Stefan Hajnoczi
@ 2023-07-25 14:19 ` Stefan Hajnoczi
2023-07-25 14:19 ` [PATCH 7/7] iotests: add io_uring to supported protocols in 052 Stefan Hajnoczi
6 siblings, 0 replies; 8+ messages in thread
From: Stefan Hajnoczi @ 2023-07-25 14:19 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-block, Stefan Hajnoczi, Hanna Reitz, Kevin Wolf
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
tests/qemu-iotests/012 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/qemu-iotests/012 b/tests/qemu-iotests/012
index 3a24d2ca8d..25dfc8ae12 100755
--- a/tests/qemu-iotests/012
+++ b/tests/qemu-iotests/012
@@ -40,7 +40,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
. ./common.filter
_supported_fmt generic
-_supported_proto file
+_supported_proto file io_uring
# Remove once all tests are fixed to use TEST_IMG_FILE
# correctly and common.rc sets it unconditionally
--
2.41.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 7/7] iotests: add io_uring to supported protocols in 052
2023-07-25 14:19 [PATCH 0/7] iotests: add -io_uring support Stefan Hajnoczi
` (5 preceding siblings ...)
2023-07-25 14:19 ` [PATCH 6/7] iotests: add io_uring to supported protocols in 012 Stefan Hajnoczi
@ 2023-07-25 14:19 ` Stefan Hajnoczi
6 siblings, 0 replies; 8+ messages in thread
From: Stefan Hajnoczi @ 2023-07-25 14:19 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-block, Stefan Hajnoczi, Hanna Reitz, Kevin Wolf
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
tests/qemu-iotests/052 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/qemu-iotests/052 b/tests/qemu-iotests/052
index 2f23ac9b65..42bf4c4aef 100755
--- a/tests/qemu-iotests/052
+++ b/tests/qemu-iotests/052
@@ -38,7 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
. ./common.filter
_supported_fmt generic
-_supported_proto file
+_supported_proto file io_uring
# Don't do O_DIRECT on tmpfs
_supported_cache_modes writeback writethrough unsafe
--
2.41.0
^ permalink raw reply related [flat|nested] 8+ messages in thread