commit ce897250babe3527f451c1c54c86b62659a2c29e Author: Maxim Levitsky Date: Thu Oct 15 17:02:58 2020 +0300 hacks diff --git a/block/file-posix.c b/block/file-posix.c index c63926d592..91ca690505 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -1440,6 +1440,12 @@ static ssize_t handle_aiocb_rw_linear(RawPosixAIOData *aiocb, char *buf) while (offset < aiocb->aio_nbytes) { if (aiocb->aio_type & QEMU_AIO_WRITE) { + + long unsigned int size = aiocb->aio_nbytes - offset; + long unsigned int off = aiocb->aio_offset + offset; + + printf(" write %012lx %012lx\n", off, off+size-1); + len = pwrite(aiocb->aio_fildes, (const char *)buf + offset, aiocb->aio_nbytes - offset, @@ -1581,10 +1587,15 @@ static int translate_err(int err) static int do_fallocate(int fd, int mode, off_t offset, off_t len) { do { + + printf(" fallocate %012lx %012lx\n", offset, offset+len-1); + if (fallocate(fd, mode, offset, len) == 0) { return 0; } } while (errno == EINTR); + + printf("FALLOCATE failed with error %d\n", errno); return translate_err(-errno); } #endif diff --git a/qemu-img.c b/qemu-img.c index c2c56fc797..64d3b84728 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -1803,6 +1803,7 @@ static int convert_iteration_sectors(ImgConvertState *s, int64_t sector_num) } s->sector_next_status = sector_num + n; + printf("NEXT_STATUS: %lx\n", s->sector_next_status << 9); } n = MIN(n, s->sector_next_status - sector_num); @@ -1878,6 +1879,10 @@ static int coroutine_fn convert_co_read(ImgConvertState *s, int64_t sector_num, return 0; } +static void test_print(const char* op, unsigned long start, unsigned long len) +{ + printf("%s: 0x%012lx %012lx (len:0x%lx)\n", op, start, start + len-1, len); +} static int coroutine_fn convert_co_write(ImgConvertState *s, int64_t sector_num, int nb_sectors, uint8_t *buf, @@ -1911,6 +1916,8 @@ static int coroutine_fn convert_co_write(ImgConvertState *s, int64_t sector_num, (s->compressed && !buffer_is_zero(buf, n * BDRV_SECTOR_SIZE))) { + test_print("WRITE", sector_num << BDRV_SECTOR_BITS, n << BDRV_SECTOR_BITS); + ret = blk_co_pwrite(s->target, sector_num << BDRV_SECTOR_BITS, n << BDRV_SECTOR_BITS, buf, flags); if (ret < 0) { @@ -1925,6 +1932,8 @@ static int coroutine_fn convert_co_write(ImgConvertState *s, int64_t sector_num, assert(!s->target_has_backing); break; } + test_print("ZERO", sector_num << BDRV_SECTOR_BITS, n << BDRV_SECTOR_BITS); + ret = blk_co_pwrite_zeroes(s->target, sector_num << BDRV_SECTOR_BITS, n << BDRV_SECTOR_BITS,