From: Sage Weil Date: Thu, 14 Oct 2010 20:37:59 +0000 (-0700) Subject: mds: add mds_skip_ino and mds_wipe_ino_prealloc options X-Git-Tag: v0.24~225 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8a21c6f6254b3fec71741b2cb9de53e9e2aeb3dc;p=ceph.git mds: add mds_skip_ino and mds_wipe_ino_prealloc options These are last-ditch recovery tools. Not particularly effective ones, though. Signed-off-by: Sage Weil --- diff --git a/src/config.cc b/src/config.cc index b652e5dc0f4d..503b55a82252 100644 --- a/src/config.cc +++ b/src/config.cc @@ -487,6 +487,8 @@ static struct config_option config_optionsp[] = { OPTION(mds_kill_export_at, 0, OPT_INT, 0), OPTION(mds_kill_import_at, 0, OPT_INT, 0), OPTION(mds_kill_rename_at, 0, OPT_INT, 0), + OPTION(mds_wipe_ino_prealloc, 0, OPT_BOOL, 0), + OPTION(mds_skip_ino, 0, OPT_LONGLONG, 0), OPTION(osd_data, 0, OPT_STR, ""), OPTION(osd_journal, 0, OPT_STR, ""), OPTION(osd_journal_size, 0, OPT_INT, 0), // in mb diff --git a/src/config.h b/src/config.h index 2aa8e02ae177..18d892f16d36 100644 --- a/src/config.h +++ b/src/config.h @@ -319,6 +319,9 @@ struct md_config_t { int mds_kill_import_at; int mds_kill_rename_at; + bool mds_wipe_ino_prealloc; + long long mds_skip_ino; + // osd const char *osd_data; const char *osd_journal; diff --git a/src/mds/InoTable.cc b/src/mds/InoTable.cc index 7f3cf4d5481a..aacb1282e2f8 100644 --- a/src/mds/InoTable.cc +++ b/src/mds/InoTable.cc @@ -135,3 +135,17 @@ void InoTable::replay_release_ids(interval_set& ids) projected_version = ++version; } + +void InoTable::skip_inos(inodeno_t i) +{ + dout(10) << "skip_inos was " << free << dendl; + inodeno_t first = free.range_start(); + inodeno_t last = first + i; + interval_set s; + s.insert(first, last); + s.intersection_of(free); + free.subtract(s); + projected_free = free; + projected_version = ++version; + dout(10) << "skip_inos now " << free << dendl; +} diff --git a/src/mds/InoTable.h b/src/mds/InoTable.h index ec74cc746466..c0d1cca7caf4 100644 --- a/src/mds/InoTable.h +++ b/src/mds/InoTable.h @@ -53,6 +53,8 @@ class InoTable : public MDSTable { ::decode(free, bl); projected_free = free; } + + void skip_inos(inodeno_t i); }; #endif diff --git a/src/mds/MDS.cc b/src/mds/MDS.cc index 26c7d4e4f8e6..ea3dabf8f1d8 100644 --- a/src/mds/MDS.cc +++ b/src/mds/MDS.cc @@ -1199,6 +1199,18 @@ void MDS::replay_done() return; } + if (g_conf.mds_wipe_ino_prealloc) { + dout(1) << "wiping out ino prealloc from sessions" << dendl; + sessionmap.wipe_ino_prealloc(); + sessionmap.save(new C_NoopContext); + } + if (g_conf.mds_skip_ino) { + inodeno_t i = g_conf.mds_skip_ino; + dout(1) << "skipping " << i << " inodes" << dendl; + inotable->skip_inos(i); + inotable->save(new C_NoopContext); + } + if (mdsmap->get_num_mds() == 1 && mdsmap->get_num_failed() == 0) { // just me! dout(2) << "i am alone, moving to state reconnect" << dendl; diff --git a/src/mds/SessionMap.cc b/src/mds/SessionMap.cc index 01da0218d4c0..3937280ff3ea 100644 --- a/src/mds/SessionMap.cc +++ b/src/mds/SessionMap.cc @@ -210,3 +210,18 @@ void SessionMap::decode(bufferlist::iterator& p) } } } + + + + +void SessionMap::wipe_ino_prealloc() +{ + for (hash_map::iterator p = session_map.begin(); + p != session_map.end(); + ++p) { + p->second->pending_prealloc_inos.clear(); + p->second->prealloc_inos.clear(); + p->second->used_inos.clear(); + } + projected = ++version; +} diff --git a/src/mds/SessionMap.h b/src/mds/SessionMap.h index 375136755eb7..8141b134b588 100644 --- a/src/mds/SessionMap.h +++ b/src/mds/SessionMap.h @@ -358,6 +358,8 @@ public: session->trim_completed_requests(tid); } + void wipe_ino_prealloc(); + // -- loading, saving -- inodeno_t ino; list waiting_for_load;