]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: rename ceph-bluefs-tool -> ceph-bluestore-tool
authorSage Weil <sage@redhat.com>
Thu, 30 Mar 2017 19:18:31 +0000 (15:18 -0400)
committerSage Weil <sage@redhat.com>
Thu, 30 Mar 2017 19:18:31 +0000 (15:18 -0400)
This will do bluestore-y things, not *just* bluefs things.

Signed-off-by: Sage Weil <sage@redhat.com>
ceph.spec.in
debian/ceph-osd.install
src/os/CMakeLists.txt
src/os/bluestore/bluefs_tool.cc [deleted file]
src/os/bluestore/bluestore_tool.cc [new file with mode: 0644]

index ed9e474f345454bc19281328fb4110030415da02..5ced00a8f79f885d23e7dc67c28bc0876ac8a328 100644 (file)
@@ -1359,7 +1359,7 @@ fi
 
 %files osd
 %{_bindir}/ceph-clsinfo
-%{_bindir}/ceph-bluefs-tool
+%{_bindir}/ceph-bluestore-tool
 %{_bindir}/ceph-objectstore-tool
 %{_bindir}/ceph-osd
 %{_sbindir}/ceph-disk
index 237833bfdeac045f875dc4d6e5afe1c5c8072e81..9f520ec4769e6b854198c60895412a027dd6144f 100644 (file)
@@ -4,7 +4,7 @@ usr/sbin/ceph-disk
 usr/sbin/ceph-disk-udev
 usr/bin/ceph-clsinfo
 usr/bin/ceph-objectstore-tool
-usr/bin/ceph-bluefs-tool
+usr/bin/ceph-bluestore-tool
 usr/bin/ceph_objectstore_bench
 usr/bin/ceph-osd
 usr/lib/ceph/ceph-osd-prestart.sh
index 98defc886dc4534657c5c4ec5ab88b3d717c9276..93255a3b045431997dd2bb771a23c991fb5cc328 100644 (file)
@@ -85,11 +85,11 @@ target_link_libraries(os kv)
 add_dependencies(os compressor_plugins)
 
 if(HAVE_LIBAIO)
-  add_executable(ceph-bluefs-tool
-    bluestore/bluefs_tool.cc)
-  target_link_libraries(ceph-bluefs-tool
+  add_executable(ceph-bluestore-tool
+    bluestore/bluestore_tool.cc)
+  target_link_libraries(ceph-bluestore-tool
     os global)
-  install(TARGETS ceph-bluefs-tool
+  install(TARGETS ceph-bluestore-tool
     DESTINATION bin)
 endif()
 
diff --git a/src/os/bluestore/bluefs_tool.cc b/src/os/bluestore/bluefs_tool.cc
deleted file mode 100644 (file)
index dc78123..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
-// vim: ts=8 sw=2 smarttab
-
-#include <stdio.h>
-#include <string.h>
-#include <iostream>
-#include <time.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include "global/global_init.h"
-#include "common/ceph_argparse.h"
-#include "include/stringify.h"
-#include "common/errno.h"
-
-#include "os/bluestore/BlueFS.h"
-
-void usage(char **argv)
-{
-  cout << argv[0] << " <outdir> <bdev[0..2]>" << std::endl;;
-}
-
-int main(int argc, char **argv)
-{
-  vector<const char*> args;
-  argv_to_vec(argc, (const char **)argv, args);
-  env_to_vec(args);
-
-  auto cct = global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT,
-                        CODE_ENVIRONMENT_UTILITY, 0);
-  common_init_finish(cct.get());
-  cct->_conf->set_val(
-    "enable_experimental_unrecoverable_data_corrupting_features",
-    "*");
-  cct->_conf->apply_changes(NULL);
-
-  BlueFS fs(&(*cct));
-
-  if (args.size() != 4) {
-    usage(argv);
-    exit(-1);
-  }
-
-  cout << "args " << args << std::endl;
-  string outdir = args[0];
-  for (unsigned i = 1; i < args.size(); ++i) {
-    fs.add_block_device(i-1, args[i]);
-  }
-
-  int r = fs.mount();
-  assert(r == 0);
-
-  vector<string> dirs;
-  r = fs.readdir("", &dirs);
-  assert(r == 0);
-  for (auto& dir : dirs) {
-    if (dir[0] == '.')
-      continue;
-    cout << dir << "/" << std::endl;
-    vector<string> ls;
-    r = fs.readdir(dir, &ls);
-    assert(r == 0);
-    string cmd = "mkdir -p " + outdir + "/" + dir;
-    r = system(cmd.c_str());
-    assert(r == 0);
-    for (auto& file : ls) {
-      if (file[0] == '.')
-       continue;
-      cout << dir << "/" << file << std::endl;
-      uint64_t size;
-      utime_t mtime;
-      r = fs.stat(dir, file, &size, &mtime);
-      assert(r == 0);
-      string path = outdir + "/" + dir + "/" + file;
-      int fd = ::open(path.c_str(), O_CREAT|O_WRONLY|O_TRUNC, 0644);
-      assert(fd >= 0);
-      if (size > 0) {
-       BlueFS::FileReader *h;
-       r = fs.open_for_read(dir, file, &h, false);
-       assert(r == 0);
-       int pos = 0;
-       int left = size;
-       while (left) {
-         bufferlist bl;
-         r = fs.read(h, &h->buf, pos, left, &bl, NULL);
-         assert(r > 0);
-         int rc = bl.write_fd(fd);
-         assert(rc == 0);
-         pos += r;
-         left -= r;
-       }
-       delete h;
-      }
-      ::close(fd);
-    }
-  }
-}
diff --git a/src/os/bluestore/bluestore_tool.cc b/src/os/bluestore/bluestore_tool.cc
new file mode 100644 (file)
index 0000000..dc78123
--- /dev/null
@@ -0,0 +1,96 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
+#include <stdio.h>
+#include <string.h>
+#include <iostream>
+#include <time.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include "global/global_init.h"
+#include "common/ceph_argparse.h"
+#include "include/stringify.h"
+#include "common/errno.h"
+
+#include "os/bluestore/BlueFS.h"
+
+void usage(char **argv)
+{
+  cout << argv[0] << " <outdir> <bdev[0..2]>" << std::endl;;
+}
+
+int main(int argc, char **argv)
+{
+  vector<const char*> args;
+  argv_to_vec(argc, (const char **)argv, args);
+  env_to_vec(args);
+
+  auto cct = global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT,
+                        CODE_ENVIRONMENT_UTILITY, 0);
+  common_init_finish(cct.get());
+  cct->_conf->set_val(
+    "enable_experimental_unrecoverable_data_corrupting_features",
+    "*");
+  cct->_conf->apply_changes(NULL);
+
+  BlueFS fs(&(*cct));
+
+  if (args.size() != 4) {
+    usage(argv);
+    exit(-1);
+  }
+
+  cout << "args " << args << std::endl;
+  string outdir = args[0];
+  for (unsigned i = 1; i < args.size(); ++i) {
+    fs.add_block_device(i-1, args[i]);
+  }
+
+  int r = fs.mount();
+  assert(r == 0);
+
+  vector<string> dirs;
+  r = fs.readdir("", &dirs);
+  assert(r == 0);
+  for (auto& dir : dirs) {
+    if (dir[0] == '.')
+      continue;
+    cout << dir << "/" << std::endl;
+    vector<string> ls;
+    r = fs.readdir(dir, &ls);
+    assert(r == 0);
+    string cmd = "mkdir -p " + outdir + "/" + dir;
+    r = system(cmd.c_str());
+    assert(r == 0);
+    for (auto& file : ls) {
+      if (file[0] == '.')
+       continue;
+      cout << dir << "/" << file << std::endl;
+      uint64_t size;
+      utime_t mtime;
+      r = fs.stat(dir, file, &size, &mtime);
+      assert(r == 0);
+      string path = outdir + "/" + dir + "/" + file;
+      int fd = ::open(path.c_str(), O_CREAT|O_WRONLY|O_TRUNC, 0644);
+      assert(fd >= 0);
+      if (size > 0) {
+       BlueFS::FileReader *h;
+       r = fs.open_for_read(dir, file, &h, false);
+       assert(r == 0);
+       int pos = 0;
+       int left = size;
+       while (left) {
+         bufferlist bl;
+         r = fs.read(h, &h->buf, pos, left, &bl, NULL);
+         assert(r > 0);
+         int rc = bl.write_fd(fd);
+         assert(rc == 0);
+         pos += r;
+         left -= r;
+       }
+       delete h;
+      }
+      ::close(fd);
+    }
+  }
+}