Skip to contentSkip to conversation

Block patches

GIT PULL Applied Stefan Hajnoczi 2 participants 7 messages Aug 5, 2016 Block layer

lore
Share & tools
lore
#0 lore raw

The following changes since commit 42e0d60f1615ef63d16e41bb1668805560c37870:

Merge remote-tracking branch 'remotes/riku/tags/pull-linux-user-20160804' into staging (2016-08-04 18:36:05 +0100)

are available in the git repository at:

git://github.com/stefanha/qemu.git tags/block-pull-request

for you to fetch changes up to 27d1b87688dcea8702f06b5240abf6b8d8f53346:

virtio-blk: Remove stale comment about draining (2016-08-05 09:59:06 +0100)

----------------------------------------------------------------

----------------------------------------------------------------

Alberto Garcia (2):
throttle: Don't allow burst limits to be lower than the normal limits
throttle: Test burst limits lower than the normal limits

Fam Zheng (2):
virtio-blk: Release s->rq queue at system_reset
virtio-blk: Remove stale comment about draining

Klim Kireev (1):
block/parallels: check new image size

 block/parallels.c     |  5 +++++
 hw/block/virtio-blk.c | 13 +++++++++----
 tests/test-throttle.c |  8 ++++++++
 util/throttle.c       |  5 +++++
 4 files changed, 27 insertions(+), 4 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

[Qemu-devel] [PULL for-2.7 1/5] block/parallels: check new image size

From: Klim Kireev <[email protected]>

Before this patch incorrect image could be created via qemu-img (Example: qemu-img create -f parallels -o size=4096T hack.img), incorrect images cannot be used due to overflow in main image structure.

This patch add check of size in image creation.

After reading size it compare it with UINT32_MAX * cluster_size.

Message-id: [email protected]

---
 block/parallels.c | 5 +++++
 1 file changed, 5 insertions(+)
block/parallels.c +5 -0
index 807a801..2ccefa7 100644
@@ -43,6 +43,7 @@
 #define HEADER_MAGIC2 "WithouFreSpacExt"
 #define HEADER_VERSION 2
 #define HEADER_INUSE_MAGIC  (0x746F6E59)
+#define MAX_PARALLELS_IMAGE_FACTOR (1ull << 32)
 
 #define DEFAULT_CLUSTER_SIZE 1048576        /* 1 MiB */
 
@@ -475,6 +476,10 @@ static int parallels_create(const char *filename, QemuOpts *opts, Error **errp)
                           BDRV_SECTOR_SIZE);
     cl_size = ROUND_UP(qemu_opt_get_size_del(opts, BLOCK_OPT_CLUSTER_SIZE,
                           DEFAULT_CLUSTER_SIZE), BDRV_SECTOR_SIZE);
+    if (total_size >= MAX_PARALLELS_IMAGE_FACTOR * cl_size) {
+        error_propagate(errp, local_err);
+        return -E2BIG;
+    }
 
     ret = bdrv_create_file(filename, opts, &local_err);
     if (ret < 0) {
Signature · 1 line
2.7.4
#2 lore raw

[Qemu-devel] [PULL for-2.7 2/5] throttle: Don't allow burst limits to be lower than the normal limits

In reply to Stefan Hajnoczi

From: Alberto Garcia <[email protected]>

Setting FOO_max to a value that is lower than FOO does not make sense, and it produces odd results depending on the value of FOO_max_length. Although the user should not set that configuration in the first place it's better to reject it explicitly.

https://bugzilla.redhat.com/show_bug.cgi?id=1355665

Message-id: 663d5aca406060e31f80d8113f77b6feee63b919.1469693110.git.berto@igalia.com

---
 util/throttle.c | 5 +++++
 1 file changed, 5 insertions(+)
util/throttle.c +5 -0
index 654f95c..3817d9b 100644
@@ -348,6 +348,11 @@ bool throttle_is_valid(ThrottleConfig *cfg, Error **errp)
                        " bps/iops values");
             return false;
         }
+
+        if (cfg->buckets[i].max && cfg->buckets[i].max < cfg->buckets[i].avg) {
+            error_setg(errp, "bps_max/iops_max cannot be lower than bps/iops");
+            return false;
+        }
     }
 
     return true;
Signature · 1 line
2.7.4
#3 lore raw

[Qemu-devel] [PULL for-2.7 3/5] throttle: Test burst limits lower than the normal limits

In reply to Stefan Hajnoczi

From: Alberto Garcia <[email protected]>

This checks that making FOO_max lower than FOO is not allowed.

We could also forbid having FOO_max == FOO, but that doesn't have any odd side effects and it would require us to update several other tests, so let's keep it simple.

Message-id: 2f90f9ee58aa14b7bd985f67c5996b06e0ab6c19.1469693110.git.berto@igalia.com

---
 tests/test-throttle.c | 8 ++++++++
 1 file changed, 8 insertions(+)
tests/test-throttle.c +8 -0
index afe094b..363b59a 100644
@@ -394,6 +394,14 @@ static void test_max_is_missing_limit(void)
         cfg.buckets[i].max = 0;
         cfg.buckets[i].avg = 100;
         g_assert(throttle_is_valid(&cfg, NULL));
+
+        cfg.buckets[i].max = 30;
+        cfg.buckets[i].avg = 100;
+        g_assert(!throttle_is_valid(&cfg, NULL));
+
+        cfg.buckets[i].max = 100;
+        cfg.buckets[i].avg = 100;
+        g_assert(throttle_is_valid(&cfg, NULL));
     }
 }
 
Signature · 1 line
2.7.4
#4 lore raw

[Qemu-devel] [PULL for-2.7 4/5] virtio-blk: Release s->rq queue at system_reset

In reply to Stefan Hajnoczi

From: Fam Zheng <[email protected]>

At system_reset, there is no point in retrying the queued request, because the driver that issued the request won't be around any more.

Message-id: [email protected]

---
 hw/block/virtio-blk.c | 9 +++++++++
 1 file changed, 9 insertions(+)
hw/block/virtio-blk.c +9 -0
index 475a822..1e348b1 100644
@@ -654,6 +654,7 @@ static void virtio_blk_reset(VirtIODevice *vdev)
 {
     VirtIOBlock *s = VIRTIO_BLK(vdev);
     AioContext *ctx;
+    VirtIOBlockReq *req;
 
     /*
      * This should cancel pending requests, but can't do nicely until there
@@ -663,6 +664,14 @@ static void virtio_blk_reset(VirtIODevice *vdev)
     aio_context_acquire(ctx);
     blk_drain(s->blk);
 
+    /* We drop queued requests after blk_drain() because blk_drain() itself can
+     * produce them. */
+    while (s->rq) {
+        req = s->rq;
+        s->rq = req->next;
+        virtio_blk_free_request(req);
+    }
+
     if (s->dataplane) {
         virtio_blk_data_plane_stop(s->dataplane);
     }
Signature · 1 line
2.7.4
#5 lore raw

[Qemu-devel] [PULL for-2.7 5/5] virtio-blk: Remove stale comment about draining

In reply to Stefan Hajnoczi

From: Fam Zheng <[email protected]>

This is stale after commit 6e40b3bf (virtio-blk: Use blk_drain() to drain IO requests), remove it.

Message-id: [email protected]

---
 hw/block/virtio-blk.c | 4 ----
 1 file changed, 4 deletions(-)
hw/block/virtio-blk.c +0 -4
index 1e348b1..331d766 100644
@@ -656,10 +656,6 @@ static void virtio_blk_reset(VirtIODevice *vdev)
     AioContext *ctx;
     VirtIOBlockReq *req;
 
-    /*
-     * This should cancel pending requests, but can't do nicely until there
-     * are per-device request lists.
-     */
     ctx = blk_get_aio_context(s->blk);
     aio_context_acquire(ctx);
     blk_drain(s->blk);
Signature · 1 line
2.7.4
#6 lore raw
In reply to Stefan Hajnoczi
Quoted 6 lines · Stefan Hajnoczi

The following changes since commit 42e0d60f1615ef63d16e41bb1668805560c37870:

Merge remote-tracking branch 'remotes/riku/tags/pull-linux-user-20160804' into staging (2016-08-04 18:36:05 +0100)

are available in the git repository at:

Quoted 7 lines

git://github.com/stefanha/qemu.git tags/block-pull-request

for you to fetch changes up to 27d1b87688dcea8702f06b5240abf6b8d8f53346:

virtio-blk: Remove stale comment about draining (2016-08-05 09:59:06 +0100)

----------------------------------------------------------------

Applied, thanks.

-- PMM