qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

qemu-img: Report convert errors by bytes, not sectors

Various qemu-img commands are inconsistent on whether they report
status/errors in terms of bytes or sector offsets. The latter is
confusing (especially as more places move to 4k block sizes), so let's
switch everything to just use bytes everywhere. One iotest is
impacted.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20200402135717.476398-1-eblake@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>

authored by

Eric Blake and committed by
Max Reitz
39f77cb6 80f5c011

+5 -5
+4 -4
qemu-img.c
··· 1924 1924 if (status == BLK_DATA && !copy_range) { 1925 1925 ret = convert_co_read(s, sector_num, n, buf); 1926 1926 if (ret < 0) { 1927 - error_report("error while reading sector %" PRId64 1928 - ": %s", sector_num, strerror(-ret)); 1927 + error_report("error while reading at byte %lld: %s", 1928 + sector_num * BDRV_SECTOR_SIZE, strerror(-ret)); 1929 1929 s->ret = ret; 1930 1930 } 1931 1931 } else if (!s->min_sparse && status == BLK_ZERO) { ··· 1953 1953 ret = convert_co_write(s, sector_num, n, buf, status); 1954 1954 } 1955 1955 if (ret < 0) { 1956 - error_report("error while writing sector %" PRId64 1957 - ": %s", sector_num, strerror(-ret)); 1956 + error_report("error while writing at byte %lld: %s", 1957 + sector_num * BDRV_SECTOR_SIZE, strerror(-ret)); 1958 1958 s->ret = ret; 1959 1959 } 1960 1960 }
+1 -1
tests/qemu-iotests/244.out
··· 33 33 Formatting 'TEST_DIR/t.IMGFMT.src', fmt=IMGFMT size=67108864 34 34 wrote 1048576/1048576 bytes at offset 0 35 35 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 36 - qemu-img: error while writing sector 0: Operation not supported 36 + qemu-img: error while writing at byte 0: Operation not supported 37 37 38 38 Convert uncompressed, then write compressed data manually: 39 39 Images are identical.