From 0c07fda3f5aaea64a1c358c200db90fa3c5208ae Mon Sep 17 00:00:00 2001 From: sageweil Date: Sat, 11 Aug 2007 23:15:01 +0000 Subject: [PATCH] misc cleanups git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@1625 29311d96-e01e-0410-9327-a35deaab8ce9 --- branches/sage/mds/TODO | 1 + branches/sage/mds/client/Client.cc | 34 +++++++++++++++++++++++- branches/sage/mds/config.cc | 2 +- branches/sage/mds/config.h | 2 +- branches/sage/mds/ebofs/Ebofs.cc | 7 +++-- branches/sage/mds/fakefuse.cc | 4 +-- branches/sage/mds/mds/Capability.h | 1 - branches/sage/mds/messages/MOSDOp.h | 1 + branches/sage/mds/messages/MOSDOpReply.h | 1 + branches/sage/mds/osd/FakeStore.cc | 2 +- 10 files changed, 46 insertions(+), 9 deletions(-) diff --git a/branches/sage/mds/TODO b/branches/sage/mds/TODO index b667ad5cd731b..e054faa939406 100644 --- a/branches/sage/mds/TODO +++ b/branches/sage/mds/TODO @@ -181,6 +181,7 @@ simplemessenger - exponential backoff on monitor resend attempts (actually, this should go outside the messenger!) objectcacher +- merge clean bh's - ocacher caps transitions vs locks - test read locks diff --git a/branches/sage/mds/client/Client.cc b/branches/sage/mds/client/Client.cc index 483051ff588b7..792aae6435061 100644 --- a/branches/sage/mds/client/Client.cc +++ b/branches/sage/mds/client/Client.cc @@ -2701,6 +2701,10 @@ void Client::unlock_fh_pos(Fh *f) } + +//char *hackbuf = 0; + + // blocking osd interface int Client::read(int fd, char *buf, off_t size, off_t offset) @@ -2766,6 +2770,19 @@ int Client::_read(Fh *f, off_t offset, off_t size, bufferlist *bl) if (g_conf.client_oc) { // object cache ON rvalue = r = in->fc.read(offset, size, *bl, client_lock); // may block. + + /* + if (in->inode.ino == 0x10000000075 && hackbuf) { + int s = MIN(size, bl->length()); + char *v = bl->c_str(); + for (int a=0; ainode->inode.ino == 0x10000000075) { + if (!hackbuf) { + dout(7) << "alloc and zero new hackbuf" << endl; + hackbuf = new char[16384]; + memset(hackbuf, 0, 16384); + } + dout(7) << "hackbuf copying " << offset << "~" << size << " first is " << (int)buf[0] << endl; + memcpy(hackbuf+offset, buf, size); + for (int a=0; afc.write(offset, size, blist, client_lock); - + } else { // legacy, inconsistent synchronous write. dout(7) << "synchronous write" << endl; diff --git a/branches/sage/mds/config.cc b/branches/sage/mds/config.cc index 82254c07afc18..d8a789ea001bc 100644 --- a/branches/sage/mds/config.cc +++ b/branches/sage/mds/config.cc @@ -253,7 +253,7 @@ md_config_t g_conf = { osd_pad_pg_log: false, // --- fakestore --- - fakestore_fake_sync: 2, // 2 seconds + fakestore_fake_sync: .5, // seconds fakestore_fsync: false,//true, fakestore_writesync: false, fakestore_syncthreads: 4, diff --git a/branches/sage/mds/config.h b/branches/sage/mds/config.h index ad907a1affa64..9076092aba739 100644 --- a/branches/sage/mds/config.h +++ b/branches/sage/mds/config.h @@ -250,7 +250,7 @@ struct md_config_t { int osd_max_pull; bool osd_pad_pg_log; - int fakestore_fake_sync; + double fakestore_fake_sync; bool fakestore_fsync; bool fakestore_writesync; int fakestore_syncthreads; // such crap diff --git a/branches/sage/mds/ebofs/Ebofs.cc b/branches/sage/mds/ebofs/Ebofs.cc index 21070781c1976..9b2259a5ee698 100644 --- a/branches/sage/mds/ebofs/Ebofs.cc +++ b/branches/sage/mds/ebofs/Ebofs.cc @@ -1558,9 +1558,12 @@ void Ebofs::apply_write(Onode *on, off_t off, size_t len, const bufferlist& bl) if (bl.length() == 0) { zleft += len; left = 0; + } else { + assert(bl.length() == len); } if (zleft) - dout(10) << "apply_write zeroing first " << zleft << " bytes of " << *on << endl; + dout(10) << "apply_write zeroing " << zleft << " bytes before " << off << "~" << len + << " in " << *on << endl; block_t blast = (len+off-1) / EBOFS_BLOCK_SIZE; block_t blen = blast-bstart+1; @@ -1648,7 +1651,7 @@ void Ebofs::apply_write(Onode *on, off_t off, size_t len, const bufferlist& bl) bufferlist zb; zb.push_back(zp); bh->add_partial(off_in_bh, zb); - zleft -= z; + zleft -= z; opos += z; } diff --git a/branches/sage/mds/fakefuse.cc b/branches/sage/mds/fakefuse.cc index d5c33c1cc1187..663a16b84d5c6 100644 --- a/branches/sage/mds/fakefuse.cc +++ b/branches/sage/mds/fakefuse.cc @@ -129,19 +129,19 @@ int main(int argc, char **argv) { // start up fuse // use my argc, argv (make sure you pass a mount point!) - cout << "starting fuse on pid " << getpid() << endl; client[i]->mount(); char *oldcwd = get_current_dir_name(); // note previous wd + cout << "starting fuse on pid " << getpid() << endl; if (g_conf.fuse_ll) ceph_fuse_ll_main(client[i], argc, argv); else ceph_fuse_main(client[i], argc, argv); + cout << "fuse finished on pid " << getpid() << endl; ::chdir(oldcwd); // return to previous wd free(oldcwd); client[i]->unmount(); - cout << "fuse finished on pid " << getpid() << endl; client[i]->shutdown(); } diff --git a/branches/sage/mds/mds/Capability.h b/branches/sage/mds/mds/Capability.h index eab6aa84b08bc..2c2241870650a 100644 --- a/branches/sage/mds/mds/Capability.h +++ b/branches/sage/mds/mds/Capability.h @@ -76,7 +76,6 @@ public: last_sent(s), last_recv(s), suppress(false) { - //cap_history[last_sent] = 0; } Capability(Export& other) : wanted_caps(other.wanted), diff --git a/branches/sage/mds/messages/MOSDOp.h b/branches/sage/mds/messages/MOSDOp.h index 43652dc5b9aed..9dce4bdd00b27 100644 --- a/branches/sage/mds/messages/MOSDOp.h +++ b/branches/sage/mds/messages/MOSDOp.h @@ -242,6 +242,7 @@ private: out << "osd_op(" << st.reqid << " " << get_opname(st.op) << " " << st.oid; + if (st.length) out << " " << st.offset << "~" << st.length; if (st.retry_attempt) out << " RETRY"; out << ")"; } diff --git a/branches/sage/mds/messages/MOSDOpReply.h b/branches/sage/mds/messages/MOSDOpReply.h index e23210b7e902a..bfe1674c07d3c 100644 --- a/branches/sage/mds/messages/MOSDOpReply.h +++ b/branches/sage/mds/messages/MOSDOpReply.h @@ -139,6 +139,7 @@ public: out << "osd_op_reply(" << st.reqid << " " << MOSDOp::get_opname(st.op) << " " << st.oid; + if (st.length) out << " " << st.offset << "~" << st.length; if (st.commit) out << " commit"; else diff --git a/branches/sage/mds/osd/FakeStore.cc b/branches/sage/mds/osd/FakeStore.cc index c945357c11586..683c24634defd 100644 --- a/branches/sage/mds/osd/FakeStore.cc +++ b/branches/sage/mds/osd/FakeStore.cc @@ -392,7 +392,7 @@ void FakeStore::sync() void FakeStore::sync(Context *onsafe) { - if (g_conf.fakestore_fake_sync) { + if (g_conf.fakestore_fake_sync > 0.0) { g_timer.add_event_after((float)g_conf.fakestore_fake_sync, new C_FakeSync(onsafe, &unsync, &synclock, &synccond)); -- 2.39.5