From 00742289114323d2f9c56f2c1ddd45e48c000e6e Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 25 Mar 2013 20:59:11 -0700 Subject: [PATCH] osd: include SnapSet seq in the list snaps response It is important to know the latest seq that the object has seen in order to tell if a response like clone 2 snaps=[1,2] clone head snaps=[] was untouched before a hypothetical snap 3, or deleted prior to snap 3, and then recreated+modified after. Signed-off-by: Sage Weil --- src/osd/ReplicatedPG.cc | 1 + src/osd/osd_types.h | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 8a092739b13a3..117b84e4e5185 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -2351,6 +2351,7 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector& ops) resp.clones.push_back(ci); } + resp.seq = ssc->snapset.seq; resp.encode(osd_op.outdata); result = 0; diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index dbed64ec5d179..7889d94fb5adf 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -2183,15 +2183,21 @@ WRITE_CLASS_ENCODER(clone_info) */ struct obj_list_snap_response_t { vector clones; // ascending + snapid_t seq; void encode(bufferlist& bl) const { - ENCODE_START(1, 1, bl); + ENCODE_START(2, 1, bl); ::encode(clones, bl); + ::encode(seq, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator& bl) { - DECODE_START(1, bl); + DECODE_START(2, bl); ::decode(clones, bl); + if (struct_v >= 2) + ::decode(seq, bl); + else + seq = CEPH_NOSNAP; DECODE_FINISH(bl); } void dump(Formatter *f) const { @@ -2201,6 +2207,7 @@ struct obj_list_snap_response_t { p->dump(f); f->close_section(); } + f->dump_unsigned("seq", seq); f->close_section(); } static void generate_test_instances(list& o) { @@ -2218,6 +2225,7 @@ struct obj_list_snap_response_t { cl.overlap.clear(); cl.size = 32768; o.back()->clones.push_back(cl); + o.back()->seq = 123; } }; -- 2.39.5