]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ErasureCode: plugin loading in progress flag
authorLoic Dachary <loic@dachary.org>
Thu, 19 Sep 2013 07:19:51 +0000 (09:19 +0200)
committerLoic Dachary <loic@dachary.org>
Thu, 19 Sep 2013 07:47:53 +0000 (09:47 +0200)
The bool loading data member of ErasureCodePluginRegistry is
set to true when a plugin is being loaded, to provide an observable side
effect for test purposes.

Signed-off-by: Loic Dachary <loic@dachary.org>
src/osd/ErasureCodePlugin.cc
src/osd/ErasureCodePlugin.h

index 10b65b2604b42504c85a19197856a18ed0134879..d8b9ae0fbbd81b589a6240466d25785a9e1c767b 100644 (file)
@@ -36,7 +36,8 @@ static ostream& _prefix(std::ostream* _dout)
 ErasureCodePluginRegistry ErasureCodePluginRegistry::singleton;
 
 ErasureCodePluginRegistry::ErasureCodePluginRegistry() :
-  lock("ErasureCodePluginRegistry::lock")
+  lock("ErasureCodePluginRegistry::lock"),
+  loading(false)
 {
 }
 
@@ -76,7 +77,9 @@ int ErasureCodePluginRegistry::factory(const std::string &plugin_name,
   int r = 0;
   ErasureCodePlugin *plugin = get(plugin_name);
   if (plugin == 0) {
+    loading = true;
     r = load(plugin_name, parameters, &plugin);
+    loading = false;
     if (r != 0)
       return r;
   }
index f1c1ccb31b32917f3a95212e2f26bda1cff77f9d..a2feb71695aba59b80327ab651de19f944a7c8c9 100644 (file)
@@ -41,6 +41,7 @@ namespace ceph {
   class ErasureCodePluginRegistry {
   public:
     Mutex lock;
+    bool loading;
     std::map<std::string,ErasureCodePlugin*> plugins;
 
     static ErasureCodePluginRegistry singleton;