From: Sage Weil Date: Thu, 21 Nov 2019 22:20:58 +0000 (-0600) Subject: common/blkdev: drop is_nvme() method X-Git-Tag: v15.1.0~787^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2d4ac3859c4d636675251b81c262a036162999aa;p=ceph.git common/blkdev: drop is_nvme() method No more callers (and I don't think it works anyway). Signed-off-by: Sage Weil --- diff --git a/src/common/blkdev.cc b/src/common/blkdev.cc index 4da2be6a4c37..4241bccab8db 100644 --- a/src/common/blkdev.cc +++ b/src/common/blkdev.cc @@ -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; diff --git a/src/common/blkdev.h b/src/common/blkdev.h index d471df22dc53..1e5f9469f4c7 100644 --- a/src/common/blkdev.h +++ b/src/common/blkdev.h @@ -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; diff --git a/src/os/bluestore/PMEMDevice.cc b/src/os/bluestore/PMEMDevice.cc index cf305536707a..0216b35ca854 100644 --- a/src/os/bluestore/PMEMDevice.cc +++ b/src/os/bluestore/PMEMDevice.cc @@ -157,8 +157,6 @@ int PMEMDevice::collect_metadata(const string& prefix, map *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; diff --git a/src/test/common/test_blkdev.cc b/src/test/common/test_blkdev.cc index 9dec5297217a..952fb84d1974 100644 --- a/src/test/common/test_blkdev.cc +++ b/src/test/common/test_blkdev.cc @@ -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()); diff --git a/src/test/test_get_blkdev_props.cc b/src/test/test_get_blkdev_props.cc index 208a858734ba..e933ba6ab414 100644 --- a/src/test/test_get_blkdev_props.cc +++ b/src/test/test_get_blkdev_props.cc @@ -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);