From 937e6a03ea4692cc44d53faa0615f8e808c9eb03 Mon Sep 17 00:00:00 2001 From: David Zafman Date: Mon, 6 Feb 2017 21:31:18 -0800 Subject: [PATCH] osd: Remove unnecessary assert and assignment in DBObjectMap Fix and add comment(s) Signed-off-by: David Zafman --- src/os/filestore/DBObjectMap.cc | 4 +--- src/os/filestore/DBObjectMap.h | 12 ++++++------ 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/os/filestore/DBObjectMap.cc b/src/os/filestore/DBObjectMap.cc index 73c113dc5de63..0e5debc419cef 100644 --- a/src/os/filestore/DBObjectMap.cc +++ b/src/os/filestore/DBObjectMap.cc @@ -63,8 +63,6 @@ bool DBObjectMap::check(std::ostream &out) KeyValueDB::Iterator iter = db->get_iterator(HOBJECT_TO_SEQ); for (iter->seek_to_first(); iter->valid(); iter->next()) { _Header header; - assert(header.num_children == 1); - header.num_children = 0; // Hack for leaf node bufferlist bl = iter->value(); while (true) { bufferlist::iterator bliter = bl.begin(); @@ -1152,9 +1150,9 @@ DBObjectMap::Header DBObjectMap::lookup_parent(Header input) } Header header = Header(new _Header(), RemoveOnDelete(this)); - header->seq = input->parent; bufferlist::iterator iter = out.begin()->second.begin(); header->decode(iter); + assert(header->seq == input->parent); dout(20) << "lookup_parent: parent seq is " << header->seq << " with parent " << header->parent << dendl; in_use.insert(header->seq); diff --git a/src/os/filestore/DBObjectMap.h b/src/os/filestore/DBObjectMap.h index f65e2b600f38f..68d035cd9f897 100644 --- a/src/os/filestore/DBObjectMap.h +++ b/src/os/filestore/DBObjectMap.h @@ -30,7 +30,7 @@ * @see user_prefix * @see sys_prefix * - * - GHOBJECT_TO_SEQ: Contains leaf mapping from ghobject_t->hobj.seq and + * - HOBJECT_TO_SEQ: Contains leaf mapping from ghobject_t->header.seq and * corresponding omap header * - SYS_PREFIX: GLOBAL_STATE_KEY - contains next seq number * @see State @@ -218,7 +218,7 @@ class DBObjectMap : public ObjectMap { /// Ensure that all previous operations are durable int sync(const ghobject_t *oid=0, const SequencerPosition *spos=0) override; - /// Util, list all objects, there must be no other concurrent access + /// Util, get all objects, there must be no other concurrent access int list_objects(vector *objs ///< [out] objects ); @@ -276,28 +276,29 @@ class DBObjectMap : public ObjectMap { uint64_t parent; uint64_t num_children; - coll_t c; ghobject_t oid; SequencerPosition spos; void encode(bufferlist &bl) const { + coll_t unused; ENCODE_START(2, 1, bl); ::encode(seq, bl); ::encode(parent, bl); ::encode(num_children, bl); - ::encode(c, bl); + ::encode(unused, bl); ::encode(oid, bl); ::encode(spos, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator &bl) { + coll_t unused; DECODE_START(2, bl); ::decode(seq, bl); ::decode(parent, bl); ::decode(num_children, bl); - ::decode(c, bl); + ::decode(unused, bl); ::decode(oid, bl); if (struct_v >= 2) ::decode(spos, bl); @@ -308,7 +309,6 @@ class DBObjectMap : public ObjectMap { f->dump_unsigned("seq", seq); f->dump_unsigned("parent", parent); f->dump_unsigned("num_children", num_children); - f->dump_stream("coll") << c; f->dump_stream("oid") << oid; }