]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: add mds_skip_ino and mds_wipe_ino_prealloc options
authorSage Weil <sage@newdream.net>
Thu, 14 Oct 2010 20:37:59 +0000 (13:37 -0700)
committerSage Weil <sage@newdream.net>
Tue, 9 Nov 2010 17:55:32 +0000 (09:55 -0800)
These are last-ditch recovery tools.  Not particularly effective ones,
though.

Signed-off-by: Sage Weil <sage@newdream.net>
src/config.cc
src/config.h
src/mds/InoTable.cc
src/mds/InoTable.h
src/mds/MDS.cc
src/mds/SessionMap.cc
src/mds/SessionMap.h

index b652e5dc0f4d20956c0b9f64285638cec3b8fb90..503b55a82252bf7648c65fa21a40657b82427768 100644 (file)
@@ -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
index 2aa8e02ae177f62f043b6beca5862c0026328c6d..18d892f16d36b266e2b782343ed2cbdfcc8c3866 100644 (file)
@@ -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;
index 7f3cf4d5481a1afbb9e15482e2ed571d466310af..aacb1282e2f8d06e406b0341870def91db55791e 100644 (file)
@@ -135,3 +135,17 @@ void InoTable::replay_release_ids(interval_set<inodeno_t>& 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<inodeno_t> 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;
+}
index ec74cc74646698ddf7bc9fcb4acc4deb7c3ba5b0..c0d1cca7caf4098fed2afcbacdd2bd66745119be 100644 (file)
@@ -53,6 +53,8 @@ class InoTable : public MDSTable {
     ::decode(free, bl);
     projected_free = free;
   }
+
+  void skip_inos(inodeno_t i);
 };
 
 #endif
index 26c7d4e4f8e676812f50882a944174f5dc3253e6..ea3dabf8f1d856093389503e1c489ef2b99fbbc8 100644 (file)
@@ -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;      
index 01da0218d4c034c17671030f88c7be51f1210b47..3937280ff3eae963f6a561490010f517db8d783b 100644 (file)
@@ -210,3 +210,18 @@ void SessionMap::decode(bufferlist::iterator& p)
     }
   }
 }
+
+
+
+
+void SessionMap::wipe_ino_prealloc()
+{
+  for (hash_map<entity_name_t,Session*>::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;
+}
index 375136755eb7440440cbdae498564a3eb392cad3..8141b134b58802975a722f9993703cc5e6631188 100644 (file)
@@ -358,6 +358,8 @@ public:
     session->trim_completed_requests(tid);
   }
 
+  void wipe_ino_prealloc();
+
   // -- loading, saving --
   inodeno_t ino;
   list<Context*> waiting_for_load;