1. 10 10月, 2019 1 次提交
    • V
      block/backup: use backup-top instead of write notifiers · 00e30f05
      Vladimir Sementsov-Ogievskiy 提交于
      Drop write notifiers and use filter node instead.
      
      = Changes =
      
      1. Add filter-node-name argument for backup qmp api. We have to do it
      in this commit, as 257 needs to be fixed.
      
      2. There are no more write notifiers here, so is_write_notifier
      parameter is dropped from block-copy paths.
      
      3. To sync with in-flight requests at job finish we now have drained
      removing of the filter, we don't need rw-lock.
      
      4. Block-copy is now using BdrvChildren instead of BlockBackends
      
      5. As backup-top owns these children, we also move block-copy state
      into backup-top's ownership.
      
      = Iotest changes =
      
      56: op-blocker doesn't shoot now, as we set it on source, but then
      check on filter, when trying to start second backup.
      To keep the test we instead can catch another collision: both jobs will
      get 'drive0' job-id, as job-id parameter is unspecified. To prevent
      interleaving with file-posix locks (as they are dependent on config)
      let's use another target for second backup.
      
      Also, it's obvious now that we'd like to drop this op-blocker at all
      and add a test-case for two backups from one node (to different
      destinations) actually works. But not in these series.
      
      141: Output changed: prepatch, "Node is in use" comes from bdrv_has_blk
      check inside qmp_blockdev_del. But we've dropped block-copy blk
      objects, so no more blk objects on source bs (job blk is on backup-top
      filter bs). New message is from op-blocker, which is the next check in
      qmp_blockdev_add.
      
      257: The test wants to emulate guest write during backup. They should
      go to filter node, not to original source node, of course. Therefore we
      need to specify filter node name and use it.
      Signed-off-by: NVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      Message-id: 20191001131409.14202-6-vsementsov@virtuozzo.com
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      00e30f05
  2. 17 8月, 2019 1 次提交
    • J
      block/backup: Add mirror sync mode 'bitmap' · c8b56501
      John Snow 提交于
      We don't need or want a new sync mode for simple differences in
      semantics.  Create a new mode simply named "BITMAP" that is designed to
      make use of the new Bitmap Sync Mode field.
      
      Because the only bitmap sync mode is 'on-success', this adds no new
      functionality to the backup job (yet). The old incremental backup mode
      is maintained as a syntactic sugar for sync=bitmap, mode=on-success.
      
      Add all of the plumbing necessary to support this new instruction.
      Signed-off-by: NJohn Snow <jsnow@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Message-id: 20190709232550.10724-6-jsnow@redhat.com
      Signed-off-by: NJohn Snow <jsnow@redhat.com>
      c8b56501
  3. 02 7月, 2019 1 次提交
  4. 18 6月, 2019 1 次提交
  5. 12 6月, 2019 1 次提交
  6. 19 3月, 2019 1 次提交
  7. 13 3月, 2019 2 次提交
  8. 25 2月, 2019 2 次提交
    • M
      block: Add strong_runtime_opts to BlockDriver · 2654267c
      Max Reitz 提交于
      This new field can be set by block drivers to list the runtime options
      they accept that may influence the contents of the respective BDS. As of
      a follow-up patch, this list will be used by the common
      bdrv_refresh_filename() implementation to decide which options to put
      into BDS.full_open_options (and consequently whether a JSON filename has
      to be created), thus freeing the drivers of having to implement that
      logic themselves.
      
      Additionally, this patch adds the field to all of the block drivers that
      need it and sets it accordingly.
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NAlberto Garcia <berto@igalia.com>
      Message-id: 20190201192935.18394-22-mreitz@redhat.com
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      2654267c
    • M
      block: Use bdrv_refresh_filename() to pull · f30c66ba
      Max Reitz 提交于
      Before this patch, bdrv_refresh_filename() is used in a pushing manner:
      Whenever the BDS graph is modified, the parents of the modified edges
      are supposed to be updated (recursively upwards).  However, that is
      nonviable, considering that we want child changes not to concern
      parents.
      
      Also, in the long run we want a pull model anyway: Here, we would have a
      bdrv_filename() function which returns a BDS's filename, freshly
      constructed.
      
      This patch is an intermediate step.  It adds bdrv_refresh_filename()
      calls before every place a BDS.filename value is used.  The only
      exceptions are protocol drivers that use their own filename, which
      clearly would not profit from refreshing that filename before.
      
      Also, bdrv_get_encrypted_filename() is removed along the way (as a user
      of BDS.filename), since it is completely unused.
      
      In turn, all of the calls to bdrv_refresh_filename() before this patch
      are removed, because we no longer have to call this function on graph
      changes.
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Message-id: 20190201192935.18394-2-mreitz@redhat.com
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      f30c66ba
  9. 14 12月, 2018 3 次提交
  10. 29 6月, 2018 1 次提交
  11. 23 5月, 2018 3 次提交
  12. 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
  13. 26 3月, 2018 1 次提交
  14. 09 2月, 2018 1 次提交
  15. 22 12月, 2017 1 次提交
  16. 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
  17. 17 11月, 2017 1 次提交
  18. 26 9月, 2017 1 次提交
  19. 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
  20. 07 5月, 2017 1 次提交
  21. 24 4月, 2017 1 次提交
  22. 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
  23. 01 3月, 2017 2 次提交
  24. 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
  25. 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
  26. 01 11月, 2016 1 次提交
  27. 28 10月, 2016 3 次提交
  28. 24 10月, 2016 1 次提交
  29. 13 9月, 2016 1 次提交