]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: expose static default file layout methods
authorJohn Spray <john.spray@redhat.com>
Mon, 11 May 2015 12:03:36 +0000 (13:03 +0100)
committerJohn Spray <john.spray@redhat.com>
Tue, 12 May 2015 09:23:27 +0000 (10:23 +0100)
So that tools can invoke these to get the defaults
without a fully baked MDCache.

Signed-off-by: John Spray <john.spray@redhat.com>
src/mds/MDCache.cc
src/mds/MDCache.h

index 43825b55623b5cbcba54ac587d2d7908c1b4d250..c644b3fdaa3113c1800055f0efb88ef3057b6748 100644 (file)
@@ -320,19 +320,31 @@ void MDCache::remove_inode(CInode *o)
   delete o; 
 }
 
+ceph_file_layout MDCache::gen_default_file_layout(const MDSMap &mdsmap)
+{
+  ceph_file_layout result = g_default_file_layout;
+  result.fl_pg_pool = mdsmap.get_first_data_pool();
 
+  return result;
+}
 
-void MDCache::init_layouts()
+ceph_file_layout MDCache::gen_default_log_layout(const MDSMap &mdsmap)
 {
-  default_file_layout = g_default_file_layout;
-  default_file_layout.fl_pg_pool = mds->mdsmap->get_first_data_pool();
-
-  default_log_layout = g_default_file_layout;
-  default_log_layout.fl_pg_pool = mds->mdsmap->get_metadata_pool();
+  ceph_file_layout result = g_default_file_layout;
+  result.fl_pg_pool = mdsmap.get_metadata_pool();
   if (g_conf->mds_log_segment_size > 0) {
-    default_log_layout.fl_object_size = g_conf->mds_log_segment_size;
-    default_log_layout.fl_stripe_unit = g_conf->mds_log_segment_size;
+    result.fl_object_size = g_conf->mds_log_segment_size;
+    result.fl_stripe_unit = g_conf->mds_log_segment_size;
   }
+
+  return result;
+}
+
+void MDCache::init_layouts()
+{
+  default_file_layout = gen_default_file_layout(*(mds->mdsmap));
+  default_log_layout = gen_default_log_layout(*(mds->mdsmap));
+
 }
 
 void MDCache::create_unlinked_system_inode(CInode *in, inodeno_t ino,
index 1141ebef4fab07b32beeaf20aca374d9b7c8c834..086e1abad1a4569541f9c6647057ff24941bda1a 100644 (file)
@@ -29,6 +29,7 @@
 #include "RecoveryQueue.h"
 #include "StrayManager.h"
 #include "MDSContext.h"
+#include "MDSMap.h"
 
 #include "messages/MClientRequest.h"
 #include "messages/MMDSSlaveRequest.h"
@@ -163,6 +164,9 @@ public:
 
   unsigned max_dir_commit_size;
 
+  static ceph_file_layout gen_default_file_layout(const MDSMap &mdsmap);
+  static ceph_file_layout gen_default_log_layout(const MDSMap &mdsmap);
+
   ceph_file_layout default_file_layout;
   ceph_file_layout default_log_layout;