1. 13 6月, 2019 1 次提交
  2. 29 5月, 2019 1 次提交
  3. 14 12月, 2018 1 次提交
  4. 13 11月, 2018 1 次提交
  5. 05 7月, 2018 1 次提交
    • A
      block: Add blklogwrites · bfcc224e
      Aapo Vienamo 提交于
      Implements a block device write logging system, similar to Linux kernel
      device mapper dm-log-writes. The write operations that are performed
      on a block device are logged to a file or another block device. The
      write log format is identical to the dm-log-writes format. Currently,
      log markers are not supported.
      
      This functionality can be used for crash consistency and fs consistency
      testing. By implementing it in qemu, tests utilizing write logs can be
      be used to test non-Linux drivers and older kernels.
      
      The driver accepts an optional parameter to set the sector size used
      for logging. This makes the driver require all requests to be aligned
      to this sector size and also makes offsets and sizes of writes in the
      log metadata to be expressed in terms of this value (the log format has
      a granularity of one sector for offsets and sizes). This allows
      accurate logging of writes to guest block devices that have unusual
      sector sizes.
      
      The implementation is based on the blkverify and blkdebug block
      drivers.
      Signed-off-by: NAapo Vienamo <aapo@tuxera.com>
      Signed-off-by: NAri Sundholm <ari@tuxera.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      bfcc224e
  6. 15 5月, 2018 1 次提交
  7. 09 3月, 2018 1 次提交
    • K
      block: x-blockdev-create QMP command · b0292b85
      Kevin Wolf 提交于
      This adds a synchronous x-blockdev-create QMP command that can create
      qcow2 images on a given node name.
      
      We don't want to block while creating an image, so this is not the final
      interface in all aspects, but BlockdevCreateOptionsQcow2 and
      .bdrv_co_create() are what they actually might look like in the end. In
      any case, this should be good enough to test whether we interpret
      BlockdevCreateOptions as we should.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      b0292b85
  8. 08 2月, 2018 1 次提交
    • F
      block: Add VFIO based NVMe driver · bdd6a90a
      Fam Zheng 提交于
      This is a new protocol driver that exclusively opens a host NVMe
      controller through VFIO. It achieves better latency than linux-aio by
      completely bypassing host kernel vfs/block layer.
      
          $rw-$bs-$iodepth  linux-aio     nvme://
          ----------------------------------------
          randread-4k-1     10.5k         21.6k
          randread-512k-1   745           1591
          randwrite-4k-1    30.7k         37.0k
          randwrite-512k-1  1945          1980
      
          (unit: IOPS)
      
      The driver also integrates with the polling mechanism of iothread.
      
      This patch is co-authored by Paolo and me.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NFam Zheng <famz@redhat.com>
      Message-Id: <20180116060901.17413-4-famz@redhat.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NFam Zheng <famz@redhat.com>
      bdd6a90a
  9. 22 1月, 2018 1 次提交
  10. 06 9月, 2017 1 次提交
  11. 11 7月, 2017 1 次提交
  12. 26 6月, 2017 1 次提交
  13. 25 4月, 2017 1 次提交
  14. 13 3月, 2017 1 次提交
  15. 28 1月, 2017 1 次提交
  16. 09 1月, 2017 2 次提交
    • E
      block: Rename raw-{posix,win32} to file-*.c · c1bb86cd
      Eric Blake 提交于
      These files deal with the file protocol, not the raw format (the
      file protocol is often used with other formats, and the raw
      format is not forced to use the file protocol).  Rename things
      to make it a bit easier to follow.
      Suggested-by: NDaniel P. Berrange <berrange@redhat.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NJohn Snow <jsnow@redhat.com>
      Reviewed-by: NLaszlo Ersek <lersek@redhat.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      c1bb86cd
    • E
      block: Rename raw_bsd to raw-format.c · 2e6fc7eb
      Eric Blake 提交于
      Given that we have raw-win32.c and raw-posix.c, my initial guess at
      raw_bsd.c was that it was for dealing with raw files using code
      specific to the BSD operating system (beyond what raw-posix could
      do).  Not so - this name was chosen back in commit e1c66c6d to
      distinguish that it was a BSD licensed file, in contrast to the
      then-existing raw.c with an unclear and potentially unusable
      license.  But since it has been more than three years since the
      rewrite, it's time to pick a more useful name for this file to
      avoid this type of confusion to future contributors that don't know
      the backstory, as none of our other files are named solely by the
      license they use.
      
      In reality, this file deals with the raw format, which is useful
      with any number of protocols, while raw-{win32,posix} deal with
      the file protocol (and in turn, that protocol is not limited to
      use with the raw format).  So rename raw_bsd to raw-format.c.  We
      could have also used the shorter name raw.c, except that collides
      with the earlier use of that filename for a different license,
      and it's better to be safe than risk license pollution.
      
      The next patch will also rename raw-win32.c and raw-posix.c to
      further distinguish the difference in roles.
      
      It doesn't hurt that this gets rid of an underscore in the filename,
      thereby making tab-completion on 'ra<TAB>' easier (now I don't have
      to type the shift key, which slows things down :)
      Suggested-by: NDaniel P. Berrange <berrange@redhat.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NLaszlo Ersek <lersek@redhat.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      2e6fc7eb
  17. 07 10月, 2016 1 次提交
    • F
      dmg: Move libbz2 code to dmg-bz2.so · 27685a8d
      Fam Zheng 提交于
      dmg.o was moved to block-obj-m in 5505e8b7 to become a separate module,
      so that its reference to libbz2, since 6b383c08, doesn't add an extra
      library to the main executable.
      
      Until recently, commit 06e60f70a (blockdev: Add dynamic module loading
      for block drivers) moved it back to block-obj-y to simplify the design
      of dynamic loading of block modules. But we don't want to lose the
      feature of less library dependency on the main executable.
      
      The solution here is to move only the bz2 related code to a separate
      DSO file, and load it when dmg_open is called.
      
      dmg_probe doesn't depend on bz2 support to work, and is the only code in
      this file which can run before dmg_open.
      
      While we are at it, fix the unhelpful cast of last argument passed to
      dmg_uncompress_bz2.
      Signed-off-by: NFam Zheng <famz@redhat.com>
      Message-id: 1473043845-13197-4-git-send-email-famz@redhat.com
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      27685a8d
  18. 23 9月, 2016 1 次提交
  19. 21 9月, 2016 2 次提交
    • C
      blockdev: Modularize nfs block driver · 4be4879f
      Colin Lord 提交于
      Modularizes the nfs block driver so that it gets dynamically loaded.
      Signed-off-by: NColin Lord <clord@redhat.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Message-id: 1471008424-16465-5-git-send-email-clord@redhat.com
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      4be4879f
    • M
      blockdev: Add dynamic module loading for block drivers · 88d88798
      Marc Mari 提交于
      Extend the current module interface to allow for block drivers to be
      loaded dynamically on request. The only block drivers that can be
      converted into modules are the drivers that don't perform any init
      operation except for registering themselves.
      
      In addition, only the protocol drivers are being modularized, as they
      are the only ones which see significant performance benefits. The format
      drivers do not generally link to external libraries, so modularizing
      them is of no benefit from a performance perspective.
      
      All the necessary module information is located in a new structure found
      in module_block.h
      
      This spoils the purpose of 5505e8b7 (block/dmg: make it modular).
      
      Before this patch, if module build is enabled, block-dmg.so is linked to
      libbz2, whereas the main binary is not. In downstream, theoretically, it
      means only the qemu-block-extra package depends on libbz2, while the
      main QEMU package needn't to. With this patch, we (temporarily) change
      the case so that the main QEMU depends on libbz2 again.
      Signed-off-by: NMarc Marí <markmb@redhat.com>
      Signed-off-by: NColin Lord <clord@redhat.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Message-id: 1471008424-16465-4-git-send-email-clord@redhat.com
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      [mreitz: Do a signed comparison against the length of
       block_driver_modules[], so it will not cause a compile error when
       empty]
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      88d88798
  20. 13 9月, 2016 2 次提交
  21. 05 7月, 2016 1 次提交
  22. 30 3月, 2016 2 次提交
    • P
      replay: introduce block devices record/replay · 63785678
      Pavel Dovgalyuk 提交于
      This patch introduces block driver that implement recording
      and replaying of block devices' operations.
      All block completion operations are added to the queue.
      Queue is flushed at checkpoints and information about processed requests
      is recorded to the log. In replay phase the queue is matched with
      events read from the log. Therefore block devices requests are processed
      deterministically.
      Signed-off-by: NPavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
      [ kwolf: Rebased onto modified and already applied part of the series ]
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      63785678
    • D
      block: add generic full disk encryption driver · 78368575
      Daniel P. Berrange 提交于
      Add a block driver that is capable of supporting any full disk
      encryption format. This utilizes the previously added block
      encryption code, and at this time supports the LUKS format.
      
      The driver code is capable of supporting any format supported
      by the QCryptoBlock module, so it registers one block driver
      for each format. This patch only registers the "luks" driver
      since the "qcow" driver is there only for back-compatibility
      with existing qcow built-in encryption.
      
      New LUKS compatible volumes can be formatted using qemu-img
      with defaults for all settings.
      
      $ qemu-img create --object secret,data=123456,id=sec0 \
            -f luks -o key-secret=sec0 demo.luks 10G
      
      Alternatively the cryptographic settings can be explicitly
      set
      
      $ qemu-img create --object secret,data=123456,id=sec0 \
            -f luks -o key-secret=sec0,cipher-alg=aes-256,\
                       cipher-mode=cbc,ivgen-alg=plain64,hash-alg=sha256 \
            demo.luks 10G
      
      And query its size
      
      $ qemu-img info demo.img
      image: demo.img
      file format: luks
      virtual size: 10G (10737418240 bytes)
      disk size: 132K
      encrypted: yes
      
      Note that it was not necessary to provide the password
      when querying info for the volume. The password is only
      required when performing I/O on the volume
      
      All volumes created by this new 'luks' driver should be
      capable of being opened by the kernel dm-crypt driver.
      
      The only algorithms listed in the LUKS spec that are
      not currently supported by this impl are sha512 and
      ripemd160 hashes and cast6 cipher.
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      [ kwolf - Added #include to resolve conflict with da34e65c ]
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      78368575
  23. 15 3月, 2016 1 次提交
  24. 08 7月, 2015 1 次提交
  25. 12 6月, 2015 1 次提交
  26. 28 4月, 2015 2 次提交
  27. 07 2月, 2015 2 次提交
    • P
      block/dmg: support bzip2 block entry types · 6b383c08
      Peter Wu 提交于
      This patch adds support for bzip2-compressed block entries as introduced
      with OS X 10.4 (source: https://en.wikipedia.org/wiki/Apple_Disk_Image).
      
      It was tested against a 5.2G "OS X Yosemite" installation image which
      stores the BLXX block in the XML property list (instead of resource
      forks) and has over 5k chunks.
      
      New configure entries are added (--enable-bzip2 / --disable-bzip2) to
      control inclusion of bzip2 functionality (which requires linking against
      libbz2). The help message suggests that this option is needed for DMG
      files, but the tests are generic enough that other parts of QEMU can use
      bzip2 if needed.
      
      The identifiers are based on http://newosxbook.com/DMG.html.
      
      The decompression routines are based on the zlib case, but as there is
      no way to reset the decompression state (unlike zlib), memory is
      allocated and deallocated for every decompression. This should not be
      problematic as the decompression takes most of the time and as blocks
      are typically about/over 1 MiB in size, only one allocation is done
      every 2000 sectors.
      Signed-off-by: NPeter Wu <peter@lekensteyn.nl>
      Reviewed-by: NJohn Snow <jsnow@redhat.com>
      Acked-by: NPaolo Bonzini <pbonzini@redhat.com>
      Message-id: 1420566495-13284-12-git-send-email-peter@lekensteyn.nl
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      6b383c08
    • F
      block: add event when disk usage exceeds threshold · e2462113
      Francesco Romani 提交于
      Managing applications, like oVirt (http://www.ovirt.org), make extensive
      use of thin-provisioned disk images.
      To let the guest run smoothly and be not unnecessarily paused, oVirt sets
      a disk usage threshold (so called 'high water mark') based on the occupation
      of the device,  and automatically extends the image once the threshold
      is reached or exceeded.
      
      In order to detect the crossing of the threshold, oVirt has no choice but
      aggressively polling the QEMU monitor using the query-blockstats command.
      This lead to unnecessary system load, and is made even worse under scale:
      deployments with hundreds of VMs are no longer rare.
      
      To fix this, this patch adds:
      * A new monitor command `block-set-write-threshold', to set a mark for
        a given block device.
      * A new event `BLOCK_WRITE_THRESHOLD', to report if a block device
        usage exceeds the threshold.
      * A new `write_threshold' field into the `BlockDeviceInfo' structure,
        to report the configured threshold.
      
      This will allow the managing application to use smarter and more
      efficient monitoring, greatly reducing the need of polling.
      
      [Updated qemu-iotests 067 output to add the new 'write_threshold'
      property. --Stefan]
      [Changed g_assert_false() to !g_assert() to fix the build on older glib
      versions. --Kevin]
      Signed-off-by: NFrancesco Romani <fromani@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-id: 1421068273-692-1-git-send-email-fromani@redhat.com
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      e2462113
  28. 03 11月, 2014 1 次提交
  29. 20 10月, 2014 1 次提交
    • M
      block: New BlockBackend · 26f54e9a
      Markus Armbruster 提交于
      A block device consists of a frontend device model and a backend.
      
      A block backend has a tree of block drivers doing the actual work.
      The tree is managed by the block layer.
      
      We currently use a single abstraction BlockDriverState both for tree
      nodes and the backend as a whole.  Drawbacks:
      
      * Its API includes both stuff that makes sense only at the block
        backend level (root of the tree) and stuff that's only for use
        within the block layer.  This makes the API bigger and more complex
        than necessary.  Moreover, it's not obvious which interfaces are
        meant for device models, and which really aren't.
      
      * Since device models keep a reference to their backend, the backend
        object can't just be destroyed.  But for media change, we need to
        replace the tree.  Our solution is to make the BlockDriverState
        generic, with actual driver state in a separate object, pointed to
        by member opaque.  That lets us replace the tree by deinitializing
        and reinitializing its root.  This special need of the root makes
        the data structure awkward everywhere in the tree.
      
      The general plan is to separate the APIs into "block backend", for use
      by device models, monitor and whatever other code dealing with block
      backends, and "block driver", for use by the block layer and whatever
      other code (if any) dealing with trees and tree nodes.
      
      Code dealing with block backends, device models in particular, should
      become completely oblivious of BlockDriverState.  This should let us
      clean up both APIs, and the tree data structures.
      
      This commit is a first step.  It creates a minimal "block backend"
      API: type BlockBackend and functions to create, destroy and find them.
      
      BlockBackend objects are created and destroyed exactly when root
      BlockDriverState objects are created and destroyed.  "Root" in the
      sense of "in bdrv_states".  They're not yet used for anything; that'll
      come shortly.
      
      A root BlockDriverState is created with bdrv_new_root(), so where to
      create a BlockBackend is obvious.  Where these roots get destroyed
      isn't always as obvious.
      
      It is obvious in qemu-img.c, qemu-io.c and qemu-nbd.c, and in error
      paths of blockdev_init(), blk_connect().  That leaves destruction of
      objects successfully created by blockdev_init() and blk_connect().
      
      blockdev_init() is used only by drive_new() and qmp_blockdev_add().
      Objects created by the latter are currently indestructible (see commit
      48f364dd "blockdev: Refuse to drive_del something added with
      blockdev-add" and commit 2d246f01 "blockdev: Introduce
      DriveInfo.enable_auto_del").  Objects created by the former get
      destroyed by drive_del().
      
      Objects created by blk_connect() get destroyed by blk_disconnect().
      
      BlockBackend is reference-counted.  Its reference count never exceeds
      one so far, but that's going to change.
      
      In drive_del(), the BB's reference count is surely one now.  The BDS's
      reference count is greater than one when something else is holding a
      reference, such as a block job.  In this case, the BB is destroyed
      right away, but the BDS lives on until all extra references get
      dropped.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      26f54e9a
  30. 22 9月, 2014 2 次提交
    • S
      block: delete cow block driver · 550830f9
      Stefan Hajnoczi 提交于
      This patch removes support for the cow file format.
      
      Normally we do not break backwards compatibility but in this case there
      is no impact and it is the most logical option.  Extraordinary claims
      require extraordinary evidence so I will show why removing the cow block
      driver is the right thing to do.
      
      The cow file format is the disk image format for Usermode Linux, a way
      of running a Linux system in userspace.  The performance of UML was
      never great and it was hacky, but it enjoyed some popularity before
      hardware virtualization support became mainstream.
      
      QEMU's block/cow.c is supposed to read this image file format.
      Unfortunately the file format was underspecified:
      
      1. Earlier Linux versions used the MAXPATHLEN constant for the backing
         filename field.  The value of MAXPATHLEN can change, so Linux
         switched to a 4096 literal but QEMU has a 1024 literal.
      
      2. Padding was not used on the header struct (both in the Linux kernel
         and in QEMU) so the struct layout varied across architectures.  In
         particular, i386 and x86_64 were different due to int64_t alignment
         differences.  Linux now uses __attribute__((packed)), QEMU does not.
      
      Therefore:
      
      1. QEMU cow images do not conform to the Linux cow image file format.
      
      2. cow images cannot be shared between different host architectures.
      
      This means QEMU cow images are useless and QEMU has not had bug reports
      from users actually hitting these issues.
      
      Let's get rid of this thing, it serves no purpose and no one will be
      affected.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Message-id: 1410877464-20481-1-git-send-email-stefanha@redhat.com
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      550830f9
    • F
      block: Introduce "null" drivers · e819ab22
      Fam Zheng 提交于
      This is an analogue to Linux null_blk. It can be used for testing or
      benchmarking block device emulation and general block layer
      functionalities such as coroutines and throttling, where disk IO is not
      necessary or wanted.
      
      Use null-aio:// for AIO version, and null-co:// for coroutine version.
      
      [Resolved conflict with Fam's async bdrv_aio_cancel() series:
      1. Drop .bdrv_aio_cancel() since it is now done by block.c
      2. Rename qemu_aio_release() to qemu_aio_unref()
      --Stefan]
      Signed-off-by: NFam Zheng <famz@redhat.com>
      Reviewed-by: NBenoît Canet <benoit.canet@nodalink.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-id: 1410415798-20673-2-git-send-email-famz@redhat.com
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      e819ab22
  31. 10 9月, 2014 1 次提交
    • B
      block: Extract the block accounting code · 5e5a94b6
      Benoît Canet 提交于
      The plan is to add new accounting metrics (latency, invalid requests, failed
      requests, queue depth) and block.c is overpopulated so it will be better to work
      in a separate module.
      
      Moreover the long term plan is to have statistics in each of the BDS of the graph
      for metrology purpose; this means that the device model statistics must move from
      the topmost BDS to the device model.
      
      So we need to decouple the statistic code from BlockDriverState.
      
      This is another argument for the extraction of the code in a separate module.
      
      CC: Kevin Wolf <kwolf@redhat.com>
      CC: Stefan Hajnoczi <stefanha@redhat.com>
      CC: Max Reitz <mreitz@redhat.com>
      CC: Eric Blake <eblake@redhat.com>
      CC: Benoit Canet <benoit@irqsave.net>
      CC: Fam Zheng <famz@redhat.com>
      CC: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
      CC: Paolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NBenoît Canet <benoit.canet@nodalink.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      5e5a94b6
  32. 29 8月, 2014 1 次提交
    • P
      aio-win32: add support for sockets · b493317d
      Paolo Bonzini 提交于
      Uses the same select/WSAEventSelect scheme as main-loop.c.
      WSAEventSelect() is edge-triggered, so it cannot be used
      directly, but it is still used as a way to exit from a
      blocking g_poll().
      
      Before g_poll() is called, we poll sockets with a non-blocking
      select() to achieve the level-triggered semantics we require:
      if a socket is ready, the g_poll() is made non-blocking too.
      
      Based on a patch from Or Goshen.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      b493317d
  33. 15 8月, 2014 1 次提交
    • C
      block: Support Archipelago as a QEMU block backend · c9a12e75
      Chrysostomos Nanakos 提交于
      VM Image on Archipelago volume is specified like this:
      
      file.driver=archipelago,file.volume=<volumename>[,file.mport=<mapperd_port>[,
      file.vport=<vlmcd_port>][,file.segment=<segment_name>]]
      
      'archipelago' is the protocol.
      
      'mport' is the port number on which mapperd is listening. This is optional
      and if not specified, QEMU will make Archipelago to use the default port.
      
      'vport' is the port number on which vlmcd is listening. This is optional
      and if not specified, QEMU will make Archipelago to use the default port.
      
      'segment' is the name of the shared memory segment Archipelago stack is using.
      This is optional and if not specified, QEMU will make Archipelago to use the
      default value, 'archipelago'.
      
      Examples:
      
      file.driver=archipelago,file.volume=my_vm_volume
      file.driver=archipelago,file.volume=my_vm_volume,file.mport=123
      file.driver=archipelago,file.volume=my_vm_volume,file.mport=123,
      file.vport=1234
      file.driver=archipelago,file.volume=my_vm_volume,file.mport=123,
      file.vport=1234,file.segment=my_segment
      Signed-off-by: NChrysostomos Nanakos <cnanakos@grnet.gr>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      c9a12e75