]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/ReplicatedPG: preserve clean/dirty state on clone
authorSage Weil <sage@inktank.com>
Mon, 30 Dec 2013 20:54:03 +0000 (12:54 -0800)
committerSage Weil <sage@inktank.com>
Tue, 14 Jan 2014 00:19:47 +0000 (16:19 -0800)
If we have a clean object and clone it in make_writeable(), the clone
should also be clean (it does not need to be written back to the base
pool).  If the object was dirty, the clone should be dirty.

Signed-off-by: Sage Weil <sage@inktank.com>
src/osd/ReplicatedPG.cc

index ea862ccb700543a8e9e4eb79fbca900be919edae..69762096f96af6edce7910c3f9e24c8459122909 100644 (file)
@@ -4288,6 +4288,8 @@ void ReplicatedPG::make_writeable(OpContext *ctx)
   dout(20) << "make_writeable " << soid << " snapset=" << ctx->snapset
           << "  snapc=" << snapc << dendl;;
   
+  bool was_dirty = ctx->new_obs.oi.is_dirty();
+
   if (ctx->new_obs.exists) {
     // we will mark the object dirty
     if (ctx->undirty) {
@@ -4342,6 +4344,8 @@ void ReplicatedPG::make_writeable(OpContext *ctx)
     snap_oi->prior_version = ctx->obs->oi.version;
     snap_oi->copy_user_bits(ctx->obs->oi);
     snap_oi->snaps = snaps;
+    if (was_dirty)
+      snap_oi->set_flag(object_info_t::FLAG_DIRTY);
     _make_clone(t, soid, coid, snap_oi);
     
     OSDriver::OSTransaction _t(osdriver.get_transaction(&(ctx->local_t)));