]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: implement is_rotational()
authorSage Weil <sage@redhat.com>
Thu, 1 Jun 2017 20:47:37 +0000 (16:47 -0400)
committerSage Weil <sage@redhat.com>
Fri, 2 Jun 2017 03:52:18 +0000 (23:52 -0400)
Signed-off-by: Sage Weil <sage@redhat.com>
src/os/bluestore/BlueStore.cc
src/os/bluestore/BlueStore.h

index 13d1882e80f64798441536db8bc89bccd7fb5e86..d76ce63bfb98dfcef6c23a6e4bbf50d7ac0a2a83 100644 (file)
@@ -4128,6 +4128,38 @@ int BlueStore::_lock_fsid()
   return 0;
 }
 
+bool BlueStore::is_rotational()
+{
+  if (bdev) {
+    return bdev->is_rotational();
+  }
+
+  bool rotational = true;
+  int r = _open_path();
+  if (r < 0)
+    goto out;
+  r = _open_fsid(false);
+  if (r < 0)
+    goto out_path;
+  r = _read_fsid(&fsid);
+  if (r < 0)
+    goto out_fsid;
+  r = _lock_fsid();
+  if (r < 0)
+    goto out_fsid;
+  r = _open_bdev(false);
+  if (r < 0)
+    goto out_fsid;
+  rotational = bdev->is_rotational();
+  _close_bdev();
+ out_fsid:
+  _close_fsid();
+ out_path:
+  _close_path();
+  out:
+  return rotational;
+}
+
 bool BlueStore::test_mount_in_use()
 {
   // most error conditions mean the mount is not in use (e.g., because
index cc096450c7edd9cdeba605ef14b3c78eb38ec3e7..2b5eabe44b0254bded630436758ffebcbc3032e7 100644 (file)
@@ -2086,6 +2086,8 @@ public:
   bool wants_journal() override { return false; };
   bool allows_journal() override { return false; };
 
+  bool is_rotational() override;
+
   static int get_block_device_fsid(CephContext* cct, const string& path,
                                   uuid_d *fsid);