qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, vsementsov@virtuozzo.com,
	qemu-devel@nongnu.org, mreitz@redhat.com,
	andrey.shinkevich@virtuozzo.com, den@openvz.org
Subject: [PATCH v4 3/3] scripts/simplebench: add unaligned data case to bench_write_req
Date: Sun, 12 Jul 2020 20:49:18 +0300	[thread overview]
Message-ID: <1594576158-75884-4-git-send-email-andrey.shinkevich@virtuozzo.com> (raw)
In-Reply-To: <1594576158-75884-1-git-send-email-andrey.shinkevich@virtuozzo.com>

Add a test case with writhing data unaligned to the image clusters.
This case does not involve the COW optimization introduced with the
patch "qcow2: skip writing zero buffers to empty COW areas"
(git commit ID: c8bb23cbdbe32f5).

Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
---
 scripts/simplebench/bench_write_req.py | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/scripts/simplebench/bench_write_req.py b/scripts/simplebench/bench_write_req.py
index f758f90..9f3a520 100755
--- a/scripts/simplebench/bench_write_req.py
+++ b/scripts/simplebench/bench_write_req.py
@@ -58,7 +58,7 @@ def bench_write_req(qemu_img, image_name, block_size, block_offset, requests,
     image_name   -- QCOW2 image name to create
     block_size   -- size of a block to write to clusters
     block_offset -- offset of the block in clusters
-    requests     -- number of write requests per cluster
+    requests     -- number of write requests per cluster, customize if zero
     empty_image  -- if not True, fills image with random data
 
     Returns {'seconds': int} on success and {'error': str} on failure.
@@ -83,8 +83,17 @@ def bench_write_req(qemu_img, image_name, block_size, block_offset, requests,
                    f'cluster_size={cluster_size}',
                    image_name, str(image_size)]
 
-    count = requests * int(image_size / cluster_size)
-    step = str(cluster_size)
+    if requests:
+        count = requests * int(image_size / cluster_size)
+        step = str(cluster_size)
+    else:
+        # Create unaligned write requests
+        assert block_size
+        shift = int(block_size * 1.01)
+        count = int((image_size - block_offset) / shift)
+        step = str(shift)
+        depth = ['-d', '2']
+
     offset = str(block_offset)
     cnt = str(count)
     size = []
@@ -95,6 +104,8 @@ def bench_write_req(qemu_img, image_name, block_size, block_offset, requests,
                   '-S', step, '-o', offset, '-f', 'qcow2', image_name]
     if block_size:
         args_bench.extend(size)
+    if not requests:
+        args_bench.extend(depth)
 
     try:
         qemu_img_pipe(*args_create)
@@ -165,6 +176,13 @@ if __name__ == '__main__':
             'requests': 2,
             'empty_image': True
         },
+        {
+            'id': '<unaligned>',
+            'block_size': 104857600,
+            'block_offset': 524288,
+            'requests': 0,
+            'empty_image': False
+        },
     ]
 
     # Test-envs are "columns" in benchmark resulting table, 'id is a caption
-- 
1.8.3.1



      parent reply	other threads:[~2020-07-12 17:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-12 17:49 [PATCH v4 0/3] scripts/simplebench: add bench_write_req.py test Andrey Shinkevich
2020-07-12 17:49 ` [PATCH v4 1/3] scripts/simplebench: compare write request performance Andrey Shinkevich
2020-07-13 12:32   ` Vladimir Sementsov-Ogievskiy
2020-07-12 17:49 ` [PATCH v4 2/3] scripts/simplebench: allow writing to non-empty image Andrey Shinkevich
2020-07-12 17:49 ` Andrey Shinkevich [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1594576158-75884-4-git-send-email-andrey.shinkevich@virtuozzo.com \
    --to=andrey.shinkevich@virtuozzo.com \
    --cc=den@openvz.org \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=vsementsov@virtuozzo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).