]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: add new copyup helper method
authorJason Dillaman <dillaman@redhat.com>
Fri, 8 May 2015 19:15:29 +0000 (15:15 -0400)
committerJason Dillaman <dillaman@redhat.com>
Fri, 5 Jun 2015 15:46:30 +0000 (11:46 -0400)
ImageCtx::get_copyup_snap_id returns the oldest snapshot
to be used when calculating parent image overlaps.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
Conflicts:
src/librbd/AioRequest.cc

src/librbd/ImageCtx.cc
src/librbd/ImageCtx.h

index 298eeed12ffc8daca886c6dc0f0f7fa011294710..c5e253ebd0a328e85cb508dba3f22cc10cd8a795 100644 (file)
@@ -586,6 +586,17 @@ public:
     return -ENOENT;
   }
 
+  uint64_t ImageCtx::get_copyup_snap_id() const
+  {
+    assert(snap_lock.is_locked());
+    // copyup requires the largest possible parent overlap,
+    // which is always the oldest snapshot (if any).
+    if (!snaps.empty()) {
+      return snaps.back();
+    }
+    return CEPH_NOSNAP;
+  }
+
   void ImageCtx::aio_read_from_cache(object_t o, uint64_t object_no,
                                     bufferlist *bl, size_t len,
                                     uint64_t off, Context *onfinish,
index 11028705f593bc17b65beedfc9730ad6859dc4af..e0b5cb477ab7dd6b930f512115c78d162925303c 100644 (file)
@@ -210,6 +210,7 @@ namespace librbd {
     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 get_copyup_snap_id() const;
     void aio_read_from_cache(object_t o, uint64_t object_no, bufferlist *bl,
                             size_t len, uint64_t off, Context *onfinish,
                             int fadvise_flags);