]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
filestore: do journal mode autodetect and sanity check _before_ replay
authorSage Weil <sage@newdream.net>
Wed, 1 Dec 2010 21:46:30 +0000 (13:46 -0800)
committerSage Weil <sage@newdream.net>
Wed, 1 Dec 2010 21:46:30 +0000 (13:46 -0800)
Signed-off-by: Sage Weil <sage@newdream.net>
src/os/FileStore.cc

index 84195bd9ed8243cbe04e0d37aaaa813b4a97f20a..b078692e10a7b9db83d6bf4a8229c5f7995ace5f 100644 (file)
@@ -1135,6 +1135,41 @@ int FileStore::mount()
 
   // journal
   open_journal();
+
+  // select journal mode?
+  if (journal) {
+    if (!g_conf.filestore_journal_writeahead &&
+       !g_conf.filestore_journal_parallel &&
+       !g_conf.filestore_journal_trailing) {
+      if (!btrfs) {
+       g_conf.filestore_journal_writeahead = true;
+       dout(0) << "mount: enabling WRITEAHEAD journal mode: btrfs not detected" << dendl;
+      } else if (!g_conf.filestore_btrfs_snap) {
+       g_conf.filestore_journal_writeahead = true;
+       dout(0) << "mount: enabling WRITEAHEAD journal mode: 'filestore btrfs snap' mode is not enabled" << dendl;
+      } else if (!btrfs_snap_create_async) {
+       g_conf.filestore_journal_writeahead = true;
+       dout(0) << "mount: enabling WRITEAHEAD journal mode: btrfs SNAP_CREATE_ASYNC ioctl not detected (v2.6.37+)" << dendl;
+      } else {
+       g_conf.filestore_journal_parallel = true;
+       dout(0) << "mount: enabling PARALLEL journal mode: btrfs, SNAP_CREATE_ASYNC detected and 'filestore btrfs snap' mode is enabled" << dendl;
+      }
+    } else {
+      if (g_conf.filestore_journal_writeahead)
+       dout(0) << "mount: WRITEAHEAD journal mode explicitly enabled in conf" << dendl;
+      if (g_conf.filestore_journal_parallel)
+       dout(0) << "mount: PARALLEL journal mode explicitly enabled in conf" << dendl;
+      if (g_conf.filestore_journal_trailing)
+       dout(0) << "mount: TRAILING journal mode explicitly enabled in conf" << dendl;
+    }
+    if (g_conf.filestore_journal_writeahead)
+      journal->set_wait_on_full(true);
+  }
+
+  r = _sanity_check_fs();
+  if (r < 0)
+    return r;
+
   r = journal_replay(initial_op_seq);
   if (r < 0) {
     char buf[40];
@@ -1147,40 +1182,15 @@ int FileStore::mount()
 
     return r;
   }
+
   journal_start();
+
   sync_thread.create();
   op_tp.start();
   flusher_thread.create();
   op_finisher.start();
   ondisk_finisher.start();
 
-  // select journal mode?
-  if (journal &&
-      !g_conf.filestore_journal_writeahead &&
-      !g_conf.filestore_journal_parallel &&
-      !g_conf.filestore_journal_trailing) {
-    if (!btrfs) {
-      g_conf.filestore_journal_writeahead = true;
-      dout(0) << "mount: enabling WRITEAHEAD journal mode: btrfs not detected" << dendl;
-    } else if (!g_conf.filestore_btrfs_snap) {
-      g_conf.filestore_journal_writeahead = true;
-      dout(0) << "mount: enabling WRITEAHEAD journal mode: 'filestore btrfs snap' mode is not enabled" << dendl;
-    } else if (!btrfs_snap_create_async) {
-      g_conf.filestore_journal_writeahead = true;
-      dout(0) << "mount: enabling WRITEAHEAD journal mode: btrfs SNAP_CREATE_ASYNC ioctl not detected (v2.6.37+)" << dendl;
-    } else {
-      g_conf.filestore_journal_parallel = true;
-      dout(0) << "mount: enabling PARALLEL journal mode: btrfs, SNAP_CREATE_ASYNC detected and 'filestore btrfs snap' mode is enabled" << dendl;
-    }
-  }
-
-  if (journal && g_conf.filestore_journal_writeahead)
-    journal->set_wait_on_full(true);
-
-  r = _sanity_check_fs();
-  if (r < 0)
-    return r;
-
   // all okay.
   return 0;
 }