From 6393cf6981a052f2fae25e90b61ee845cc36424f Mon Sep 17 00:00:00 2001 From: sage Date: Sat, 18 Feb 2006 22:06:45 +0000 Subject: [PATCH] *** empty log message *** git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@652 29311d96-e01e-0410-9327-a35deaab8ce9 --- ceph/ebofs/Ebofs.cc | 39 +++++++++++++++++++++---------------- ceph/ebofs/Ebofs.h | 2 +- ceph/ebofs/Table.h | 47 +++++++++++++++++++++++++++------------------ ceph/osd/OSDMap.h | 4 ++-- ceph/osdc/Filer.h | 7 ++++--- 5 files changed, 57 insertions(+), 42 deletions(-) diff --git a/ceph/ebofs/Ebofs.cc b/ceph/ebofs/Ebofs.cc index e1b54643181f5..440548504b539 100644 --- a/ceph/ebofs/Ebofs.cc +++ b/ceph/ebofs/Ebofs.cc @@ -699,8 +699,12 @@ void Ebofs::write_onode(Onode *on) first = on->extent_map.begin()->second.start; allocator.allocate(on->onode_loc, blocks, first); + //if ((on->object_id & 0xffff) == 2) + if (on->object_id == 0x105b4a400000002ULL) + dout(0) << "write_onode (re)alloc " << *on << " to " << on->onode_loc << endl; object_tab->remove( on->object_id ); object_tab->insert( on->object_id, on->onode_loc ); + //object_tab->verify(); } dout(10) << "write_onode " << *on << " to " << on->onode_loc << endl; @@ -716,7 +720,7 @@ void Ebofs::write_onode(Onode *on) void Ebofs::remove_onode(Onode *on) { - //cout << "remove_onode " << *on << endl; + dout(8) << "remove_onode " << *on << endl; assert(on->get_ref_count() >= 1); // caller @@ -742,6 +746,7 @@ void Ebofs::remove_onode(Onode *on) on->dangling = true; // remove from object table + dout(0) << "remove_onode on " << *on << endl; object_tab->remove(on->object_id); // free onode space @@ -1873,7 +1878,7 @@ int Ebofs::truncate(object_t oid, off_t size) bool Ebofs::exists(object_t oid) { ebofs_lock.Lock(); - dout(7) << "exists " << hex << oid << dec << endl; + dout(8) << "exists " << hex << oid << dec << endl; bool e = (object_tab->lookup(oid) == 0); ebofs_lock.Unlock(); return e; @@ -1903,7 +1908,7 @@ int Ebofs::stat(object_t oid, struct stat *st) int Ebofs::setattr(object_t oid, const char *name, void *value, size_t size) { ebofs_lock.Lock(); - dout(7) << "setattr " << hex << oid << dec << " '" << name << "' len " << size << endl; + dout(8) << "setattr " << hex << oid << dec << " '" << name << "' len " << size << endl; Onode *on = get_onode(oid); if (!on) { @@ -1925,7 +1930,7 @@ int Ebofs::getattr(object_t oid, const char *name, void *value, size_t size) { int r = 0; ebofs_lock.Lock(); - dout(7) << "getattr " << hex << oid << dec << " '" << name << "' maxlen " << size << endl; + dout(8) << "getattr " << hex << oid << dec << " '" << name << "' maxlen " << size << endl; Onode *on = get_onode(oid); if (!on) { @@ -1947,7 +1952,7 @@ int Ebofs::getattr(object_t oid, const char *name, void *value, size_t size) int Ebofs::rmattr(object_t oid, const char *name) { ebofs_lock.Lock(); - dout(7) << "rmattr " << hex << oid << dec << " '" << name << "'" << endl; + dout(8) << "rmattr " << hex << oid << dec << " '" << name << "'" << endl; Onode *on = get_onode(oid); if (!on) { @@ -1967,7 +1972,7 @@ int Ebofs::rmattr(object_t oid, const char *name) int Ebofs::listattr(object_t oid, vector& attrs) { ebofs_lock.Lock(); - dout(7) << "listattr " << hex << oid << dec << endl; + dout(8) << "listattr " << hex << oid << dec << endl; Onode *on = get_onode(oid); if (!on) { @@ -1994,7 +1999,7 @@ int Ebofs::listattr(object_t oid, vector& attrs) int Ebofs::list_collections(list& ls) { ebofs_lock.Lock(); - dout(7) << "list_collections " << endl; + dout(9) << "list_collections " << endl; Table::Cursor cursor(collection_tab); @@ -2014,7 +2019,7 @@ int Ebofs::list_collections(list& ls) int Ebofs::create_collection(coll_t cid) { ebofs_lock.Lock(); - dout(7) << "create_collection " << hex << cid << dec << endl; + dout(9) << "create_collection " << hex << cid << dec << endl; if (_collection_exists(cid)) { ebofs_lock.Unlock(); @@ -2031,7 +2036,7 @@ int Ebofs::create_collection(coll_t cid) int Ebofs::destroy_collection(coll_t cid) { ebofs_lock.Lock(); - dout(7) << "destroy_collection " << hex << cid << dec << endl; + dout(9) << "destroy_collection " << hex << cid << dec << endl; if (!_collection_exists(cid)) { ebofs_lock.Unlock(); @@ -2059,7 +2064,7 @@ int Ebofs::destroy_collection(coll_t cid) bool Ebofs::collection_exists(coll_t cid) { ebofs_lock.Lock(); - dout(7) << "collection_exists " << hex << cid << dec << endl; + dout(10) << "collection_exists " << hex << cid << dec << endl; bool r = _collection_exists(cid); ebofs_lock.Unlock(); @@ -2073,7 +2078,7 @@ bool Ebofs::_collection_exists(coll_t cid) int Ebofs::collection_add(coll_t cid, object_t oid) { ebofs_lock.Lock(); - dout(7) << "collection_add " << hex << cid << " object " << oid << dec << endl; + dout(9) << "collection_add " << hex << cid << " object " << oid << dec << endl; if (!_collection_exists(cid)) { ebofs_lock.Unlock(); @@ -2090,7 +2095,7 @@ int Ebofs::collection_add(coll_t cid, object_t oid) int Ebofs::collection_remove(coll_t cid, object_t oid) { ebofs_lock.Lock(); - dout(7) << "collection_remove " << hex << cid << " object " << oid << dec << endl; + dout(9) << "collection_remove " << hex << cid << " object " << oid << dec << endl; if (!_collection_exists(cid)) { ebofs_lock.Unlock(); @@ -2114,7 +2119,7 @@ int Ebofs::collection_remove(coll_t cid, object_t oid) int Ebofs::collection_list(coll_t cid, list& ls) { ebofs_lock.Lock(); - dout(7) << "collection_list " << hex << cid << dec << endl; + dout(9) << "collection_list " << hex << cid << dec << endl; if (!_collection_exists(cid)) { ebofs_lock.Unlock(); @@ -2143,7 +2148,7 @@ int Ebofs::collection_list(coll_t cid, list& ls) int Ebofs::collection_setattr(coll_t cid, const char *name, void *value, size_t size) { ebofs_lock.Lock(); - dout(7) << "collection_setattr " << hex << cid << dec << " '" << name << "' len " << size << endl; + dout(10) << "collection_setattr " << hex << cid << dec << " '" << name << "' len " << size << endl; Cnode *cn = get_cnode(cid); if (!cn) { @@ -2164,7 +2169,7 @@ int Ebofs::collection_setattr(coll_t cid, const char *name, void *value, size_t int Ebofs::collection_getattr(coll_t cid, const char *name, void *value, size_t size) { ebofs_lock.Lock(); - dout(7) << "collection_setattr " << hex << cid << dec << " '" << name << "' maxlen " << size << endl; + dout(10) << "collection_setattr " << hex << cid << dec << " '" << name << "' maxlen " << size << endl; Cnode *cn = get_cnode(cid); if (!cn) { @@ -2184,7 +2189,7 @@ int Ebofs::collection_getattr(coll_t cid, const char *name, void *value, size_t int Ebofs::collection_rmattr(coll_t cid, const char *name) { ebofs_lock.Lock(); - dout(7) << "collection_rmattr " << hex << cid << dec << " '" << name << "'" << endl; + dout(10) << "collection_rmattr " << hex << cid << dec << " '" << name << "'" << endl; Cnode *cn = get_cnode(cid); if (!cn) { @@ -2204,7 +2209,7 @@ int Ebofs::collection_rmattr(coll_t cid, const char *name) int Ebofs::collection_listattr(coll_t cid, vector& attrs) { ebofs_lock.Lock(); - dout(7) << "collection_listattr " << hex << cid << dec << endl; + dout(10) << "collection_listattr " << hex << cid << dec << endl; Cnode *cn = get_cnode(cid); if (!cn) { diff --git a/ceph/ebofs/Ebofs.h b/ceph/ebofs/Ebofs.h index 4d7c4d5f1944f..7791e02833d2f 100644 --- a/ceph/ebofs/Ebofs.h +++ b/ceph/ebofs/Ebofs.h @@ -43,7 +43,7 @@ using namespace __gnu_cxx; typedef pair idpair_t; inline ostream& operator<<(ostream& out, idpair_t oc) { - return out << hex << oc.first << "->" << oc.second << dec << endl; + return out << hex << oc.first << "->" << oc.second << dec; } diff --git a/ceph/ebofs/Table.h b/ceph/ebofs/Table.h index c9d1874c5956c..bc21394a38b25 100644 --- a/ceph/ebofs/Table.h +++ b/ceph/ebofs/Table.h @@ -355,14 +355,16 @@ class Table { if (pos[level] == here.size()) { /* let's just move the cursor over! */ - dbtout << "shifting cursor right from " << here.get_id() << " to less-full node " << right.get_id() << endl; + //if (sizeof(K) == 8) + dbtout << "shifting cursor right from " << here.get_id() << " to less-full node " << right.get_id() << endl; open[level] = right; pos[level] = 0; pos[level-1]++; return 0; } - dbtout << "rotating item " << here.key(here.size()-1) << " right from " + //if (sizeof(K) == 8) + dbtout << "rotating item " << hex << here.key(here.size()-1) << dec << " right from " << here.get_id() << " to " << right.get_id() << endl; /* add */ @@ -553,6 +555,7 @@ class Table { // indices are already dirty cursor.open[cursor.level].insert_at_index_pos(cursor.pos[cursor.level], key, nodevalue); } + //if (sizeof(K) == 8) verify(); return 0; } } @@ -631,6 +634,9 @@ class Table { Cursor cursor(this); if (find(key, cursor) <= 0) { + cerr << "remove " << key << " 0x" << hex << key << dec << " .. dne" << endl; + g_conf.debug_ebofs = 33; + verify(); assert(0); return -1; // key dne } @@ -757,19 +763,20 @@ class Table { nkeys = 0; } - int verify(Cursor& cursor, int node_loc, int level, int& count) { + int verify_sub(Cursor& cursor, int node_loc, int level, int& count, K& last) { int err = 0; Nodeptr node = pool.get_node( node_loc ); cursor.open[level] = node; // identify max, min, and validate key range - int min = node.key(0); - int max = min; - int j = min; + K min = node.key(0); + last = min; + K max = min; for (int i=0; i max) @@ -778,10 +785,11 @@ class Table { if (level < depth-1) { // index cursor.pos[level] = i; - err += verify( cursor, cursor.open[level].index_item(i).node, level+1, count ); + err += verify_sub( cursor, cursor.open[level].index_item(i).node, level+1, count, last ); } else { // leaf count++; + last = node.key(i); } } @@ -790,16 +798,16 @@ class Table { if (min != cursor.open[level-1].index_item(cursor.pos[level-1]).key) { dbtout << ":: key in index node " << cursor.open[level-1].get_id() << " != min in child " << node_loc - << "(key is " << cursor.open[level-1].index_item(cursor.pos[level-1]).key - << ", min is " << min << ")" << endl; + << "(key is " << hex << cursor.open[level-1].index_item(cursor.pos[level-1]).key + << ", min is " << min << ")" << dec << endl; err++; } if (cursor.pos[level-1] < cursor.open[level-1].size()-1) { if (max > cursor.open[level-1].index_item(1+cursor.pos[level-1]).key) { dbtout << ":: next key in index node " << cursor.open[level-1].get_id() << " != max in child " << node_loc - << "(key is " << cursor.open[level-1].index_item(1+cursor.pos[level-1]).key - << ", max is " << max << ")" << endl; + << "(key is " << hex << cursor.open[level-1].index_item(1+cursor.pos[level-1]).key + << ", max is " << max << ")" << dec << endl; err++; } } @@ -814,21 +822,21 @@ class Table { if (1) { if (root == node_loc) { dbtout << s << "root " << node_loc << ": " - << node.size() << " / " << node.max_items() << " keys, " << min << "-" << max << endl; + << node.size() << " / " << node.max_items() << " keys, " << hex << min << "-" << max << dec << endl; } else if (level == depth-1) { dbtout << s << "leaf " << node_loc << ": " - << node.size() << " / " << node.max_items() << " keys, " << min << "-" << max << endl; + << node.size() << " / " << node.max_items() << " keys, " << hex << min << "-" << max << dec << endl; } else { dbtout << s << "indx " << node_loc << ": " - << node.size() << " / " << node.max_items() << " keys, " << min << "-" << max << endl; + << node.size() << " / " << node.max_items() << " keys, " << hex << min << "-" << max << dec << endl; } if (0) { for (int i=0; i " << node.leaf_item(i).value << endl; + dbtout << s << " " << hex << node.key(i) << " -> " << node.leaf_item(i).value << dec << endl; } } } @@ -843,7 +851,8 @@ class Table { if (root == -1 && depth == 0) { return; // empty! } - int err = verify(cursor, root, 0, count); + K last; + int err = verify_sub(cursor, root, 0, count, last); assert(err == 0); if (count != nkeys) { dbtout << "** count " << count << " != nkeys " << nkeys << endl; diff --git a/ceph/osd/OSDMap.h b/ceph/osd/OSDMap.h index e9bec4c989039..7ead825669d37 100644 --- a/ceph/osd/OSDMap.h +++ b/ceph/osd/OSDMap.h @@ -114,14 +114,14 @@ class OSDMap { switch (g_conf.osd_object_layout) { case OBJECT_LAYOUT_LINEAR: { - const object_t ono = oid & ((1 << OID_ONO_BITS)-1); + const object_t ono = oid & ((1ULL << OID_ONO_BITS)-1ULL); const inodeno_t ino = oid >> OID_ONO_BITS; return (ono + ino) & PG_PS_MASK; } case OBJECT_LAYOUT_HASHINO: { - const object_t ono = oid & ((1 << OID_ONO_BITS)-1); + const object_t ono = oid & ((1ULL << OID_ONO_BITS)-1ULL); const inodeno_t ino = oid >> OID_ONO_BITS; return (ono + H(ino)) & PG_PS_MASK; } diff --git a/ceph/osdc/Filer.h b/ceph/osdc/Filer.h index cd5e01e397163..ad7f9808fa7cf 100644 --- a/ceph/osdc/Filer.h +++ b/ceph/osdc/Filer.h @@ -172,9 +172,10 @@ class Filer : public Dispatcher { /* map (ino, ono) to an object name (to be used on any osd in the proper replica group) */ object_t file_to_object(inodeno_t ino, - size_t ono) { - assert(ino < (1LL<