Skip to content

Commit

Permalink
osd: use ceph_map/ceph_list in Transaction object
Browse files Browse the repository at this point in the history
Signed-off-by: Evgeniy Firsov <evgeniy.firsov@sandisk.com>
  • Loading branch information
Evgeniy Firsov committed Jan 5, 2016
1 parent 362c5c4 commit e2df67f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 8 deletions.
18 changes: 18 additions & 0 deletions src/include/Context.h
Expand Up @@ -188,6 +188,9 @@ class C_ContextsBase : public ContextInstanceType {
void take(std::list<ContextType*>& ls) {
contexts.splice(contexts.end(), ls);
}
void take(ceph_list<ContextType*>& ls) {
contexts.insert(contexts.end(), ls.begin(), ls.end());
}
void complete(int r) {
// Neuter any ContextInstanceType custom complete(), because although
// I want to look like it, I don't actually want to run its code.
Expand All @@ -211,8 +214,23 @@ class C_ContextsBase : public ContextInstanceType {
return c;
}
}

static ContextType *list_to_context(ceph_list<ContextType *> &cs) {
if (cs.size() == 0) {
return 0;
} else if (cs.size() == 1) {
ContextType *c = cs.front();
cs.clear();
return c;
} else {
C_ContextsBase<ContextType, ContextInstanceType> *c(new C_ContextsBase<ContextType, ContextInstanceType>(0));
c->take(cs);
return c;
}
}
};


typedef C_ContextsBase<Context, Context> C_Contexts;


Expand Down
16 changes: 8 additions & 8 deletions src/os/ObjectStore.h
Expand Up @@ -447,8 +447,8 @@ class ObjectStore {
bool use_tbl; //use_tbl for encode/decode
bufferlist tbl;

map<coll_t, __le32> coll_index;
map<ghobject_t, __le32, ghobject_t::BitwiseComparator> object_index;
ceph_map<coll_t, __le32> coll_index;
ceph_map<ghobject_t, __le32, ghobject_t::BitwiseComparator> object_index;

__le32 coll_id;
__le32 object_id;
Expand All @@ -458,9 +458,9 @@ class ObjectStore {

bufferptr op_ptr;

list<Context *> on_applied;
list<Context *> on_commit;
list<Context *> on_applied_sync;
ceph_list<Context *> on_applied;
ceph_list<Context *> on_commit;
ceph_list<Context *> on_applied_sync;

public:

Expand Down Expand Up @@ -496,9 +496,9 @@ class ObjectStore {
for (list<Transaction *>::iterator i = t.begin();
i != t.end();
++i) {
on_applied.splice(on_applied.end(), (*i)->on_applied);
on_commit.splice(on_commit.end(), (*i)->on_commit);
on_applied_sync.splice(on_applied_sync.end(), (*i)->on_applied_sync);
on_applied.insert(on_applied.end(), (*i)->on_applied.begin(), (*i)->on_applied.end());
on_commit.insert(on_commit.end(), (*i)->on_commit.begin(), (*i)->on_commit.end());
on_applied_sync.insert(on_applied_sync.end(), (*i)->on_applied_sync.begin(), (*i)->on_applied_sync.end());
}
*out_on_applied = C_Contexts::list_to_context(on_applied);
*out_on_commit = C_Contexts::list_to_context(on_commit);
Expand Down

0 comments on commit e2df67f

Please sign in to comment.