Skip to content

Commit

Permalink
osd: Remove unnecessary assert and assignment in DBObjectMap
Browse files Browse the repository at this point in the history
Fix and add comment(s)

Signed-off-by: David Zafman <dzafman@redhat.com>
  • Loading branch information
dzafman committed Mar 27, 2017
1 parent 52468ae commit 937e6a0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
4 changes: 1 addition & 3 deletions src/os/filestore/DBObjectMap.cc
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand Down
12 changes: 6 additions & 6 deletions src/os/filestore/DBObjectMap.h
Expand Up @@ -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
Expand Down Expand Up @@ -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<ghobject_t> *objs ///< [out] objects
);

Expand Down Expand Up @@ -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);
Expand All @@ -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;
}

Expand Down

0 comments on commit 937e6a0

Please sign in to comment.