]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
common/blkdev: drop is_nvme() method
authorSage Weil <sage@redhat.com>
Thu, 21 Nov 2019 22:20:58 +0000 (16:20 -0600)
committerSage Weil <sage@redhat.com>
Thu, 21 Nov 2019 22:20:58 +0000 (16:20 -0600)
No more callers (and I don't think it works anyway).

Signed-off-by: Sage Weil <sage@redhat.com>
src/common/blkdev.cc
src/common/blkdev.h
src/os/bluestore/PMEMDevice.cc
src/test/common/test_blkdev.cc
src/test/test_get_blkdev_props.cc

index 4da2be6a4c37eb39b4e16cdce3a4c86406b42c10..4241bccab8db923bd8a3701ac63fcbe2f9e21a56 100644 (file)
@@ -222,15 +222,6 @@ int BlkDev::discard(int64_t offset, int64_t len) const
   return ioctl(fd, BLKDISCARD, range);
 }
 
-bool BlkDev::is_nvme() const
-{
-  char vendor[80];
-  // nvme has a device/device/vendor property; infer from that.  There is
-  // probably a better way?
-  int r = get_string_property(BLKDEV_PROP_VENDOR, vendor, 80);
-  return (r == 0);
-}
-
 bool BlkDev::is_rotational() const
 {
   return get_int_property(BLKDEV_PROP_ROTATIONAL) > 0;
@@ -830,11 +821,6 @@ int BlkDev::discard(int64_t offset, int64_t len) const
   return -EOPNOTSUPP;
 }
 
-bool BlkDev::is_nvme() const
-{
-  return false;
-}
-
 bool BlkDev::is_rotational() const
 {
   return false;
@@ -954,25 +940,6 @@ int BlkDev::discard(int64_t offset, int64_t len) const
   return -EOPNOTSUPP;
 }
 
-bool BlkDev::is_nvme() const
-{
-  // FreeBSD doesn't have a good way to tell if a device's underlying protocol
-  // is NVME, especially since multiple GEOM transforms may be involved.  So
-  // we'll just guess based on the device name.
-  struct fiodgname_arg arg;
-  const char *nda = "nda";        //CAM-based attachment
-  const char *nvd = "nvd";        //CAM-less attachment
-  char devname[PATH_MAX];
-
-  arg.buf = devname;
-  arg.len = sizeof(devname);
-  if (ioctl(fd, FIODGNAME, &arg) < 0)
-    return false; //When in doubt, it's probably not NVME
-
-  return (strncmp(nvd, devname, strlen(nvd)) == 0 ||
-          strncmp(nda, devname, strlen(nda)) == 0);
-}
-
 bool BlkDev::is_rotational() const
 {
 #if __FreeBSD_version >= 1200049
@@ -1163,11 +1130,6 @@ int BlkDev::discard(int fd, int64_t offset, int64_t len) const
   return -EOPNOTSUPP;
 }
 
-bool BlkDev::is_nvme(const char *devname) const
-{
-  return false;
-}
-
 bool BlkDev::is_rotational(const char *devname) const
 {
   return false;
index d471df22dc53e031d830e3bc176dfa6352fd4d51..1e5f9469f4c79ae582226fde55503e25c7f1f9df 100644 (file)
@@ -55,7 +55,6 @@ public:
   int partition(char* partition, size_t max) const;
   // from a device (e.g., "sdb")
   bool support_discard() const;
-  bool is_nvme() const;
   bool is_rotational() const;
   int get_numa_node(int *node) const;
   int dev(char *dev, size_t max) const;
index cf305536707a3ccde09148729b28908eab088b20..0216b35ca854b134863724a5aed030ff1fbd9939 100644 (file)
@@ -157,8 +157,6 @@ int PMEMDevice::collect_metadata(const string& prefix, map<string,string> *pm) c
     blkdev.serial(buffer, sizeof(buffer));
     (*pm)[prefix + "serial"] = buffer;
 
-    if (blkdev.is_nvme())
-      (*pm)[prefix + "type"] = "nvme";
   } else {
     (*pm)[prefix + "access_mode"] = "file";
     (*pm)[prefix + "path"] = path;
index 9dec5297217a1f833b3e398636e883a1639f2367..952fb84d1974c037a8cb9f23b31cf6e7d6ebe6ff 100644 (file)
@@ -78,14 +78,6 @@ TEST_F(BlockDevTest, discard)
   EXPECT_TRUE(sdb.support_discard());
 }
 
-TEST_F(BlockDevTest, is_nvme)
-{
-  // It would be nice to have a positive NVME test too, but I don't have any
-  // examples for the canned data.
-  EXPECT_FALSE(sda.is_nvme());
-  EXPECT_FALSE(sdb.is_nvme());
-}
-
 TEST_F(BlockDevTest, is_rotational)
 {
   EXPECT_FALSE(sda.is_rotational());
index 208a858734baa67ccfa8711c4a663aed4af0e530..e933ba6ab414c6d741acb79529c53f32710dfeab 100644 (file)
@@ -43,8 +43,6 @@ int main(int argc, char **argv)
 
        discard_support = blkdev.support_discard();
 
-       nvme = blkdev.is_nvme();
-
        rotational = blkdev.is_rotational();
 
        if ((ret = blkdev.dev(dev, BUFSIZE)) < 0) {
@@ -81,7 +79,6 @@ int main(int argc, char **argv)
        fprintf(stdout, "Size:\t\t%" PRId64 "\n", size);
        fprintf(stdout, "Discard:\t%s\n",
                discard_support ? "supported" : "not supported");
-       fprintf(stdout, "NVME:\t\t%s\n", nvme ? "yes" : "no");
        fprintf(stdout, "Rotational:\t%s\n", rotational ? "yes" : "no");
        fprintf(stdout, "Dev:\t\t%s\n", dev);
        fprintf(stdout, "Whole disk:\t%s\n", wholedisk);