mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
Merge tag 'block-pull-request' of https://gitlab.com/stefanha/qemu into staging
Pull request A few fixes that I've picked up. # -----BEGIN PGP SIGNATURE----- # # iQEzBAABCAAdFiEEhpWov9P5fNqsNXdanKSrs4Grc8gFAmPlEFsACgkQnKSrs4Gr # c8h3OggAj5TeIB/R6F69vHIuoqogJELm5jVkPoXd1VK+nAayEXHFmEfUi72JIh62 # l8E4NOuUIxwSXdD2HLH/CpezBh5EVW/LJ9AfRUXCWV65KL92dkZoQyxonNQMKdQ3 # pxj7zwHrlsdORPfRSnFVaGksaIdePgj46CjSQh8IF8RMvYMVF9hG3ias7rT+EWi7 # SidPse4tik3WPxWteEXQd/8fdUehloPOB6Xm8pFilr0oR/TlRyMRWeaUs5+6WUIy # y1+mqObsY22DvIDqsqTbZDULnHXAI5zxy9gwHi+DhRi3DbuAxdjH1Vclk0Y9wsGY # QKhoFtGhfOd+94uSusp5UbG5iNvbuQ== # =HZZr # -----END PGP SIGNATURE----- # gpg: Signature made Thu 09 Feb 2023 15:25:15 GMT # gpg: using RSA key 8695A8BFD3F97CDAAC35775A9CA4ABB381AB73C8 # gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" [full] # gpg: aka "Stefan Hajnoczi <stefanha@gmail.com>" [full] # Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35 775A 9CA4 ABB3 81AB 73C8 * tag 'block-pull-request' of https://gitlab.com/stefanha/qemu: iotests/detect-zeroes-registered-buf: add new test qemu-io: add -r option to register I/O buffer qemu-io: use BdrvRequestFlags instead of int block: fix detect-zeroes= with BDRV_REQ_REGISTERED_BUF virtio-blk: add missing AioContext lock vhost-user-fs: Back up vqs before cleaning up vhost_dev Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
@@ -1926,6 +1926,9 @@ static int coroutine_fn bdrv_aligned_pwritev(BdrvChild *child,
|
||||
if (bs->detect_zeroes == BLOCKDEV_DETECT_ZEROES_OPTIONS_UNMAP) {
|
||||
flags |= BDRV_REQ_MAY_UNMAP;
|
||||
}
|
||||
|
||||
/* Can't use optimization hint with bufferless zero write */
|
||||
flags &= ~BDRV_REQ_REGISTERED_BUF;
|
||||
}
|
||||
|
||||
if (ret < 0) {
|
||||
|
||||
@@ -894,6 +894,10 @@ static void virtio_blk_update_config(VirtIODevice *vdev, uint8_t *config)
|
||||
uint64_t capacity;
|
||||
int64_t length;
|
||||
int blk_size = conf->logical_block_size;
|
||||
AioContext *ctx;
|
||||
|
||||
ctx = blk_get_aio_context(s->blk);
|
||||
aio_context_acquire(ctx);
|
||||
|
||||
blk_get_geometry(s->blk, &capacity);
|
||||
memset(&blkcfg, 0, sizeof(blkcfg));
|
||||
@@ -917,6 +921,7 @@ static void virtio_blk_update_config(VirtIODevice *vdev, uint8_t *config)
|
||||
* per track (cylinder).
|
||||
*/
|
||||
length = blk_getlength(s->blk);
|
||||
aio_context_release(ctx);
|
||||
if (length > 0 && length / conf->heads / conf->secs % blk_size) {
|
||||
blkcfg.geometry.sectors = conf->secs & ~s->sector_mask;
|
||||
} else {
|
||||
|
||||
@@ -273,6 +273,7 @@ static void vuf_device_unrealize(DeviceState *dev)
|
||||
{
|
||||
VirtIODevice *vdev = VIRTIO_DEVICE(dev);
|
||||
VHostUserFS *fs = VHOST_USER_FS(dev);
|
||||
struct vhost_virtqueue *vhost_vqs = fs->vhost_dev.vqs;
|
||||
int i;
|
||||
|
||||
/* This will stop vhost backend if appropriate. */
|
||||
@@ -288,8 +289,7 @@ static void vuf_device_unrealize(DeviceState *dev)
|
||||
}
|
||||
g_free(fs->req_vqs);
|
||||
virtio_cleanup(vdev);
|
||||
g_free(fs->vhost_dev.vqs);
|
||||
fs->vhost_dev.vqs = NULL;
|
||||
g_free(vhost_vqs);
|
||||
}
|
||||
|
||||
static struct vhost_dev *vuf_get_vhost(VirtIODevice *vdev)
|
||||
|
||||
+136
-81
File diff suppressed because it is too large
Load Diff
+58
@@ -0,0 +1,58 @@
|
||||
#!/usr/bin/env bash
|
||||
# group: rw auto quick
|
||||
#
|
||||
# Check that detect-zeroes=unmap works on writes with registered I/O buffers.
|
||||
# This is a regression test for
|
||||
# https://gitlab.com/qemu-project/qemu/-/issues/1404 where I/O requests failed
|
||||
# unexpectedly.
|
||||
#
|
||||
# Copyright Red Hat
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
# creator
|
||||
owner=stefanha@redhat.com
|
||||
|
||||
seq=`basename $0`
|
||||
echo "QA output created by $seq"
|
||||
|
||||
status=1 # failure is the default!
|
||||
|
||||
_cleanup()
|
||||
{
|
||||
_cleanup_test_img
|
||||
}
|
||||
trap "_cleanup; exit \$status" 0 1 2 3 15
|
||||
|
||||
# get standard environment, filters and checks
|
||||
cd ..
|
||||
. ./common.rc
|
||||
. ./common.filter
|
||||
|
||||
_supported_fmt qcow2
|
||||
_supported_proto generic
|
||||
|
||||
size=128M
|
||||
_make_test_img $size
|
||||
IMGSPEC="driver=$IMGFMT,file.filename=$TEST_IMG,discard=unmap,detect-zeroes=unmap"
|
||||
|
||||
echo
|
||||
echo "== writing zero buffer to image =="
|
||||
QEMU_IO_OPTIONS="$QEMU_IO_OPTIONS_NO_FMT" $QEMU_IO -c "write -r -P 0 0 4k" --image-opts "$IMGSPEC" | _filter_qemu_io
|
||||
|
||||
# success, all done
|
||||
echo "*** done"
|
||||
rm -f $seq.full
|
||||
status=0
|
||||
@@ -0,0 +1,7 @@
|
||||
QA output created by detect-zeroes-registered-buf
|
||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
|
||||
|
||||
== writing zero buffer to image ==
|
||||
wrote 4096/4096 bytes at offset 0
|
||||
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
*** done
|
||||
Reference in New Issue
Block a user