1. 20 7月, 2016 19 次提交
    • E
      block: Add .bdrv_co_pdiscard() driver callback · 47a5486d
      Eric Blake 提交于
      There's enough drivers with a sector-based callback that it will
      be easier to switch one at a time.  This patch adds a byte-based
      callback, and then after all drivers are swapped, we'll drop the
      sector-based callback.
      
      [checkpatch doesn't like the space after coroutine_fn in
      block_int.h, but it's consistent with the rest of the file]
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Message-id: 1468624988-423-10-git-send-email-eblake@redhat.com
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      47a5486d
    • E
      block: Convert .bdrv_aio_discard() to byte-based · 4da444a0
      Eric Blake 提交于
      Another step towards byte-based interfaces everywhere.  Replace
      the sector-based driver callback .bdrv_aio_discard() with a new
      byte-based .bdrv_aio_pdiscard().  Only raw-posix and RBD drivers
      are affected, so it was not worth splitting into multiple patches.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Message-id: 1468624988-423-9-git-send-email-eblake@redhat.com
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      4da444a0
    • E
      rbd: Switch rbd_start_aio() to byte-based · 7bbca9e2
      Eric Blake 提交于
      The internal function converts to byte-based before calling into
      RBD code; hoist the conversion to the callers so that callers
      can then be switched to byte-based themselves.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Message-id: 1468624988-423-8-git-send-email-eblake@redhat.com
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      7bbca9e2
    • E
      raw-posix: Switch paio_submit() to byte-based · 36e3b2e7
      Eric Blake 提交于
      The only remaining uses of paio_submit() were flush (with no
      offset or count) and discard (which we are switching to byte-based);
      furthermore, the similarly named paio_submit_co() is already
      byte-based.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Message-id: 1468624988-423-7-git-send-email-eblake@redhat.com
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      36e3b2e7
    • E
      block: Convert BB interface to byte-based discards · 1c6c4bb7
      Eric Blake 提交于
      Change sector-based blk_discard(), blk_co_discard(), and
      blk_aio_discard() to instead be byte-based blk_pdiscard(),
      blk_co_pdiscard(), and blk_aio_pdiscard().  NBD gets a lot
      simpler now that ignoring the unaligned portion of a
      byte-based discard request is handled under the hood by
      the block layer.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Message-id: 1468624988-423-6-git-send-email-eblake@redhat.com
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      1c6c4bb7
    • E
      block: Convert bdrv_aio_discard() to byte-based · 60ebac16
      Eric Blake 提交于
      Another step towards byte-based interfaces everywhere.  Replace
      the sector-based bdrv_aio_discard() with a new byte-based
      bdrv_aio_pdiscard(), which silently ignores any unaligned head
      or tail.  Driver callbacks will be converted in followup patches.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-id: 1468624988-423-5-git-send-email-eblake@redhat.com
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      60ebac16
    • E
      block: Switch BlockRequest to byte-based · b15404e0
      Eric Blake 提交于
      BlockRequest is the internal struct used by bdrv_aio_*.  At the
      moment, all such calls were sector-based, but we will eventually
      convert to byte-based; start by changing the internal variables
      to be byte-based.  No change to behavior, although the read and
      write code can now go byte-based through more of the stack.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-id: 1468624988-423-4-git-send-email-eblake@redhat.com
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      b15404e0
    • E
      block: Convert bdrv_discard() to byte-based · 0c51a893
      Eric Blake 提交于
      Another step towards byte-based interfaces everywhere.  Replace
      the sector-based bdrv_discard() with a new byte-based
      bdrv_pdiscard(), which silently ignores any unaligned head
      or tail.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Message-id: 1468624988-423-3-git-send-email-eblake@redhat.com
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      0c51a893
    • E
      block: Convert bdrv_co_discard() to byte-based · 9f1963b3
      Eric Blake 提交于
      Another step towards byte-based interfaces everywhere.  Replace
      the sector-based bdrv_co_discard() with a new byte-based
      bdrv_co_pdiscard(), which silently ignores any unaligned head
      or tail.  Driver callbacks will be converted in followup patches.
      
      By calculating the alignment outside of the loop, and clamping
      the max discard to an aligned value, we can simplify the actions
      done within the loop.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Message-id: 1468624988-423-2-git-send-email-eblake@redhat.com
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      9f1963b3
    • E
      iscsi: Rely on block layer to break up large requests · 6bd01f14
      Eric Blake 提交于
      Now that the block layer honors max_request, we don't need to
      bother with an EINVAL on overlarge requests, but can instead
      assert that requests are well-behaved.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NFam Zheng <famz@redhat.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Acked-by: NPaolo Bonzini <pbonzini@redhat.com>
      Message-id: 1468607524-19021-7-git-send-email-eblake@redhat.com
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      6bd01f14
    • E
      nbd: Drop unused offset parameter · 1e2a77a8
      Eric Blake 提交于
      Now that NBD relies on the block layer to fragment things, we no
      longer need to track an offset argument for which fragment of
      a request we are actually servicing.
      
      While at it, use true and false instead of 0 and 1 for a bool
      parameter.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NFam Zheng <famz@redhat.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Acked-by: NPaolo Bonzini <pbonzini@redhat.com>
      Message-id: 1468607524-19021-6-git-send-email-eblake@redhat.com
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      1e2a77a8
    • E
      nbd: Rely on block layer to break up large requests · fb1a6de1
      Eric Blake 提交于
      Now that the block layer will honor max_transfer, we can simplify
      our code to rely on that guarantee.
      
      The readv code can call directly into nbd-client, just as the
      writev code has done since commit 52a46505.
      
      Interestingly enough, while qemu-io 'w 0 40m' splits into a 32M
      and 8M transaction, 'w -z 0 40m' splits into two 16M and an 8M,
      because the block layer caps the bounce buffer for writing zeroes
      at 16M.  When we later introduce support for NBD_CMD_WRITE_ZEROES,
      we can get a full 32M zero write (or larger, if the client and
      server negotiate that write zeroes can use a larger size than
      ordinary writes).
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NFam Zheng <famz@redhat.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Acked-by: NPaolo Bonzini <pbonzini@redhat.com>
      Message-id: 1468607524-19021-5-git-send-email-eblake@redhat.com
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      fb1a6de1
    • E
      block: Fragment writes to max transfer length · 04ed95f4
      Eric Blake 提交于
      Drivers should be able to rely on the block layer honoring the
      max transfer length, rather than needing to return -EINVAL
      (iscsi) or manually fragment things (nbd).  We already fragment
      write zeroes at the block layer; this patch adds the fragmentation
      for normal writes, after requests have been aligned (fragmenting
      before alignment would lead to multiple unaligned requests, rather
      than just the head and tail).
      
      When fragmenting a large request where FUA was requested, but
      where we know that FUA is implemented by flushing all requests
      rather than the given request, then we can still get by with
      only one flush.  Note, however, that we need a followup patch
      to the raw format driver to avoid a regression in the number of
      flushes actually issued.
      
      The return value was previously nebulous on success (sometimes
      zero, sometimes the length written); since we never have a short
      write, and since fragmenting may store yet another positive
      value in 'ret', change the function to always return 0 on success,
      matching what we do in bdrv_aligned_preadv().
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-id: 1468607524-19021-4-git-send-email-eblake@redhat.com
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      04ed95f4
    • E
      raw_bsd: Don't advertise flags not supported by protocol layer · 8a39b4d6
      Eric Blake 提交于
      The raw format layer supports all flags via passthrough - but
      it only makes sense to pass through flags that the lower layer
      actually supports.
      
      The next patch gives stronger reasoning for why this is correct.
      At the moment, the raw format layer ignores the max_transfer
      limit of its protocol layer, and an attempt to do the qemu-io
      'w -f 0 40m' to an NBD server that lacks FUA will pass the entire
      40m request to the NBD driver, which then fragments the request
      itself into a 32m write, 8m write, and flush.  But once the block
      layer starts honoring limits and fragmenting packets, the raw
      driver will hand the NBD driver two separate requests; if both
      requests have BDRV_REQ_FUA set, then this would result in a 32m
      write, flush, 8m write, and second flush.  By having the raw
      layer no longer advertise FUA support when the protocol layer
      lacks it, we are back to a single flush at the block layer for
      the overall 40m request.
      
      Note that 'w -f -z 0 40m' does not currently exhibit the same
      problem, because there, the fragmentation does not occur until
      at the NBD layer (the raw layer has .bdrv_co_pwrite_zeroes, and
      the NBD layer doesn't advertise max_pwrite_zeroes to constrain
      things at the raw layer) - but the problem is latent and we
      would again have too many flushes without this patch once the
      NBD layer implements support for the new NBD_CMD_WRITE_ZEROES
      command, if it sets max_pwrite_zeroes to the same 32m limit as
      recommended by the NBD protocol.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NFam Zheng <famz@redhat.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Message-id: 1468607524-19021-3-git-send-email-eblake@redhat.com
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      8a39b4d6
    • E
      block: Fragment reads to max transfer length · 1a62d0ac
      Eric Blake 提交于
      Drivers should be able to rely on the block layer honoring the
      max transfer length, rather than needing to return -EINVAL
      (iscsi) or manually fragment things (nbd).  This patch adds
      the fragmentation in the block layer, after requests have been
      aligned (fragmenting before alignment would lead to multiple
      unaligned requests, rather than just the head and tail).
      
      The return value was previously nebulous on success on whether
      it was zero or the length read; and fragmenting may introduce
      yet other non-zero values if we use the last length read.  But
      as at least some callers are sloppy and expect only zero on
      success, it is easiest to just guarantee 0.
      
      [Fix uninitialized ret local variable in bdrv_aligned_preadv().
      --Stefan]
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-id: 1468607524-19021-2-git-send-email-eblake@redhat.com
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      1a62d0ac
    • P
      Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20160719' into staging · 338404d0
      Peter Maydell 提交于
      target-arm queue:
       * fix two minor Coverity complaints
      
      # gpg: Signature made Tue 19 Jul 2016 18:02:34 BST
      # gpg:                using RSA key 0x3C2525ED14360CDE
      # gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>"
      # gpg:                 aka "Peter Maydell <pmaydell@gmail.com>"
      # gpg:                 aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>"
      # Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83  15CF 3C25 25ED 1436 0CDE
      
      * remotes/pmaydell/tags/pull-target-arm-20160719:
        arm_gicv3: Add assert()s to tell Coverity that offsets are aligned
        target-arm: Fix unreachable code in gicv3_class_name()
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      338404d0
    • P
      Merge remote-tracking branch 'remotes/riku/tags/pull-linux-user-20160719-2' into staging · 1ecfb24d
      Peter Maydell 提交于
      linux-user fixes before 2.7 freeze, fix commit message
      
      # gpg: Signature made Tue 19 Jul 2016 14:18:54 BST
      # gpg:                using RSA key 0xB44890DEDE3C9BC0
      # gpg: Good signature from "Riku Voipio <riku.voipio@iki.fi>"
      # gpg:                 aka "Riku Voipio <riku.voipio@linaro.org>"
      # Primary key fingerprint: FF82 03C8 C391 98AE 0581  41EF B448 90DE DE3C 9BC0
      
      * remotes/riku/tags/pull-linux-user-20160719-2:
        linux-user: AArch64 has sync_file_range, not sync_file_range2
        linux-user: Fix type for SIOCATMARK ioctl
        linux-user: define missing sparc syscalls
        linux-user: Fix terminal control ioctls
        linux-user: Add some new blk ioctls
        linux-user: Handle short lengths in host_to_target_sockaddr()
        linux-user: Forget about synchronous signal once it is delivered
        linux-user: Correct type for LOOP_GET_STATUS{,64} ioctls
        linux-user: Correct type for BLKSSZGET
        linux-user: Add loop control ioctls
        linux-user: Check sigsetsize argument to syscalls
        linux-user: add nested netlink types
        linux-user: convert sockaddr_ll from host to target
        linux-user: add fd_trans helper in do_recvfrom()
        linux-user: fix netlink memory corruption
        linux-user: fd_trans_*_data() returns the length
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      1ecfb24d
    • P
      arm_gicv3: Add assert()s to tell Coverity that offsets are aligned · acd82796
      Peter Maydell 提交于
      Coverity complains that the GICR_IPRIORITYR case in gicv3_readl()
      can overflow an array, because it doesn't know that the offsets
      passed to that function must be word aligned. Add some assert()s
      which hopefully tell Coverity that this isn't possible.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Message-id: 1468261372-17508-1-git-send-email-peter.maydell@linaro.org
      acd82796
    • P
      target-arm: Fix unreachable code in gicv3_class_name() · ff9d3e9c
      Peter Maydell 提交于
      Coverity complains that the exit() in gicv3_class_name()
      can be unreachable, because if TARGET_AARCH64 is defined
      then all code paths return before reaching it. Move the
      exit() up to the error_report() that it belongs with.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: NShannon Zhao <shannon.zhao@linaro.org>
      Message-id: 1468260552-8400-1-git-send-email-peter.maydell@linaro.org
      ff9d3e9c
  2. 19 7月, 2016 21 次提交