]> git.ipfire.org Git - thirdparty/qemu.git/commit
dmg: drop broken bdrv_pread() loop
authorStefan Hajnoczi <stefanha@redhat.com>
Wed, 26 Mar 2014 12:05:56 +0000 (13:05 +0100)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Thu, 3 Jul 2014 21:18:13 +0000 (16:18 -0500)
commit4ee5b9c8cbe05d1865924dce226b4c3aedc4dae6
tree0e29cdccd81dc68a0d2fcc10983eddb892554b66
parentad08cae75c444366ad7a5222c6b7867f31a338f7
dmg: drop broken bdrv_pread() loop

It is not necessary to check errno for EINTR and the block layer does
not produce short reads.  Therefore we can drop the loop that attempts
to read a compressed chunk.

The loop is buggy because it incorrectly adds the transferred bytes
twice:

  do {
      ret = bdrv_pread(...);
      i += ret;
  } while (ret >= 0 && ret + i < s->lengths[chunk]);

Luckily we can drop the loop completely and perform a single
bdrv_pread().

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
(cherry picked from commit b404bf854217dbe8a5649449eb3ad33777f7d900)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
block/dmg.c