diff options
author | Anthony Liguori <aliguori@us.ibm.com> | 2012-05-10 08:30:34 -0500 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2012-05-10 08:30:34 -0500 |
commit | b3d6ca770dd916bceaa7a421252734f86dc07e38 (patch) | |
tree | e849419c3356dfc4ba67bf851259ffd3306344e7 /qemu-io.c | |
parent | b3def7f5ff7cb3f5e6128fbb7b6a9aaade98774d (diff) | |
parent | 2084a8e330bab402e9aab082aad9ce75f9f6db87 (diff) | |
download | qemu-b3d6ca770dd916bceaa7a421252734f86dc07e38.zip qemu-b3d6ca770dd916bceaa7a421252734f86dc07e38.tar.gz qemu-b3d6ca770dd916bceaa7a421252734f86dc07e38.tar.bz2 |
Merge remote-tracking branch 'kwolf/for-anthony' into staging
* kwolf/for-anthony: (30 commits)
declare ECANCELED on all machines
tests/Makefile: Add missing $(EXESUF)
stream: do not copy unallocated sectors from the base
stream: fix ratelimiting corner case
stream: fix HMP block_job_set_speed
stream: pass new base image format to bdrv_change_backing_file
stream: add testcase for partial streaming
stream: fix sectors not allocated test
qemu-io: fix the alloc command
qemu-io: correctly print non-integer values as decimals
qemu-img: make "info" backing file output correct and easier to use
block: move field reset from bdrv_open_common to bdrv_close
block: protect path_has_protocol from filenames with colons
block: simplify path_is_absolute
block: wait for job callback in block_job_cancel_sync
block: add block_job_sleep_ns
block: fully delete bs->file when closing
block: do not reuse the backing file across bdrv_close/bdrv_open
block: another bdrv_append fix
block: fix snapshot on QED
...
Diffstat (limited to 'qemu-io.c')
-rw-r--r-- | qemu-io.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -1560,7 +1560,7 @@ out: static int alloc_f(int argc, char **argv) { - int64_t offset; + int64_t offset, sector_num; int nb_sectors, remaining; char s1[64]; int num, sum_alloc; @@ -1581,12 +1581,18 @@ static int alloc_f(int argc, char **argv) remaining = nb_sectors; sum_alloc = 0; + sector_num = offset >> 9; while (remaining) { - ret = bdrv_is_allocated(bs, offset >> 9, nb_sectors, &num); + ret = bdrv_is_allocated(bs, sector_num, remaining, &num); + sector_num += num; remaining -= num; if (ret) { sum_alloc += num; } + if (num == 0) { + nb_sectors -= remaining; + remaining = 0; + } } cvtstr(offset, s1, sizeof(s1)); |