]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: distinguish between per-pool snap pools and user-managed snap pools
authorSage Weil <sage@newdream.net>
Mon, 15 Mar 2010 17:52:50 +0000 (10:52 -0700)
committerSage Weil <sage@newdream.net>
Tue, 6 Apr 2010 19:58:59 +0000 (12:58 -0700)
If removed_snaps is non-empty, then snaps are managed by the
user: snap context is specified for all writes (e.g., MDS or
librados user using the snap context api).

We can enforce this by adding an (unused) snapid (1) to the
removed_snaps the first time a non-pool snap snapid is allocated.

src/include/rados.h
src/osd/osd_types.h

index 41b777fef62c0d3fed8f5cf089b94cde4e10f18c..1c1bdc09120ac37cb560b3ef4bd9c058d0a1116e 100644 (file)
@@ -98,7 +98,7 @@ struct ceph_pg_pool {
        __le64 snap_seq;          /* seq for per-pool snapshot */
        __le32 snap_epoch;        /* epoch of last snap */
        __le32 num_snaps;
-       __le32 num_removed_snap_intervals;
+       __le32 num_removed_snap_intervals; /* if non-empty, NO per-pool snaps */
        __le64 auid;               /* who owns the pg */
 } __attribute__ ((packed));
 
index 3db36d574b97185156111db42d4667427064215e..78d5e43315fedb42f2c3cf4c90c108d4c7c92bca 100644 (file)
@@ -628,7 +628,7 @@ struct pg_pool_t {
    * explicit removed_snaps set.
    */
   void build_removed_snaps(interval_set<snapid_t>& rs) const {
-    if (snaps.size()) {
+    if (removed_snaps.empty()) {
       for (snapid_t s = 1; s <= get_snap_seq(); s = s + 1)
        if (snaps.count(s) == 0)
          rs.insert(s);