diff options
author | Keith Busch <keith.busch@intel.com> | 2014-04-02 17:45:37 -0400 |
---|---|---|
committer | Matthew Wilcox <matthew.r.wilcox@intel.com> | 2014-04-10 17:06:11 -0400 |
commit | 4cc09e2dc4cbe6009c935b6f12a8376f09124bc5 (patch) | |
tree | 4ea0a01b784186dc31ffde1fc503742451f0390a | |
parent | b9afca3efb18a9b8392cb544a3e29e8b1168400c (diff) |
NVMe: Add getgeo to block ops
Some programs require HDIO_GETGEO work, which requires we implement
getgeo.
Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com>
-rw-r--r-- | drivers/block/nvme-core.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c index 2d69bfec95a4..596e2abd7971 100644 --- a/drivers/block/nvme-core.c +++ b/drivers/block/nvme-core.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/errno.h> | 25 | #include <linux/errno.h> |
26 | #include <linux/fs.h> | 26 | #include <linux/fs.h> |
27 | #include <linux/genhd.h> | 27 | #include <linux/genhd.h> |
28 | #include <linux/hdreg.h> | ||
28 | #include <linux/idr.h> | 29 | #include <linux/idr.h> |
29 | #include <linux/init.h> | 30 | #include <linux/init.h> |
30 | #include <linux/interrupt.h> | 31 | #include <linux/interrupt.h> |
@@ -1714,12 +1715,22 @@ static void nvme_release(struct gendisk *disk, fmode_t mode) | |||
1714 | kref_put(&dev->kref, nvme_free_dev); | 1715 | kref_put(&dev->kref, nvme_free_dev); |
1715 | } | 1716 | } |
1716 | 1717 | ||
1718 | static int nvme_getgeo(struct block_device *bd, struct hd_geometry *geo) | ||
1719 | { | ||
1720 | /* some standard values */ | ||
1721 | geo->heads = 1 << 6; | ||
1722 | geo->sectors = 1 << 5; | ||
1723 | geo->cylinders = get_capacity(bd->bd_disk) >> 11; | ||
1724 | return 0; | ||
1725 | } | ||
1726 | |||
1717 | static const struct block_device_operations nvme_fops = { | 1727 | static const struct block_device_operations nvme_fops = { |
1718 | .owner = THIS_MODULE, | 1728 | .owner = THIS_MODULE, |
1719 | .ioctl = nvme_ioctl, | 1729 | .ioctl = nvme_ioctl, |
1720 | .compat_ioctl = nvme_compat_ioctl, | 1730 | .compat_ioctl = nvme_compat_ioctl, |
1721 | .open = nvme_open, | 1731 | .open = nvme_open, |
1722 | .release = nvme_release, | 1732 | .release = nvme_release, |
1733 | .getgeo = nvme_getgeo, | ||
1723 | }; | 1734 | }; |
1724 | 1735 | ||
1725 | static void nvme_resubmit_bios(struct nvme_queue *nvmeq) | 1736 | static void nvme_resubmit_bios(struct nvme_queue *nvmeq) |