From: sage Date: Fri, 10 Jun 2005 15:51:52 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: v0.1~2093 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5a0803176bb605de3b5e70fe979ec647cc9e2741;p=ceph.git *** empty log message *** git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@288 29311d96-e01e-0410-9327-a35deaab8ce9 --- diff --git a/ceph/TODO b/ceph/TODO index b54acc4934b..472d28f500b 100644 --- a/ceph/TODO +++ b/ceph/TODO @@ -9,8 +9,9 @@ big fast todo's: - pseudo-mega-filesystem - osd copy-on-write.. -- osd failure structures -- heartbeatmonitor vs pingmonitor +- osd recovery structures (per-RG, etc) +- heartbeatmonitor vs pingmonitor? + diff --git a/ceph/client/SyntheticClient.cc b/ceph/client/SyntheticClient.cc index f0f11951b11..3af316acd85 100644 --- a/ceph/client/SyntheticClient.cc +++ b/ceph/client/SyntheticClient.cc @@ -167,9 +167,9 @@ int SyntheticClient::make_dirs(const char *basedir, int dirs, int files, int dep int SyntheticClient::write_file(string& fn, int size) // size is in MB { - int wrsize = 1024*256; + __uint64_t wrsize = 1024*256; char *buf = new char[wrsize]; // 1 MB - int chunks = size * 1024*1024 / wrsize; + __uint64_t chunks = (__uint64_t)size * (uint64_t)(1024*1024) / wrsize; int fd = client->open(fn.c_str(), O_WRONLY|O_CREAT); dout(5) << "writing to " << fn << " fd " << fd << endl; diff --git a/ceph/config.cc b/ceph/config.cc index 4edad99301f..960f6acaa75 100644 --- a/ceph/config.cc +++ b/ceph/config.cc @@ -47,6 +47,13 @@ md_config_t g_conf = { mds_verify_export_dirauth: true, + + // --- osd --- + + osd_fsync: true, + + + // --- fakeclient (mds regression testing) --- num_fakeclient: 100, fakeclient_requests: 100, diff --git a/ceph/config.h b/ceph/config.h index 557aa15ed96..aefc78b704b 100644 --- a/ceph/config.h +++ b/ceph/config.h @@ -39,6 +39,9 @@ struct md_config_t { bool mds_verify_export_dirauth; // debug flag + // osd + bool osd_fsync; + // fake client int num_fakeclient; unsigned fakeclient_requests; diff --git a/ceph/mds/IdAllocator.cc b/ceph/mds/IdAllocator.cc index 3fefc070538..aa0fd9a5d84 100644 --- a/ceph/mds/IdAllocator.cc +++ b/ceph/mds/IdAllocator.cc @@ -87,6 +87,24 @@ void IdAllocator::save() } +void IdAllocator::reset() +{ + free.clear(); + + // use generic range FIXME THIS IS CRAP + free[ID_INO].map_insert((long long)1000000LL * (mds->get_nodeid()+1), + (long long)1000000LL * (mds->get_nodeid()+2) - 1); + //free[ID_INO].dump(); + + free[ID_FH].map_insert(1000000LL * (mds->get_nodeid()+1), + 1000000LL * (mds->get_nodeid()+2) - 1); + //free[ID_FH].dump(); + + opened = true; + opening = false; +} + + class C_ID_Load : public Context { public: IdAllocator *ida; @@ -147,15 +165,7 @@ void IdAllocator::load_2(int r, bufferlist& blist, Context *onfinish) } else { dout(3) << "no alloc file, starting from scratch" << endl; - - // use generic range FIXME THIS IS CRAP - free[ID_INO].map_insert((long long)1000000LL * (mds->get_nodeid()+1), - (long long)1000000LL * (mds->get_nodeid()+2) - 1); - //free[ID_INO].dump(); - - free[ID_FH].map_insert(1000000LL * (mds->get_nodeid()+1), - 1000000LL * (mds->get_nodeid()+2) - 1); - //free[ID_FH].dump(); + reset(); } opened = true; diff --git a/ceph/mds/IdAllocator.h b/ceph/mds/IdAllocator.h index 23359c769e2..95089fd2c5f 100644 --- a/ceph/mds/IdAllocator.h +++ b/ceph/mds/IdAllocator.h @@ -36,6 +36,8 @@ class IdAllocator { bool is_open() { return opened; } bool is_opening() { return opening; } + void reset(); + void save(); void load(Context *onfinish); void load_2(int, bufferlist&, Context *onfinish); diff --git a/ceph/mds/MDCache.cc b/ceph/mds/MDCache.cc index 46f87d44cf9..1f89fd3a639 100644 --- a/ceph/mds/MDCache.cc +++ b/ceph/mds/MDCache.cc @@ -7198,11 +7198,13 @@ void MDCache::show_imports() set ecopy = exports; + timepair_t now = g_clock.gettimepair(); + for (set::iterator it = imports.begin(); it != imports.end(); it++) { CDir *im = *it; - dout(7) << " + import " << *im << endl; + dout(7) << " + import (" << im->popularity[MDS_POP_CURDOM].get(now) << "/" << im->popularity[MDS_POP_ANYDOM].get(now) << ") " << *im << endl; assert( im->is_import() ); assert( im->is_auth() ); @@ -7210,7 +7212,7 @@ void MDCache::show_imports() p != nested_exports[im].end(); p++) { CDir *exp = *p; - dout(7) << " - ex " << *exp << " to " << exp->dir_auth << endl; + dout(7) << " - ex (" << exp->popularity[MDS_POP_NESTED].get(now) << ", " << exp->popularity[MDS_POP_ANYDOM].get(now) << ")" << *exp << " to " << exp->dir_auth << endl; assert( exp->is_export() ); assert( !exp->is_auth() ); diff --git a/ceph/osd/FakeStore.cc b/ceph/osd/FakeStore.cc index 1a41af3c111..fc3f94dbeab 100644 --- a/ceph/osd/FakeStore.cc +++ b/ceph/osd/FakeStore.cc @@ -281,7 +281,8 @@ int FakeStore::read(object_t oid, int FakeStore::write(object_t oid, size_t len, off_t offset, - char *buffer) { + char *buffer, + bool do_fsync) { dout(20) << "write " << oid << " len " << len << " off " << offset << endl; if (is_shadow) shadow_copy_maybe(oid); @@ -299,6 +300,10 @@ int FakeStore::write(object_t oid, if (actual == offset) { did = ::write(fd, buffer, len); } + + // sync to to disk? + if (do_fsync) fsync(fd); // should this be fsync? + flock(fd, LOCK_UN); close(fd); diff --git a/ceph/osd/FakeStore.h b/ceph/osd/FakeStore.h index 7e440ad829f..a5a3c1619d8 100644 --- a/ceph/osd/FakeStore.h +++ b/ceph/osd/FakeStore.h @@ -52,7 +52,8 @@ class FakeStore : public ObjectStore { char *buffer); int write(object_t oid, size_t len, off_t offset, - char *buffer); + char *buffer, + bool fsync); }; #endif diff --git a/ceph/osd/OSD.cc b/ceph/osd/OSD.cc index 53d8518140f..4283f4e8945 100644 --- a/ceph/osd/OSD.cc +++ b/ceph/osd/OSD.cc @@ -247,7 +247,8 @@ void OSD::handle_write(MOSDWrite *m) it++) { int r = store->write(m->get_oid(), (*it).length(), off, - (*it).c_str()); + (*it).c_str(), + g_conf.osd_fsync); off += (*it).length(); if (r < 0) { dout(1) << "write error on " << m->get_oid() << " r = " << r << endl; diff --git a/ceph/osd/ObjectStore.h b/ceph/osd/ObjectStore.h index 279f4bd8add..1344d99df2c 100644 --- a/ceph/osd/ObjectStore.h +++ b/ceph/osd/ObjectStore.h @@ -26,7 +26,8 @@ class ObjectStore { char *buffer) = 0; virtual int write(object_t oid, size_t len, off_t offset, - char *buffer) = 0; + char *buffer, + bool fsync=true) = 0; /* // attributes