qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] b70d08: qcow2: Fix the calculation of the max


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] b70d08: qcow2: Fix the calculation of the maximum L2 cache...
Date: Fri, 13 Sep 2019 06:37:26 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: b70d08205b2e4044c529eefc21df2c8ab61b473b
      
https://github.com/qemu/qemu/commit/b70d08205b2e4044c529eefc21df2c8ab61b473b
  Author: Alberto Garcia <address@hidden>
  Date:   2019-09-10 (Tue, 10 Sep 2019)

  Changed paths:
    M block/qcow2.c

  Log Message:
  -----------
  qcow2: Fix the calculation of the maximum L2 cache size

The size of the qcow2 L2 cache defaults to 32 MB, which can be easily
larger than the maximum amount of L2 metadata that the image can have.
For example: with 64 KB clusters the user would need a qcow2 image
with a virtual size of 256 GB in order to have 32 MB of L2 metadata.

Because of that, since commit b749562d9822d14ef69c9eaa5f85903010b86c30
we forbid the L2 cache to become larger than the maximum amount of L2
metadata for the image, calculated using this formula:

    uint64_t max_l2_cache = virtual_disk_size / (s->cluster_size / 8);

The problem with this formula is that the result should be rounded up
to the cluster size because an L2 table on disk always takes one full
cluster.

For example, a 1280 MB qcow2 image with 64 KB clusters needs exactly
160 KB of L2 metadata, but we need 192 KB on disk (3 clusters) even if
the last 32 KB of those are not going to be used.

However QEMU rounds the numbers down and only creates 2 cache tables
(128 KB), which is not enough for the image.

A quick test doing 4KB random writes on a 1280 MB image gives me
around 500 IOPS, while with the correct cache size I get 16K IOPS.

Cc: address@hidden
Signed-off-by: Alberto Garcia <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: bb0c94099382b52734a4a4f3c060e90c9a2ac6cf
      
https://github.com/qemu/qemu/commit/bb0c94099382b52734a4a4f3c060e90c9a2ac6cf
  Author: Vladimir Sementsov-Ogievskiy <address@hidden>
  Date:   2019-09-10 (Tue, 10 Sep 2019)

  Changed paths:
    M block/backup.c
    M block/commit.c
    M block/mirror.c
    M block/stream.c
    M blockjob.c
    M include/block/blockjob_int.h
    M include/qemu/job.h
    M job.c
    M tests/test-bdrv-drain.c
    M tests/test-block-iothread.c
    M tests/test-blockjob-txn.c
    M tests/test-blockjob.c

  Log Message:
  -----------
  job: drop job_drain

In job_finish_sync job_enter should be enough for a job to make some
progress and draining is a wrong tool for it. So use job_enter directly
here and drop job_drain with all related staff not used more.

Suggested-by: Kevin Wolf <address@hidden>
Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
Tested-by: John Snow <address@hidden>
Reviewed-by: John Snow <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: b2c6f23f4a9f6d8f1b648705cd46d3713b78d6a2
      
https://github.com/qemu/qemu/commit/b2c6f23f4a9f6d8f1b648705cd46d3713b78d6a2
  Author: Max Reitz <address@hidden>
  Date:   2019-09-10 (Tue, 10 Sep 2019)

  Changed paths:
    M block/file-posix.c

  Log Message:
  -----------
  block/file-posix: Reduce xfsctl() use

This patch removes xfs_write_zeroes() and xfs_discard().  Both functions
have been added just before the same feature was present through
fallocate():

- fallocate() has supported PUNCH_HOLE for XFS since Linux 2.6.38 (March
  2011); xfs_discard() was added in December 2010.

- fallocate() has supported ZERO_RANGE for XFS since Linux 3.15 (June
  2014); xfs_write_zeroes() was added in November 2013.

Nowadays, all systems that qemu runs on should support both fallocate()
features (RHEL 7's kernel does).

xfsctl() is still useful for getting the request alignment for O_DIRECT,
so this patch does not remove our dependency on it completely.

Note that xfs_write_zeroes() had a bug: It calls ftruncate() when the
file is shorter than the specified range (because ZERO_RANGE does not
increase the file length).  ftruncate() may yield and then discard data
that parallel write requests have written past the EOF in the meantime.
Dropping the function altogether fixes the bug.

Suggested-by: Paolo Bonzini <address@hidden>
Fixes: 50ba5b2d994853b38fed10e0841b119da0f8b8e5
Reported-by: Lukáš Doktor <address@hidden>
Cc: address@hidden
Signed-off-by: Max Reitz <address@hidden>
Reviewed-by: Stefano Garzarella <address@hidden>
Reviewed-by: John Snow <address@hidden>
Tested-by: Stefano Garzarella <address@hidden>
Tested-by: John Snow <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: ae6ef0190981a21f2d4bc8dcee7253688f14fae7
      
https://github.com/qemu/qemu/commit/ae6ef0190981a21f2d4bc8dcee7253688f14fae7
  Author: Max Reitz <address@hidden>
  Date:   2019-09-10 (Tue, 10 Sep 2019)

  Changed paths:
    A tests/qemu-iotests/265
    A tests/qemu-iotests/265.out
    M tests/qemu-iotests/group

  Log Message:
  -----------
  iotests: Test reverse sub-cluster qcow2 writes

This exercises the regression introduced in commit
50ba5b2d994853b38fed10e0841b119da0f8b8e5.  On my machine, it has close
to a 50 % false-negative rate, but that should still be sufficient to
test the fix.

Signed-off-by: Max Reitz <address@hidden>
Reviewed-by: Stefano Garzarella <address@hidden>
Reviewed-by: John Snow <address@hidden>
Tested-by: Stefano Garzarella <address@hidden>
Tested-by: John Snow <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 6b9d62c2a9e83bbad73fb61406f0ff69b46ff6f3
      
https://github.com/qemu/qemu/commit/6b9d62c2a9e83bbad73fb61406f0ff69b46ff6f3
  Author: Markus Armbruster <address@hidden>
  Date:   2019-09-10 (Tue, 10 Sep 2019)

  Changed paths:
    M scsi/pr-manager.c

  Log Message:
  -----------
  pr-manager: Fix invalid g_free() crash bug

pr_manager_worker() passes its @opaque argument to g_free().  Wrong;
it points to pr_manager_worker()'s automatic @data.  Broken when
commit 2f3a7ab39be converted @data from heap- to stack-allocated.  Fix
by deleting the g_free().

Fixes: 2f3a7ab39bec4ba8022dc4d42ea641165b004e3e
Cc: address@hidden
Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Acked-by: Paolo Bonzini <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: effecce6bcb830a661c882d7299b53382b56a131
      
https://github.com/qemu/qemu/commit/effecce6bcb830a661c882d7299b53382b56a131
  Author: Kevin Wolf <address@hidden>
  Date:   2019-09-10 (Tue, 10 Sep 2019)

  Changed paths:
    M block/file-posix.c

  Log Message:
  -----------
  file-posix: Fix has_write_zeroes after NO_FALLBACK

If QEMU_AIO_NO_FALLBACK is given, we always return failure and don't
even try to use the BLKZEROOUT ioctl. In this failure case, we shouldn't
disable has_write_zeroes because we didn't learn anything about the
ioctl. The next request might not set QEMU_AIO_NO_FALLBACK and we can
still use the ioctl then.

Fixes: 738301e1175
Reported-by: Eric Blake <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Eric Blake <address@hidden>


  Commit: 1a37e3124407b5a145d44478d3ecbdb89c63789f
      
https://github.com/qemu/qemu/commit/1a37e3124407b5a145d44478d3ecbdb89c63789f
  Author: Max Reitz <address@hidden>
  Date:   2019-09-10 (Tue, 10 Sep 2019)

  Changed paths:
    M block/vpc.c

  Log Message:
  -----------
  vpc: Return 0 from vpc_co_create() on success

blockdev_create_run() directly uses .bdrv_co_create()'s return value as
the job's return value.  Jobs must return 0 on success, not just any
nonnegative value.  Therefore, using blockdev-create for VPC images may
currently fail as the vpc driver may return a positive integer.

Because there is no point in returning a positive integer anywhere in
the block layer (all non-negative integers are generally treated as
complete success), we probably do not want to add more such cases.
Therefore, fix this problem by making the vpc driver always return 0 in
case of success.

Suggested-by: Kevin Wolf <address@hidden>
Cc: address@hidden
Signed-off-by: Max Reitz <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 88d2aa533a4a1aad44a27c2e6cd5bc5fbcbce7ed
      
https://github.com/qemu/qemu/commit/88d2aa533a4a1aad44a27c2e6cd5bc5fbcbce7ed
  Author: Max Reitz <address@hidden>
  Date:   2019-09-10 (Tue, 10 Sep 2019)

  Changed paths:
    M tests/qemu-iotests/iotests.py

  Log Message:
  -----------
  iotests: Add supported protocols to execute_test()

Signed-off-by: Max Reitz <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 103cbc771e5660d1f5bb458be80aa9e363547ae0
      
https://github.com/qemu/qemu/commit/103cbc771e5660d1f5bb458be80aa9e363547ae0
  Author: Max Reitz <address@hidden>
  Date:   2019-09-10 (Tue, 10 Sep 2019)

  Changed paths:
    M tests/qemu-iotests/030
    M tests/qemu-iotests/040
    M tests/qemu-iotests/041
    M tests/qemu-iotests/044
    M tests/qemu-iotests/045
    M tests/qemu-iotests/055
    M tests/qemu-iotests/056
    M tests/qemu-iotests/057
    M tests/qemu-iotests/065
    M tests/qemu-iotests/096
    M tests/qemu-iotests/118
    M tests/qemu-iotests/124
    M tests/qemu-iotests/129
    M tests/qemu-iotests/132
    M tests/qemu-iotests/139
    M tests/qemu-iotests/148
    M tests/qemu-iotests/151
    M tests/qemu-iotests/152
    M tests/qemu-iotests/155
    M tests/qemu-iotests/163
    M tests/qemu-iotests/165
    M tests/qemu-iotests/169
    M tests/qemu-iotests/196
    M tests/qemu-iotests/199
    M tests/qemu-iotests/245
    M tests/qemu-iotests/257

  Log Message:
  -----------
  iotests: Restrict file Python tests to file

Most of our Python unittest-style tests only support the file protocol.
You can run them with any other protocol, but the test will simply
ignore your choice and use file anyway.

We should let them signal that they require the file protocol so they
are skipped when you want to test some other protocol.

Signed-off-by: Max Reitz <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 7c932a1d69a6d6ac5c0b615c11d191da3bbe9aa8
      
https://github.com/qemu/qemu/commit/7c932a1d69a6d6ac5c0b615c11d191da3bbe9aa8
  Author: Max Reitz <address@hidden>
  Date:   2019-09-10 (Tue, 10 Sep 2019)

  Changed paths:
    M tests/qemu-iotests/147
    M tests/qemu-iotests/205

  Log Message:
  -----------
  iotests: Restrict nbd Python tests to nbd

We have two Python unittest-style tests that test NBD.  As such, they
should specify supported_protocols=['nbd'] so they are skipped when the
user wants to test some other protocol.

Furthermore, we should restrict their choice of formats to 'raw'.  The
idea of a protocol/format combination is to use some format over some
protocol; but we always use the raw format over NBD.  It does not really
matter what the NBD server uses on its end, and it is not a useful test
of the respective format driver anyway.

Signed-off-by: Max Reitz <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: cb73747e1a47b93d3dfdc3f769c576b053916938
      
https://github.com/qemu/qemu/commit/cb73747e1a47b93d3dfdc3f769c576b053916938
  Author: Max Reitz <address@hidden>
  Date:   2019-09-10 (Tue, 10 Sep 2019)

  Changed paths:
    A tests/qemu-iotests/266
    A tests/qemu-iotests/266.out
    M tests/qemu-iotests/group

  Log Message:
  -----------
  iotests: Test blockdev-create for vpc

Signed-off-by: Max Reitz <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: d885ac33cfc30a14e0f68c227865910257fd2c44
      
https://github.com/qemu/qemu/commit/d885ac33cfc30a14e0f68c227865910257fd2c44
  Author: Vladimir Sementsov-Ogievskiy <address@hidden>
  Date:   2019-09-10 (Tue, 10 Sep 2019)

  Changed paths:
    M tests/qemu-iotests/232

  Log Message:
  -----------
  iotests: skip 232 when run tests as root

chmod a-w don't help under root, so skip the test in such case.

Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 601dc6559725f7a614b6f893611e17ff0908e914
      
https://github.com/qemu/qemu/commit/601dc6559725f7a614b6f893611e17ff0908e914
  Author: Peter Lieven <address@hidden>
  Date:   2019-09-13 (Fri, 13 Sep 2019)

  Changed paths:
    M block/nfs.c

  Log Message:
  -----------
  block/nfs: tear down aio before nfs_close

nfs_close is a sync call from libnfs and has its own event
handler polling on the nfs FD. Avoid that both QEMU and libnfs
are intefering here.

CC: address@hidden
Signed-off-by: Peter Lieven <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: d2c6becbe03e0f4121ce9128e5c84714a51308da
      
https://github.com/qemu/qemu/commit/d2c6becbe03e0f4121ce9128e5c84714a51308da
  Author: Peter Lieven <address@hidden>
  Date:   2019-09-13 (Fri, 13 Sep 2019)

  Changed paths:
    M block/nfs.c

  Log Message:
  -----------
  block/nfs: add support for nfs_umount

libnfs recently added support for unmounting. Add support
in Qemu too.

Signed-off-by: Peter Lieven <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 036d8cbffd7785052d511f5cc83b969f0e827be1
      
https://github.com/qemu/qemu/commit/036d8cbffd7785052d511f5cc83b969f0e827be1
  Author: Andrey Shinkevich <address@hidden>
  Date:   2019-09-13 (Fri, 13 Sep 2019)

  Changed paths:
    M tests/qemu-iotests/039.out
    M tests/qemu-iotests/061.out
    M tests/qemu-iotests/137.out
    M tests/qemu-iotests/common.rc

  Log Message:
  -----------
  iotests: allow Valgrind checking all QEMU processes

With the '-valgrind' option, let all the QEMU processes be run under
the Valgrind tool. The Valgrind own parameters may be set with its
environment variable VALGRIND_OPTS, e.g.
$ VALGRIND_OPTS="--leak-check=yes" ./check -valgrind <test#>
or they may be listed in the Valgrind checked file ./.valgrindrc or
~/.valgrindrc like
--memcheck:leak-check=no
--memcheck:track-origins=yes
To exclude a specific process from running under the Valgrind, the
corresponding environment variable VALGRIND_QEMU_<name> is to be set
to the empty string:
$ VALGRIND_QEMU_IO= ./check -valgrind <test#>
When QEMU-IO process is being killed, the shell report refers to the
text of the command in _qemu_io_wrapper(), which was modified with this
patch. So, the benchmark output for the tests 039, 061 and 137 is to be
changed also.

Signed-off-by: Andrey Shinkevich <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 8af224d66b1c259d19d5edbb8ac3d93627c3492a
      
https://github.com/qemu/qemu/commit/8af224d66b1c259d19d5edbb8ac3d93627c3492a
  Author: Andrey Shinkevich <address@hidden>
  Date:   2019-09-13 (Fri, 13 Sep 2019)

  Changed paths:
    M tests/qemu-iotests/039
    M tests/qemu-iotests/061
    M tests/qemu-iotests/137
    M tests/qemu-iotests/common.rc

  Log Message:
  -----------
  iotests: exclude killed processes from running under Valgrind

 The Valgrind tool fails to manage its termination in multi-threaded
 processes when they raise the signal SIGKILL. The bug has been reported
 to the Valgrind maintainers and was registered as the bug #409141:
 https://bugs.kde.org/show_bug.cgi?id=409141
 Let's exclude such test cases from running under the Valgrind until a
 new version with the bug fix is released because checking for the
 memory issues is covered by other test cases.

Suggested-by: John Snow <address@hidden>
Signed-off-by: Andrey Shinkevich <address@hidden>
Reviewed-by: John Snow <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 5ff1c2c830c711a6d2b2054a6a6eb8469b8c922f
      
https://github.com/qemu/qemu/commit/5ff1c2c830c711a6d2b2054a6a6eb8469b8c922f
  Author: Andrey Shinkevich <address@hidden>
  Date:   2019-09-13 (Fri, 13 Sep 2019)

  Changed paths:
    M tests/qemu-iotests/common.rc

  Log Message:
  -----------
  iotests: Add casenotrun report to bash tests

The new function _casenotrun() is to be invoked if a test case cannot
be run for some reason. The user will be notified by a message passed
to the function. It is the caller's responsibility to make skipped a
particular test.

Suggested-by: Kevin Wolf <address@hidden>
Signed-off-by: Andrey Shinkevich <address@hidden>
Reviewed-by: John Snow <address@hidden>
Reviewed-by: Cleber Rosa <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: ad20319a913f4492039a9588158ceca37eb97b6c
      
https://github.com/qemu/qemu/commit/ad20319a913f4492039a9588158ceca37eb97b6c
  Author: Andrey Shinkevich <address@hidden>
  Date:   2019-09-13 (Fri, 13 Sep 2019)

  Changed paths:
    M tests/qemu-iotests/051

  Log Message:
  -----------
  iotests: Valgrind fails with nonexistent directory

The Valgrind uses the exported variable TMPDIR and fails if the
directory does not exist. Let us exclude such a test case from
being run under the Valgrind and notify the user of it.

Suggested-by: Kevin Wolf <address@hidden>
Signed-off-by: Andrey Shinkevich <address@hidden>
Reviewed-by: John Snow <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: fbd1c378385f5405f9d6178e4662bf8744653e8d
      
https://github.com/qemu/qemu/commit/fbd1c378385f5405f9d6178e4662bf8744653e8d
  Author: Andrey Shinkevich <address@hidden>
  Date:   2019-09-13 (Fri, 13 Sep 2019)

  Changed paths:
    M tests/qemu-iotests/028
    M tests/qemu-iotests/183
    M tests/qemu-iotests/192

  Log Message:
  -----------
  iotests: extended timeout under Valgrind

As the iotests run longer under the Valgrind, the QEMU_COMM_TIMEOUT is
to be increased in the test cases 028, 183 and 192 when running under
the Valgrind.

Suggested-by: Roman Kagan <address@hidden>
Signed-off-by: Andrey Shinkevich <address@hidden>
Reviewed-by: Vladimir Sementsov-Ogievskiy <address@hidden>
Reviewed-by: John Snow <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 4e08bee46709f07e597431a75aa5efec9866bf9f
      
https://github.com/qemu/qemu/commit/4e08bee46709f07e597431a75aa5efec9866bf9f
  Author: Andrey Shinkevich <address@hidden>
  Date:   2019-09-13 (Fri, 13 Sep 2019)

  Changed paths:
    M tests/qemu-iotests/247

  Log Message:
  -----------
  iotests: extend sleeping time under Valgrind

To synchronize the time when QEMU is running longer under the Valgrind,
increase the sleeping time in the test 247.

Signed-off-by: Andrey Shinkevich <address@hidden>
Reviewed-by: Vladimir Sementsov-Ogievskiy <address@hidden>
Reviewed-by: John Snow <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: c8e68b43e11b003a4fcd6d61af448967d7a66631
      
https://github.com/qemu/qemu/commit/c8e68b43e11b003a4fcd6d61af448967d7a66631
  Author: Kevin Wolf <address@hidden>
  Date:   2019-09-13 (Fri, 13 Sep 2019)

  Changed paths:
    M qemu-io-cmds.c

  Log Message:
  -----------
  qemu-io: Don't leak pattern file in error path

qemu_io_alloc_from_file() needs to close the pattern file even if some
error occurred.

Setting f = NULL in the success path and checking it for NULL in the
error path isn't strictly necessary at this point, but let's do it
anyway in case someone later adds a 'goto error' after closing the file.

Coverity: CID 1405303
Fixes: 4d731510d34f280ed45a6de621d016f67a49ea48
Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Max Reitz <address@hidden>
Reviewed-by: Stefano Garzarella <address@hidden>


  Commit: d90d5cae2b10efc0e8d0b3cc91ff16201853d3ba
      
https://github.com/qemu/qemu/commit/d90d5cae2b10efc0e8d0b3cc91ff16201853d3ba
  Author: Philippe Mathieu-Daudé <address@hidden>
  Date:   2019-09-13 (Fri, 13 Sep 2019)

  Changed paths:
    M block/create.c

  Log Message:
  -----------
  block/create: Do not abort if a block driver is not available

The 'blockdev-create' QMP command was introduced as experimental
feature in commit b0292b851b8, using the assert() debug call.
It got promoted to 'stable' command in 3fb588a0f2c, but the
assert call was not removed.

Some block drivers are optional, and bdrv_find_format() might
return a NULL value, triggering the assertion.

Stable code is not expected to abort, so return an error instead.

This is easily reproducible when libnfs is not installed:

  ./configure
  [...]
  module support    no
  Block whitelist (rw)
  Block whitelist (ro)
  libiscsi support  yes
  libnfs support    no
  [...]

Start QEMU:

  $ qemu-system-x86_64 -S -qmp unix:/tmp/qemu.qmp,server,nowait

Send the 'blockdev-create' with the 'nfs' driver:

  $ ( cat << 'EOF'
  {'execute': 'qmp_capabilities'}
  {'execute': 'blockdev-create', 'arguments': {'job-id': 'x', 'options': 
{'size': 0, 'driver': 'nfs', 'location': {'path': '/', 'server': {'host': 
'::1', 'type': 'inet'}}}}, 'id': 'x'}
  EOF
  ) | socat STDIO UNIX:/tmp/qemu.qmp
  {"QMP": {"version": {"qemu": {"micro": 50, "minor": 1, "major": 4}, 
"package": "v4.1.0-733-g89ea03a7dc"}, "capabilities": ["oob"]}}
  {"return": {}}

QEMU crashes:

  $ gdb qemu-system-x86_64 core
  Program received signal SIGSEGV, Segmentation fault.
  (gdb) bt
  #0  0x00007ffff510957f in raise () at /lib64/libc.so.6
  #1  0x00007ffff50f3895 in abort () at /lib64/libc.so.6
  #2  0x00007ffff50f3769 in _nl_load_domain.cold.0 () at /lib64/libc.so.6
  #3  0x00007ffff5101a26 in .annobin_assert.c_end () at /lib64/libc.so.6
  #4  0x0000555555d7e1f1 in qmp_blockdev_create (job_id=0x555556baee40 "x", 
options=0x555557666610, errp=0x7fffffffc770) at block/create.c:69
  #5  0x0000555555c96b52 in qmp_marshal_blockdev_create (args=0x7fffdc003830, 
ret=0x7fffffffc7f8, errp=0x7fffffffc7f0) at qapi/qapi-commands-block-core.c:1314
  #6  0x0000555555deb0a0 in do_qmp_dispatch (cmds=0x55555645de70 
<qmp_commands>, request=0x7fffdc005c70, allow_oob=false, errp=0x7fffffffc898) 
at qapi/qmp-dispatch.c:131
  #7  0x0000555555deb2a1 in qmp_dispatch (cmds=0x55555645de70 <qmp_commands>, 
request=0x7fffdc005c70, allow_oob=false) at qapi/qmp-dispatch.c:174

With this patch applied, QEMU returns a QMP error:

  {'execute': 'blockdev-create', 'arguments': {'job-id': 'x', 'options': 
{'size': 0, 'driver': 'nfs', 'location': {'path': '/', 'server': {'host': 
'::1', 'type': 'inet'}}}}, 'id': 'x'}
  {"id": "x", "error": {"class": "GenericError", "desc": "Block driver 'nfs' 
not found or not supported"}}

Cc: address@hidden
Reported-by: Xu Tian <address@hidden>
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: John Snow <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: bf3d78ae55ccb276f318168d39d17a36f25221b4
      
https://github.com/qemu/qemu/commit/bf3d78ae55ccb276f318168d39d17a36f25221b4
  Author: Alberto Garcia <address@hidden>
  Date:   2019-09-13 (Fri, 13 Sep 2019)

  Changed paths:
    M block/qcow2-cluster.c

  Log Message:
  -----------
  qcow2: Stop overwriting compressed clusters one by one

handle_alloc() tries to find as many contiguous clusters that need
copy-on-write as possible in order to allocate all of them at the same
time.

However, compressed clusters are only overwritten one by one, so let's
say that we have an image with 1024 consecutive compressed clusters:

   qemu-img create -f qcow2 hd.qcow2 64M
   for f in `seq 0 64 65472`; do
      qemu-io -c "write -c ${f}k 64k" hd.qcow2
   done

In this case trying to overwrite the whole image with one large write
request results in 1024 separate allocations:

   qemu-io -c "write 0 64M" hd.qcow2

This restriction comes from commit 095a9c58ce12afeeb90c2 from 2008.
Nowadays QEMU can overwrite multiple compressed clusters just fine,
and in fact it already does: as long as the first cluster that
handle_alloc() finds is not compressed, all other compressed clusters
in the same batch will be overwritten in one go:

   qemu-img create -f qcow2 hd.qcow2 64M
   qemu-io -c "write -z 0 64k" hd.qcow2
   for f in `seq 64 64 65472`; do
      qemu-io -c "write -c ${f}k 64k" hd.qcow2
   done

Compared to the previous one, overwriting this image on my computer
goes from 8.35s down to 230ms.

Signed-off-by: Alberto Garcia <address@hidden>
Reviewed-by: John Snow <address@hidden
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 3d9442ee1d78f7f138dcd6c85c7acad0153d2f11
      
https://github.com/qemu/qemu/commit/3d9442ee1d78f7f138dcd6c85c7acad0153d2f11
  Author: Peter Maydell <address@hidden>
  Date:   2019-09-13 (Fri, 13 Sep 2019)

  Changed paths:
    M block/backup.c
    M block/commit.c
    M block/create.c
    M block/file-posix.c
    M block/mirror.c
    M block/nfs.c
    M block/qcow2-cluster.c
    M block/qcow2.c
    M block/stream.c
    M block/vpc.c
    M blockjob.c
    M include/block/blockjob_int.h
    M include/qemu/job.h
    M job.c
    M qemu-io-cmds.c
    M scsi/pr-manager.c
    M tests/qemu-iotests/028
    M tests/qemu-iotests/030
    M tests/qemu-iotests/039
    M tests/qemu-iotests/039.out
    M tests/qemu-iotests/040
    M tests/qemu-iotests/041
    M tests/qemu-iotests/044
    M tests/qemu-iotests/045
    M tests/qemu-iotests/051
    M tests/qemu-iotests/055
    M tests/qemu-iotests/056
    M tests/qemu-iotests/057
    M tests/qemu-iotests/061
    M tests/qemu-iotests/061.out
    M tests/qemu-iotests/065
    M tests/qemu-iotests/096
    M tests/qemu-iotests/118
    M tests/qemu-iotests/124
    M tests/qemu-iotests/129
    M tests/qemu-iotests/132
    M tests/qemu-iotests/137
    M tests/qemu-iotests/137.out
    M tests/qemu-iotests/139
    M tests/qemu-iotests/147
    M tests/qemu-iotests/148
    M tests/qemu-iotests/151
    M tests/qemu-iotests/152
    M tests/qemu-iotests/155
    M tests/qemu-iotests/163
    M tests/qemu-iotests/165
    M tests/qemu-iotests/169
    M tests/qemu-iotests/183
    M tests/qemu-iotests/192
    M tests/qemu-iotests/196
    M tests/qemu-iotests/199
    M tests/qemu-iotests/205
    M tests/qemu-iotests/232
    M tests/qemu-iotests/245
    M tests/qemu-iotests/247
    M tests/qemu-iotests/257
    A tests/qemu-iotests/265
    A tests/qemu-iotests/265.out
    A tests/qemu-iotests/266
    A tests/qemu-iotests/266.out
    M tests/qemu-iotests/common.rc
    M tests/qemu-iotests/group
    M tests/qemu-iotests/iotests.py
    M tests/test-bdrv-drain.c
    M tests/test-block-iothread.c
    M tests/test-blockjob-txn.c
    M tests/test-blockjob.c

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging

Block layer patches:

- qcow2: Allow overwriting multiple compressed clusters at once for
  better performance
- nfs: add support for nfs_umount
- file-posix: write_zeroes fixes
- qemu-io, blockdev-create, pr-manager: Fix crashes and memory leaks
- qcow2: Fix the calculation of the maximum L2 cache size
- vpc: Fix return code for vpc_co_create()
- blockjob: Code cleanup
- iotests improvements (e.g. for use with valgrind)

# gpg: Signature made Fri 13 Sep 2019 11:19:19 BST
# gpg:                using RSA key 7F09B272C88F2FD6
# gpg: Good signature from "Kevin Wolf <address@hidden>" [full]
# Primary key fingerprint: DC3D EB15 9A9A F95D 3D74  56FE 7F09 B272 C88F 2FD6

* remotes/kevin/tags/for-upstream: (23 commits)
  qcow2: Stop overwriting compressed clusters one by one
  block/create: Do not abort if a block driver is not available
  qemu-io: Don't leak pattern file in error path
  iotests: extend sleeping time under Valgrind
  iotests: extended timeout under Valgrind
  iotests: Valgrind fails with nonexistent directory
  iotests: Add casenotrun report to bash tests
  iotests: exclude killed processes from running under Valgrind
  iotests: allow Valgrind checking all QEMU processes
  block/nfs: add support for nfs_umount
  block/nfs: tear down aio before nfs_close
  iotests: skip 232 when run tests as root
  iotests: Test blockdev-create for vpc
  iotests: Restrict nbd Python tests to nbd
  iotests: Restrict file Python tests to file
  iotests: Add supported protocols to execute_test()
  vpc: Return 0 from vpc_co_create() on success
  file-posix: Fix has_write_zeroes after NO_FALLBACK
  pr-manager: Fix invalid g_free() crash bug
  iotests: Test reverse sub-cluster qcow2 writes
  ...

Signed-off-by: Peter Maydell <address@hidden>


Compare: https://github.com/qemu/qemu/compare/cc9c8b82669e...3d9442ee1d78



reply via email to

[Prev in Thread] Current Thread [Next in Thread]