From: Ilya Dryomov Date: Fri, 14 Oct 2022 14:01:45 +0000 (+0200) Subject: librbd: tweak get_parent_overlap() signature X-Git-Tag: v18.1.0~754^2~13 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=50070a78a899df5249d8d0c69f8fe417d8b36410;p=ceph.git librbd: tweak get_parent_overlap() signature Make it clear that get_parent_overlap() returns the raw parent overlap value (i.e. physical offset into the parent image). Also drop redundant ceph_mutex_is_locked assert -- get_parent_info() already has one. Signed-off-by: Ilya Dryomov --- diff --git a/src/librbd/ImageCtx.cc b/src/librbd/ImageCtx.cc index ab74d6a07818..1ca88b4168ce 100644 --- a/src/librbd/ImageCtx.cc +++ b/src/librbd/ImageCtx.cc @@ -672,12 +672,11 @@ librados::IoCtx duplicate_io_ctx(librados::IoCtx& io_ctx) { return CEPH_NOSNAP; } - int ImageCtx::get_parent_overlap(snap_t in_snap_id, uint64_t *overlap) const - { - ceph_assert(ceph_mutex_is_locked(image_lock)); + int ImageCtx::get_parent_overlap(snap_t in_snap_id, + uint64_t* raw_overlap) const { const auto info = get_parent_info(in_snap_id); if (info) { - *overlap = info->overlap; + *raw_overlap = info->overlap; return 0; } return -ENOENT; diff --git a/src/librbd/ImageCtx.h b/src/librbd/ImageCtx.h index a1a7ec3016dc..f9ce6dd16da0 100644 --- a/src/librbd/ImageCtx.h +++ b/src/librbd/ImageCtx.h @@ -322,7 +322,7 @@ namespace librbd { std::string get_parent_image_id(librados::snap_t in_snap_id) const; uint64_t get_parent_snap_id(librados::snap_t in_snap_id) const; int get_parent_overlap(librados::snap_t in_snap_id, - uint64_t *overlap) const; + uint64_t* raw_overlap) const; void register_watch(Context *on_finish); uint64_t prune_parent_extents(std::vector >& objectx, uint64_t overlap); diff --git a/src/test/librbd/mock/MockImageCtx.h b/src/test/librbd/mock/MockImageCtx.h index 118da64e5bfb..6d84521616b6 100644 --- a/src/test/librbd/mock/MockImageCtx.h +++ b/src/test/librbd/mock/MockImageCtx.h @@ -85,7 +85,7 @@ struct MockImageCtx { cls::rbd::ParentImageSpec *pspec)); MOCK_CONST_METHOD1(get_parent_info, const ParentImageInfo*(librados::snap_t)); MOCK_CONST_METHOD2(get_parent_overlap, int(librados::snap_t in_snap_id, - uint64_t *overlap)); + uint64_t *raw_overlap)); MOCK_CONST_METHOD2(prune_parent_extents, uint64_t(std::vector >& , uint64_t));