1. 03 3月, 2018 3 次提交
    • E
      block: Switch passthrough drivers to .bdrv_co_block_status() · 3e4d0e72
      Eric Blake 提交于
      We are gradually moving away from sector-based interfaces, towards
      byte-based.  Update the generic helpers, and all passthrough clients
      (blkdebug, commit, mirror, throttle) accordingly.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      Reviewed-by: NFam Zheng <famz@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      3e4d0e72
    • E
      nvme: Drop pointless .bdrv_co_get_block_status() · e3efee82
      Eric Blake 提交于
      Commit bdd6a90a has a bug: drivers should never directly set
      BDRV_BLOCK_ALLOCATED, but only io.c should do that (as needed).
      Instead, drivers should report BDRV_BLOCK_DATA if it knows that
      data comes from this BDS.
      
      But let's look at the bigger picture: semantically, the nvme
      driver is similar to the nbd, null, and raw drivers (no backing
      file, all data comes from this BDS).  But while two of those
      other drivers have to supply the callback (null because it can
      special-case BDRV_BLOCK_ZERO, raw because it can special-case
      a different offset), in this case the block layer defaults are
      good enough without the callback at all (similar to nbd).
      
      So, fix the bug by deletion ;)
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      e3efee82
    • E
      block: Add .bdrv_co_block_status() callback · 86a3d5c6
      Eric Blake 提交于
      We are gradually moving away from sector-based interfaces, towards
      byte-based. Now that the block layer exposes byte-based allocation,
      it's time to tackle the drivers.  Add a new callback that operates
      on as small as byte boundaries. Subsequent patches will then update
      individual drivers, then finally remove .bdrv_co_get_block_status().
      
      The new code also passes through the 'want_zero' hint, which will
      allow subsequent patches to further optimize callers that only care
      about how much of the image is allocated (want_zero is false),
      rather than full details about runs of zeroes and which offsets the
      allocation actually maps to (want_zero is true).  As part of this
      effort, fix another part of the documentation: the claim in commit
      4c41cb49 that BDRV_BLOCK_ALLOCATED is short for 'DATA || ZERO' is a
      lie at the block layer (see commit e88ae226), even though it is
      how the bit is computed from the driver layer.  After all, there
      are intentionally cases where we return ZERO but not ALLOCATED at
      the block layer, when we know that a read sees zero because the
      backing file is too short.  Note that the driver interface is thus
      slightly different than the public interface with regards to which
      bits will be set, and what guarantees are provided on input.
      
      We also add an assertion that any driver using the new callback will
      make progress (the only time pnum will be 0 is if the block layer
      already handled an out-of-bounds request, or if there is an error);
      the old driver interface did not provide this guarantee, which
      could lead to some inf-loops in drastic corner-case failures.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      Reviewed-by: NFam Zheng <famz@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      86a3d5c6
  2. 02 3月, 2018 37 次提交