1. 09 5月, 2013 11 次提交
    • A
      rbd: only set up watch for mapped images · 1f3ef788
      Alex Elder 提交于
      Any changes to parent images are immaterial to any mapped clone.
      So there is no need to have a watch event registered on header
      objects except for the header object of an image that is mapped.
      In fact, a watch request is a write operation, and we may only
      have read access to a parent image.
      
      We can't set up the watch request until we know the name of the
      header object though.  So pass a flag to rbd_dev_image_probe() to
      indicate whether this probe is for a mapping or for a parent image.
      
      Change the second parameter to rbd_dev_header_watch_sync() be
      Boolean while we're at it.
      
      This resolves:
          http://tracker.ceph.com/issues/4941Signed-off-by: NAlex Elder <elder@inktank.com>
      Reviewed-by: NJosh Durgin <josh.durgin@inktank.com>
      1f3ef788
    • A
      rbd: set mapping read-only flag in rbd_add() · 7ce4eef7
      Alex Elder 提交于
      The rbd_dev->mapping field for a parent image is not meaningful.
      Since rbd_image_probe() is used both for images being mapped and
      their parents, it doesn't make sense to set that flag in that
      function.
      
      So move the setting of the mapping.read_only flag out of
      rbd_dev_image_probe() and into rbd_add() instead.
      
      This resolves:
          http://tracker.ceph.com/issues/4940Signed-off-by: NAlex Elder <elder@inktank.com>
      Reviewed-by: NJosh Durgin <josh.durgin@inktank.com>
      7ce4eef7
    • A
      rbd: support reading parent page data · 5b2ab72d
      Alex Elder 提交于
      Currently, rbd_img_parent_read() assumes the incoming object request
      contains bio data.  But if a layered image is part of a multi-layer
      stack of images it will result in read requests of page data to parent
      images.
      
      Fortunately, it's not hard to add support for page data.
      
      This resolves:
          http://tracker.ceph.com/issues/4939Signed-off-by: NAlex Elder <elder@inktank.com>
      Reviewed-by: NJosh Durgin <josh.durgin@inktank.com>
      5b2ab72d
    • A
      rbd: fix an incorrect assertion condition · 91c6febb
      Alex Elder 提交于
      In rbd_img_obj_parent_read_full_callback() there is an assertion
      intended to verify the size of the image request for a full parent
      read was the size of the original request's target object.  But
      assertion was looking at the parent image order rather than the
      original one, and these values can differ.
      
      Fix that.
      
      This resolves:
          http://tracker.ceph.com/issues/4938Signed-off-by: NAlex Elder <elder@inktank.com>
      Reviewed-by: NJosh Durgin <josh.durgin@inktank.com>
      91c6febb
    • A
      rbd: define rbd_dev_v2_header_info() · 2df3fac7
      Alex Elder 提交于
      This rearranges rbd_dev_v2_refresh() so it works more like
      rbd_dev_v1_header_info().  While format 1 images need to read the
      whole header object to get any information, format 2 can collect
      almost all information selectively.  So the one-time initialization
      will remain in a separate function--based on rbd_dev_v2_probe().
      
      Rename rbd_dev_v2_refresh() to be rbd_dev_v2_header_info(), and have
      it call rbd_dev_v2_header_onetime() if it's being called for the
      first time for the given rbd device.
      
      Rename rbd_dev_v2_probe() to be rbd_dev_v2_header_onetime() and
      remove the image size and snapshot context calls it held in
      common with the refresh function.
      Signed-off-by: NAlex Elder <elder@inktank.com>
      Reviewed-by: NJosh Durgin <josh.durgin@inktank.com>
      2df3fac7
    • A
      rbd: get rid of trivial v1 header wrappers · 99a41ebc
      Alex Elder 提交于
      Get rid of the trivial wrapper functions rbd_dev_v1_refresh() and
      rbd_dev_v1_probe(), substituting rbd_dev_v1_header_read() calls
      in their place.
      
      Rename rbd_dev_v1_header_read() to be rbd_dev_v1_header_info(), to
      be more generic (it will better reflect what happens with format 2
      images).
      Signed-off-by: NAlex Elder <elder@inktank.com>
      Reviewed-by: NJosh Durgin <josh.durgin@inktank.com>
      99a41ebc
    • A
      rbd: simplify rbd_dev_v1_probe() · 30d60ba2
      Alex Elder 提交于
      An rbd_dev structure's fields are all zero-filled for an initial
      probe, so there's no need to explicitly zero the parent_spec
      and parent_overlap fields in rbd_dev_v1_probe().  Removing these
      assignments makes rbd_dev_v1_probe() *almost* trivial.
      
      Move the dout() message that announces discovery of an image into
      rbd_dev_image_probe(), generalize to support images in either format
      and only show it if an image is fully discovered.
      
      This highlights that are some unnecessary cleanups in the error
      path for rbd_dev_v1_probe(), so they can be removed.
      
      Now rbd_dev_v1_probe() *is* a trivial wrapper function.
      Signed-off-by: NAlex Elder <elder@inktank.com>
      Reviewed-by: NJosh Durgin <josh.durgin@inktank.com>
      30d60ba2
    • A
      rbd: update in-core header directly · 662518b1
      Alex Elder 提交于
      Now that rbd_header_from_disk() only fills in one-time fields once,
      we can extend it slightly so it releases the other fields before
      replacing their values.  This way there's no need to pass a
      temporary buffer and then copy all the results in.  Just use the rbd
      device header structure in rbd_header_from_disk() so its values get
      updated directly.
      
      Note that this means we need to take the header semaphore at the
      point we update things.  So pass the rbd_dev rather than the address
      of its header as its first argument to rbd_header_from_disk(), and
      have it return an error code.
      
      As a result, rbd_dev_v1_header_read() does all the work,
      rbd_read_header() becomes unnecessary, and rbd_dev_v1_refresh()
      becomes a very simple wrapper.
      Signed-off-by: NAlex Elder <elder@inktank.com>
      Reviewed-by: NJosh Durgin <josh.durgin@inktank.com>
      662518b1
    • A
      rbd: refactor rbd_header_from_disk() · bb23e37a
      Alex Elder 提交于
      This rearranges rbd_header_from_disk so that it:
          - allocates the snapshot context right away
          - keeps results in local variables, not changing the passed-in
            header until it's known we'll succeed
          - does initialization of set-once fields in a header only if
            they have not already been set
      
      The last point is moot at the moment, because rbd_read_header()
      (the only caller) always supplies a zero-filled header buffer.
      Signed-off-by: NAlex Elder <elder@inktank.com>
      Reviewed-by: NJosh Durgin <josh.durgin@inktank.com>
      bb23e37a
    • A
      rbd: zero format 1 header structure earlier · 46578dcd
      Alex Elder 提交于
      The passed-in header structure is zeroed in rbd_header_from_disk().
      Instead, have the caller do it.  Note that there are two callers,
      rbd_dev_v1_refresh() and rbd_dev_v1_probe().  The latter already has
      a zeroed header structure so zeroing it isn't necessary there.
      Signed-off-by: NAlex Elder <elder@inktank.com>
      Reviewed-by: NJosh Durgin <josh.durgin@inktank.com>
      46578dcd
    • A
      rbd: set the mapping size and features later · f35a4dee
      Alex Elder 提交于
      Defer setting the size and features fields of a mapped image until
      after the Linux disk structure is set up.  Set the capacity of the
      disk after that.
      
      Rearrange the definition of rbd_image_header, separating the fields
      that are set only once from those that can be updated.
      Signed-off-by: NAlex Elder <elder@inktank.com>
      Reviewed-by: NJosh Durgin <josh.durgin@inktank.com>
      f35a4dee
  2. 08 5月, 2013 8 次提交
  3. 03 5月, 2013 10 次提交
  4. 02 5月, 2013 11 次提交