1. 29 6月, 2018 1 次提交
  2. 23 5月, 2018 3 次提交
  3. 15 5月, 2018 1 次提交
    • E
      block: Merge .bdrv_co_writev{,_flags} in drivers · e18a58b4
      Eric Blake 提交于
      We have too many driver callback interfaces; simplify the mess
      somewhat by merging the flags parameter of .bdrv_co_writev_flags()
      into .bdrv_co_writev().  Note that as long as a driver doesn't set
      .supported_write_flags, the flags argument will be 0 and behavior is
      identical.  Also note that the public function bdrv_co_writev() still
      lacks a flags argument; so the driver signature is thus intentionally
      slightly different.  But that's not the end of the world, nor the first
      time that the driver interface differs slightly from the public
      interface.
      
      Ideally, we should be rewriting all of these drivers to use modern
      byte-based interfaces.  But that's a more invasive patch to write
      and audit, compared to the simplification done here.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      e18a58b4
  4. 26 3月, 2018 1 次提交
  5. 09 2月, 2018 1 次提交
  6. 22 12月, 2017 1 次提交
  7. 18 11月, 2017 1 次提交
    • M
      block: Guard against NULL bs->drv · d470ad42
      Max Reitz 提交于
      We currently do not guard everywhere against a NULL bs->drv where we
      should be doing so.  Most of the places fixed here just do not care
      about that case at all.
      
      Some care implicitly, e.g. through a prior function call to
      bdrv_getlength() which would always fail for an ejected BDS.  Add an
      assert there to make it more obvious.
      
      Other places seem to care, but do so insufficiently: Freeing clusters in
      a qcow2 image is an error-free operation, but it may leave the image in
      an unusable state anyway.  Giving qcow2_free_clusters() an error code is
      not really viable, it is much easier to note that bs->drv may be NULL
      even after a successful driver call.  This concerns bdrv_co_flush(), and
      the way the check is added to bdrv_co_pdiscard() (in every iteration
      instead of only once).
      
      Finally, some places employ at least an assert(bs->drv); somewhere, that
      may be reasonable (such as in the reopen code), but in
      bdrv_has_zero_init(), it is definitely not.  Returning 0 there in case
      of an ejected BDS saves us much headache instead.
      Reported-by: NR. Nageswara Sastry <nasastry@in.ibm.com>
      Buglink: https://bugs.launchpad.net/qemu/+bug/1728660Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Message-id: 20171110203111.7666-4-mreitz@redhat.com
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      d470ad42
  8. 17 11月, 2017 1 次提交
  9. 26 9月, 2017 1 次提交
  10. 10 7月, 2017 2 次提交
    • E
      block: Make bdrv_is_allocated_above() byte-based · 51b0a488
      Eric Blake 提交于
      We are gradually moving away from sector-based interfaces, towards
      byte-based.  In the common case, allocation is unlikely to ever use
      values that are not naturally sector-aligned, but it is possible
      that byte-based values will let us be more precise about allocation
      at the end of an unaligned file that can do byte-based access.
      
      Changing the signature of the function to use int64_t *pnum ensures
      that the compiler enforces that all callers are updated.  For now,
      the io.c layer still assert()s that all callers are sector-aligned,
      but that can be relaxed when a later patch implements byte-based
      block status.  Therefore, for the most part this patch is just the
      addition of scaling at the callers followed by inverse scaling at
      bdrv_is_allocated().  But some code, particularly stream_run(),
      gets a lot simpler because it no longer has to mess with sectors.
      Leave comments where we can further simplify by switching to
      byte-based iterations, once later patches eliminate the need for
      sector-aligned operations.
      
      For ease of review, bdrv_is_allocated() was tackled separately.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      51b0a488
    • E
      backup: Switch block_backup.h to byte-based · f6ac2078
      Eric Blake 提交于
      We are gradually converting to byte-based interfaces, as they are
      easier to reason about than sector-based.  Continue by converting
      the public interface to backup jobs (no semantic change), including
      a change to CowRequest to track by bytes instead of cluster indices.
      
      Note that this does not change the difference between the public
      interface (starting point, and size of the subsequent range) and
      the internal interface (starting and end points).
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NJohn Snow <jsnow@redhat.com>
      Reviewed-by: NXie Changlong <xiechanglong@cmss.chinamobile.com>
      Reviewed-by: NJeff Cody <jcody@redhat.com>
      Reviewed-by: NKevin Wolf <kwolf@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      f6ac2078
  11. 07 5月, 2017 1 次提交
  12. 24 4月, 2017 1 次提交
  13. 17 3月, 2017 1 次提交
    • C
      replication: clarify permissions · 37a9051c
      Changlong Xie 提交于
      Even if hidden_disk, secondary_disk are backing files, they all need
      write permissions in replication scenario. Otherwise we will encouter
      below exceptions on secondary side during adding nbd server:
      
      {'execute': 'nbd-server-add', 'arguments': {'device': 'colo-disk', 'writable': true } }
      {"error": {"class": "GenericError", "desc": "Conflicts with use by hidden-qcow2-driver as 'backing', which does not allow 'write' on sec-qcow2-driver-for-nbd"}}
      
      CC: Zhang Hailiang <zhang.zhanghailiang@huawei.com>
      CC: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
      CC: Wen Congyang <wencongyang2@huawei.com>
      Signed-off-by: NChanglong Xie <xiecl.fnst@cn.fujitsu.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      37a9051c
  14. 01 3月, 2017 2 次提交
  15. 24 2月, 2017 1 次提交
    • K
      block: Attach bs->file only during .bdrv_open() · 4e4bf5c4
      Kevin Wolf 提交于
      The way that attaching bs->file worked was a bit unusual in that it was
      the only child that would be attached to a node which is not opened yet.
      Because of this, the block layer couldn't know yet which permissions the
      driver would eventually need.
      
      This patch moves the point where bs->file is attached to the beginning
      of the individual .bdrv_open() implementations, so drivers already know
      what they are going to do with the child. This is also more consistent
      with how driver-specific children work.
      
      For a moment, bdrv_open() gets its own BdrvChild to perform image
      probing, but instead of directly assigning this BdrvChild to the BDS, it
      becomes a temporary one and the node name is passed as an option to the
      drivers, so that they can simply use bdrv_open_child() to create another
      reference for their own use.
      
      This duplicated child for (the not opened yet) bs is not the final
      state, a follow-up patch will change the image probing code to use a
      BlockBackend, which is completely independent of bs.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      4e4bf5c4
  16. 15 11月, 2016 1 次提交
    • J
      blockjob: refactor backup_start as backup_job_create · 111049a4
      John Snow 提交于
      Refactor backup_start as backup_job_create, which only creates the job,
      but does not automatically start it. The old interface, 'backup_start',
      is not kept in favor of limiting the number of nearly-identical interfaces
      that would have to be edited to keep up with QAPI changes in the future.
      
      Callers that wish to synchronously start the backup_block_job can
      instead just call block_job_start immediately after calling
      backup_job_create.
      
      Transactions are updated to use the new interface, calling block_job_start
      only during the .commit phase, which helps prevent race conditions where
      jobs may finish before we even finish building the transaction. This may
      happen, for instance, during empty block backup jobs.
      Reported-by: NVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      Signed-off-by: NJohn Snow <jsnow@redhat.com>
      Message-id: 1478587839-9834-6-git-send-email-jsnow@redhat.com
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      111049a4
  17. 01 11月, 2016 1 次提交
  18. 28 10月, 2016 3 次提交
  19. 24 10月, 2016 1 次提交
  20. 13 9月, 2016 1 次提交