From 13347862b095151d04c33272dd0762e0dbbc3f75 Mon Sep 17 00:00:00 2001 From: sage Date: Sun, 25 Dec 2005 18:13:35 +0000 Subject: [PATCH] *** empty log message *** git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@543 29311d96-e01e-0410-9327-a35deaab8ce9 --- ceph/Makefile | 2 +- ceph/config.cc | 2 +- ceph/ebofs/Ebofs.cc | 22 +++++++++++++++------- ceph/msg/TCPMessenger.cc | 24 ++++++++++++++++-------- ceph/osd/OSD.cc | 15 +++++++++------ ceph/osd/OSDMap.h | 6 +++--- ceph/tcpsyn.cc | 5 +++++ 7 files changed, 50 insertions(+), 26 deletions(-) diff --git a/ceph/Makefile b/ceph/Makefile index 8b1b922bc0f26..6fdae46c4dcc9 100644 --- a/ceph/Makefile +++ b/ceph/Makefile @@ -9,7 +9,7 @@ # behave just fine... change ${CC} back to mpicxx if you get paranoid. CC = g++ CFLAGS = -g -Wall -I. -D_FILE_OFFSET_BITS=64 -DMPICH_IGNORE_CXX_SEEK -D_REENTRANT -D_THREAD_SAFE -DUSE_EBOFS -LIBS = -lpthread -lrt -ldb +LIBS = -lpthread -lrt -ldb #for normal mpich2 machines MPICC = mpicxx diff --git a/ceph/config.cc b/ceph/config.cc index 5f0bf9b62d0f6..a5f2e37e9ca1d 100644 --- a/ceph/config.cc +++ b/ceph/config.cc @@ -108,7 +108,7 @@ md_config_t g_conf = { // --- osd --- - osd_pg_bits: 2, + osd_pg_bits: 8, osd_max_rep: 4, osd_fsync: true, osd_writesync: false, diff --git a/ceph/ebofs/Ebofs.cc b/ceph/ebofs/Ebofs.cc index d4e4813ec5b67..a4d58ae48495b 100644 --- a/ceph/ebofs/Ebofs.cc +++ b/ceph/ebofs/Ebofs.cc @@ -462,12 +462,12 @@ Onode* Ebofs::get_onode(object_t oid) // yep, just wait. Cond c; waitfor_onode[oid].push_back(&c); - dout(10) << "get_onode " << oid << " already loading, waiting" << endl; + dout(7) << "get_onode " << oid << " already loading, waiting" << endl; c.Wait(ebofs_lock); continue; } - dout(10) << "get_onode reading " << hex << oid << dec << " from " << onode_loc << endl; + dout(7) << "get_onode reading " << hex << oid << dec << " from " << onode_loc << endl; assert(waitfor_onode.count(oid) == 0); waitfor_onode[oid].clear(); // this should be empty initially. @@ -499,7 +499,7 @@ Onode* Ebofs::get_onode(object_t oid) p += sizeof(len); on->attr[key] = AttrVal(p, len); p += len; - dout(20) << "get_onode " << *on << " attr " << key << " len " << len << endl; + dout(7) << "get_onode " << *on << " attr " << key << " len " << len << endl; } // parse extents @@ -508,7 +508,7 @@ Onode* Ebofs::get_onode(object_t oid) for (int i=0; inum_extents; i++) { Extent ex = *((Extent*)p); on->extents.push_back(ex); - dout(20) << "get_onode " << *on << " ex " << i << ": " << ex << endl; + dout(7) << "get_onode " << *on << " ex " << i << ": " << ex << endl; n += ex.length; p += sizeof(Extent); } @@ -560,7 +560,7 @@ void Ebofs::write_onode(Onode *on) object_tab->insert( on->object_id, on->onode_loc ); } - dout(10) << "write_onode " << *on << " to " << on->onode_loc << endl; + dout(7) << "write_onode " << *on << " to " << on->onode_loc << endl; struct ebofs_onode *eo = (struct ebofs_onode*)bl.c_str(); eo->onode_loc = on->onode_loc; @@ -581,14 +581,14 @@ void Ebofs::write_onode(Onode *on) off += sizeof(int); bl.copy_in(off, i->second.len, i->second.data); off += i->second.len; - dout(20) << "write_onode " << *on << " attr " << i->first << " len " << i->second.len << endl; + dout(7) << "write_onode " << *on << " attr " << i->first << " len " << i->second.len << endl; } // extents for (unsigned i=0; iextents.size(); i++) { bl.copy_in(off, sizeof(Extent), (char*)&on->extents[i]); off += sizeof(Extent); - dout(20) << "write_onode " << *on << " ex " << i << ": " << on->extents[i] << endl; + dout(7) << "write_onode " << *on << " ex " << i << ": " << on->extents[i] << endl; } // write @@ -781,6 +781,8 @@ Cnode* Ebofs::get_cnode(object_t cid) continue; } + dout(7) << "get_cnode reading " << hex << cid << dec << " from " << cnode_loc << endl; + assert(waitfor_cnode.count(cid) == 0); waitfor_cnode[cid].clear(); // this should be empty initially. @@ -806,6 +808,8 @@ Cnode* Ebofs::get_cnode(object_t cid) int len = *(int*)(p); p += sizeof(len); cn->attr[key] = AttrVal(p, len); + p += len; + dout(7) << "get_cnode " << *cn << " attr " << key << " len " << len << endl; } // wake up other waiters @@ -839,6 +843,8 @@ void Ebofs::write_cnode(Cnode *cn) collection_tab->insert( cn->coll_id, cn->cnode_loc ); } + dout(7) << "write_cnode " << *cn << " to " << cn->cnode_loc << endl; + struct ebofs_cnode ec; ec.cnode_loc = cn->cnode_loc; ec.coll_id = cn->coll_id; @@ -857,6 +863,8 @@ void Ebofs::write_cnode(Cnode *cn) off += sizeof(int); bl.copy_in(off, i->second.len, i->second.data); off += i->second.len; + + dout(7) << "write_cnode " << *cn << " attr " << i->first << " len " << i->second.len << endl; } // write diff --git a/ceph/msg/TCPMessenger.cc b/ceph/msg/TCPMessenger.cc index 93c3d69c53864..3ab2fb5a7794a 100644 --- a/ceph/msg/TCPMessenger.cc +++ b/ceph/msg/TCPMessenger.cc @@ -407,20 +407,23 @@ bool tcp_read(int sd, char *buf, int len) return true; } -void tcp_write(int sd, char *buf, int len) +int tcp_write(int sd, char *buf, int len) { //dout(DBL) << "tcp_write writing " << len << endl; + assert(len > 0); while (len > 0) { int did = ::send( sd, buf, len, 0 ); if (did < 0) { dout(1) << "tcp_write error did = " << did << " errno " << errno << " " << strerror(errno) << endl; + cerr << "tcp_write error did = " << did << " errno " << errno << " " << strerror(errno) << endl; } - assert(did >= 0); + //assert(did >= 0); + if (did < 0) return did; len -= did; buf += did; dout(DBL) << "tcp_write did " << did << ", " << len << " left" << endl; } - + return 0; } @@ -554,7 +557,8 @@ int tcp_send(Message *m) dout(7) << "sending " << *m << " to " << MSG_ADDR_NICE(m->get_dest()) << " rank " << rank << endl;//" sd " << sd << ")" << endl; // send envelope - tcp_write( sd, (char*)env, sizeof(*env) ); + int r = tcp_write( sd, (char*)env, sizeof(*env) ); + if (r < 0) { cerr << "error sending envelope for " << *m << " to " << MSG_ADDR_NICE(m->get_dest()) << endl; assert(0); } // payload #ifdef TCP_KEEP_CHUNKS @@ -565,18 +569,22 @@ int tcp_send(Message *m) it++) { dout(DBL) << "tcp_sending frag " << i << " len " << (*it).length() << endl; int size = (*it).length(); - tcp_write( sd, (char*)&size, sizeof(size) ); - tcp_write( sd, (*it).c_str(), size ); + r = tcp_write( sd, (char*)&size, sizeof(size) ); + if (r < 0) { cerr << "error sending chunk len for " << *m << " to " << MSG_ADDR_NICE(m->get_dest()) << endl; assert(0); } + r = tcp_write( sd, (*it).c_str(), size ); + if (r < 0) { cerr << "error sending data chunk for " << *m << " to " << MSG_ADDR_NICE(m->get_dest()) << endl; assert(0); } i++; } #else // one big chunk int size = blist.length(); - tcp_write( sd, (char*)&size, sizeof(size) ); + r = tcp_write( sd, (char*)&size, sizeof(size) ); + if (r < 0) { cerr << "error sending data len for " << *m << " to " << MSG_ADDR_NICE(m->get_dest()) << endl; assert(0); } for (list::iterator it = blist.buffers().begin(); it != blist.buffers().end(); it++) { - tcp_write( sd, (*it).c_str(), (*it).length() ); + r = tcp_write( sd, (*it).c_str(), (*it).length() ); + if (r < 0) { cerr << "error sending data megachunk for " << *m << " to " << MSG_ADDR_NICE(m->get_dest()) << " : len " << (*it).length() << endl; assert(0); } } #endif diff --git a/ceph/osd/OSD.cc b/ceph/osd/OSD.cc index f9f927c3e48ad..1591b5f6aef43 100644 --- a/ceph/osd/OSD.cc +++ b/ceph/osd/OSD.cc @@ -160,6 +160,7 @@ int OSD::init() if (g_conf.osd_mkfs) { dout(1) << "mkfs" << endl; + store->mkfs(); } int r = store->mount(); @@ -1820,10 +1821,12 @@ public: void OSD::op_rep_modify_sync(MOSDOp *op) { osd_lock.Lock(); - dout(2) << "rep_modify_sync on op " << op << endl; - MOSDOpReply *ack2 = new MOSDOpReply(op, 0, osdmap, true); - messenger->send_message(ack2, op->get_asker()); - delete op; + { + dout(2) << "rep_modify_sync on op " << op << endl; + MOSDOpReply *ack2 = new MOSDOpReply(op, 0, osdmap, true); + messenger->send_message(ack2, op->get_asker()); + delete op; + } osd_lock.Unlock(); } @@ -2266,10 +2269,10 @@ public: void OSD::op_modify_sync(OSDReplicaOp *repop) { - dout(2) << "op_modify_sync on op " << repop->op << endl; - osd_lock.Lock(); { + dout(2) << "op_modify_sync on op " << repop->op << endl; + repop->local_sync = true; if (repop->can_send_sync()) { dout(2) << "op_modify_sync on " << hex << repop->op->get_oid() << dec << " op " << repop->op << endl; diff --git a/ceph/osd/OSDMap.h b/ceph/osd/OSDMap.h index c10acbd283969..b3ed21cb6129a 100644 --- a/ceph/osd/OSDMap.h +++ b/ceph/osd/OSDMap.h @@ -90,8 +90,8 @@ class OSDMap { // oid -> ps ps_t object_to_ps(object_t oid) { - static hash H; - return H(oid) & PG_PS_MASK; + static crush::Hash H(777); + return H( (oid & 0xffffffff) ^ (oid >> 32) ) & PG_PS_MASK; } // (ps, nrep) -> pg @@ -116,7 +116,7 @@ class OSDMap { vector& osds) { // list of osd addr's int num_rep = pg_to_nrep(pg); crush.do_rule(crush.rules[num_rep], - pg, + (pg & 0xffffffff) ^ (pg >> 32), osds); return osds.size(); } diff --git a/ceph/tcpsyn.cc b/ceph/tcpsyn.cc index fc3e3206cbd9f..ebeb40b5b83b3 100644 --- a/ceph/tcpsyn.cc +++ b/ceph/tcpsyn.cc @@ -73,6 +73,8 @@ int main(int argc, char **argv) int started = 0; + if (myrank == 0) g_conf.debug = 20; + // create mds MDS *mds[NUMMDS]; for (int i=0; i