1. 29 10月, 2013 1 次提交
  2. 11 10月, 2013 5 次提交
  3. 07 10月, 2013 1 次提交
  4. 02 10月, 2013 1 次提交
  5. 26 9月, 2013 1 次提交
  6. 25 9月, 2013 5 次提交
  7. 21 9月, 2013 1 次提交
  8. 12 9月, 2013 5 次提交
  9. 06 9月, 2013 15 次提交
  10. 30 8月, 2013 1 次提交
  11. 23 8月, 2013 1 次提交
  12. 22 8月, 2013 2 次提交
    • M
      block: Produce zeros when protocols reading beyond end of file · 893a8f62
      MORITA Kazutaka 提交于
      While Asias is debugging an issue creating qcow2 images on top of
      non-file protocols.  It boils down to this example using NBD:
      
      $ qemu-io -c 'open -g nbd+unix:///?socket=/tmp/nbd.sock' -c 'read -v 0 512'
      
      Notice the open -g option to set bs->growable.  This means you can
      read/write beyond end of file.  Reading beyond end of file is supposed
      to produce zeroes.
      
      We rely on this behavior in qcow2_create2() during qcow2 image
      creation.  We create a new file and then write the qcow2 header
      structure using bdrv_pwrite().  Since QCowHeader is not a multiple of
      sector size, block.c first uses bdrv_read() on the empty file to fetch
      the first sector (should be all zeroes).
      
      Here is the output from the qemu-io NBD example above:
      
      $ qemu-io -c 'open -g nbd+unix:///?socket=/tmp/nbd.sock' -c 'read -v 0 512'
      00000000:  ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab  ................
      00000010:  ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab  ................
      00000020:  ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab  ................
      ...
      
      We are not zeroing the buffer!  As a result qcow2 image creation on top
      of protocols is not guaranteed to work even when file creation is
      supported by the protocol.
      
      [Adapted this patch to use bs->zero_beyond_eof.
      -- Stefan]
      Signed-off-by: NMORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
      Signed-off-by: NAsias He <asias@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      893a8f62
    • A
      block: Introduce bs->zero_beyond_eof · 0d51b4de
      Asias He 提交于
      In 4146b46c42e0989cb5842e04d88ab6ccb1713a48 (block: Produce zeros when
      protocols reading beyond end of file), we break qemu-iotests ./check
      -qcow2 022. This happens because qcow2 temporarily sets ->growable = 1
      for vmstate accesses (which are stored beyond the end of regular image
      data).
      
      We introduce the bs->zero_beyond_eof to allow qcow2_load_vmstate() to
      disable ->zero_beyond_eof temporarily in addition to enable ->growable.
      
      [Since the broken patch "block: Produce zeros when protocols reading
      beyond end of file" has not been merged yet, I have applied this fix
      *first* and will then apply the next patch to keep the tree bisectable.
      -- Stefan]
      Suggested-by: NStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NAsias He <asias@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      0d51b4de
  13. 19 8月, 2013 1 次提交
    • S
      block: stop relying on io_flush() in bdrv_drain_all() · 88266f5a
      Stefan Hajnoczi 提交于
      If a block driver has no file descriptors to monitor but there are still
      active requests, it can return 1 from .io_flush().  This is used to spin
      during synchronous I/O.
      
      Stop relying on .io_flush() and instead check
      QLIST_EMPTY(&bs->tracked_requests) to decide whether there are active
      requests.
      
      This is the first step in removing .io_flush() so that event loops no
      longer need to have the concept of synchronous I/O.  Eventually we may
      be able to kill synchronous I/O completely by running everything in a
      coroutine, but that is future work.
      
      Note this patch moves bs->throttled_reqs initialization to bdrv_new() so
      that bdrv_requests_pending(bs) can safely access it.  In practice bs is
      g_malloc0() so the memory is already zeroed but it's safer to initialize
      the queue properly.
      
      We also need to fix up block/stream.c:close_unused_images() to prevent
      traversing a dangling pointer while it rearranges the backing file
      chain.  This is necessary since the new bdrv_drain_all() traverses the
      backing file chain.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      88266f5a