1. 07 8月, 2012 2 次提交
    • S
      qcow2: implement lazy refcounts · bfe8043e
      Stefan Hajnoczi 提交于
      Lazy refcounts is a performance optimization for qcow2 that postpones
      refcount metadata updates and instead marks the image dirty.  In the
      case of crash or power failure the image will be left in a dirty state
      and repaired next time it is opened.
      
      Reducing metadata I/O is important for cache=writethrough and
      cache=directsync because these modes guarantee that data is on disk
      after each write (hence we cannot take advantage of caching updates in
      RAM).  Refcount metadata is not needed for guest->file block address
      translation and therefore does not need to be on-disk at the time of
      write completion - this is the motivation behind the lazy refcount
      optimization.
      
      The lazy refcount optimization must be enabled at image creation time:
      
        qemu-img create -f qcow2 -o compat=1.1,lazy_refcounts=on a.qcow2 10G
        qemu-system-x86_64 -drive if=virtio,file=a.qcow2,cache=writethrough
      
      Update qemu-iotests 031 and 036 since the extension header size changes
      when we add feature bit table entries.
      Signed-off-by: NStefan Hajnoczi <stefanha@linux.vnet.ibm.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      bfe8043e
    • S
      qcow2: introduce dirty bit · c61d0004
      Stefan Hajnoczi 提交于
      This patch adds an incompatible feature bit to mark images that have not
      been closed cleanly.  When a dirty image file is opened a consistency
      check and repair is performed.
      
      Update qemu-iotests 031 and 036 since the extension header size changes
      when we add feature bit table entries.
      Signed-off-by: NStefan Hajnoczi <stefanha@linux.vnet.ibm.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      c61d0004
  2. 17 7月, 2012 4 次提交
    • M
      vvfat: Do not clobber the user's geometry · 4480e0f9
      Markus Armbruster 提交于
      vvfat creates a virtual VFAT filesystem with a certain logical
      geometry that depends on its options.  It sets the "geometry hint" to
      this geometry.  It is the only block driver to do this.
      
      The geometry hint is about about *physical* geometry, and used only by
      certain hard disk device models.
      
      vvfat's hint is normally invisible for device models, because
      bdrv_open() puts a raw format on top of vvfat's fat protocol.  That
      raw format is where drive_init() puts the user's geometry (if any),
      and where the device model gets it from.
      
      Nobody complained, because the default physical geometry is the same
      as vvfat's logical geometry:
      
          opts        LCHS        def. PCHS
                      1024,16,63  same
          :32:        1024,16,63  same
          :16:        1024,16,63  same
          :12:          64,16,63  same
      
      Except when you specify :floppy:
      
          opts        LCHS        def. PCHS
             :floppy:   80, 2,36  5,16,63
          :32:floppy:   80, 2,36  5,16,63
          :16:floppy:   80, 2,36  5,16,63
          :12:floppy:   80, 2,18  2,16,63
      
      Silly thing to do for use with a hard disk.
      
      However, the "raw" format can be suppressed by adding an
      redundant-looking "format=vvfat" to "file=fat:FOO".  Then, vvfat's
      hint clobbers the user's geometry, i.e. -drive options cyls, heads,
      secs get silently ignored.  Don't do that.
      
      No change without format=vvfat.  With it, the user's hard disk
      geometry (-drive options cyls, heads, secs) is now obeyed, and the
      default hard disk geometry with :floppy: now matches the one without
      format=vvfat.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      4480e0f9
    • M
      vvfat: Fix partition table · f91cbefe
      Markus Armbruster 提交于
      Unless parameter ":floppy:" is given, vvfat creates a virtual image
      with DOS MBR defining a single partition which holds the FAT file
      system.  The size of the virtual image depends on the width of the
      FAT: 32 MiB (CHS 64, 16, 63) for 12 bit FAT, 504 MiB (CHS 1024, 16,
      63) for 16 and 32 bit FAT, leaving (64*16-1)*63 = 64449 and
      (1024*16-1)*64 = 1032129 sectors for the partition.
      
      However, it screws up the end of the partition in the MBR:
      
          FAT width param.  start CHS  end CHS     start LBA  size
              :32:          0,1,1      1023,14,63       63    1032065
              :16:          0,1,1      1023,14,55       63    1032057
              :12:          0,1,1        63,14,55       63      64377
      
      The actual FAT file system nevertheless assumes the partition has
      1032129 or 64449 sectors.  Oops.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      f91cbefe
    • C
      sheepdog: do not blindly memset all read buffers · 19db9b90
      Christoph Hellwig 提交于
      Only buffers that map to unallocated blocks need to be zeroed.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Acked-by: NMORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      19db9b90
    • M
      sheepdog: always use coroutine-based network functions · cddd4ac7
      MORITA Kazutaka 提交于
      This reduces some code duplication.
      Signed-off-by: NMORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      cddd4ac7
  3. 09 7月, 2012 14 次提交
  4. 02 7月, 2012 2 次提交
    • R
      ISCSI: force use of sg for SMC and SSC devices · 622695a4
      Ronnie Sahlberg 提交于
      If the device we open is a SMC or SSC device, then force the use of sg. We
      dont have any medium changer or tape emulation so only passthrough via
      real sg or scsi-generic via iscsi would work anyway.
      
      Forcing sg also makes qemu skip trying to read from the device to guess
      the image format by reading from the device (find_image_format()).
      SMC devices do not implement READ6/10/12/16 so it is not possible to
      read from them (SSC have different CDBs).
      
      With this patch I can successfully manage a SMC device wiht iscsi in
      passthrough mode.
      Signed-off-by: NRonnie Sahlberg <ronniesahlberg@gmail.com>
      [Added TYPE_TAPE handling - Paolo]
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      622695a4
    • R
      ISCSI: Add SCSI passthrough via scsi-generic to libiscsi · 98392453
      Ronnie Sahlberg 提交于
      Update iscsi to allow passthrough of SG_IO scsi commands when the iscsi
      device is forced to be scsi-generic.
      
      Implement both bdrv_ioctl() and bdrv_aio_ioctl() in the iscsi backend,
      emulate the SG_IO ioctl and pass the SCSI commands across to the
      iscsi target.
      
      This allows end-to-end passthrough of SCSI all the way from the guest,
      to qemu, via scsi-generic, then libiscsi all the way to the iscsi target.
      
      To activate this you need to specify that the iscsi lun should be treated
      as a scsi-generic device.
      
      Example:
          -device lsi -device scsi-generic,drive=MyISCSI \
          -drive file=iscsi://10.1.1.125/iqn.ronnie.test/1,if=none,id=MyISCSI
      
      Note, you can currently not boot a qemu guest from a scsi device.
      
      Note,
      This only works when the host is linux, since the emulation relies on
      definitions of SG_IO from the scsi-generic implementation in the
      linux kernel.
      It should be fairly easy to re-implement some structures similar enough
      for non-linux hosts to do the same style of passthrough via a fake
      scsi generic layer and libiscsi if need be.
      Signed-off-by: NRonnie Sahlberg <ronniesahlberg@gmail.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      98392453
  5. 24 6月, 2012 1 次提交
  6. 15 6月, 2012 16 次提交
  7. 12 6月, 2012 1 次提交
    • M
      cleanup qemu_co_sendv(), qemu_co_recvv() and friends · 2fc8ae1d
      Michael Tokarev 提交于
      The same as for non-coroutine versions in previous
      patches: rename arguments to be more obvious, change
      type of arguments from int to size_t where appropriate,
      and use common code for send and receive paths (with
      one extra argument) since these are exactly the same.
      Use common iov_send_recv() directly.
      
      qemu_co_sendv(), qemu_co_recvv(), and qemu_co_recv()
      are now trivial #define's merely adding one extra arg.
      
      qemu_co_sendv() and qemu_co_recvv() callers are
      converted to different argument order and extra
      `iov_cnt' argument.
      Signed-off-by: NMichael Tokarev <mjt@tls.msk.ru>
      2fc8ae1d