summaryrefslogtreecommitdiffstats
path: root/drivers/block/nvme-core.c
diff options
context:
space:
mode:
authorKeith Busch <keith.busch@intel.com>2014-04-02 15:45:37 -0600
committerMatthew Wilcox <matthew.r.wilcox@intel.com>2014-04-10 17:06:11 -0400
commit4cc09e2dc4cbe6009c935b6f12a8376f09124bc5 (patch)
tree4ea0a01b784186dc31ffde1fc503742451f0390a /drivers/block/nvme-core.c
parentb9afca3efb18a9b8392cb544a3e29e8b1168400c (diff)
downloadlinux-stable-4cc09e2dc4cbe6009c935b6f12a8376f09124bc5.tar.gz
linux-stable-4cc09e2dc4cbe6009c935b6f12a8376f09124bc5.tar.bz2
linux-stable-4cc09e2dc4cbe6009c935b6f12a8376f09124bc5.zip
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>
Diffstat (limited to 'drivers/block/nvme-core.c')
-rw-r--r--drivers/block/nvme-core.c11
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 @@
#include <linux/errno.h>
#include <linux/fs.h>
#include <linux/genhd.h>
+#include <linux/hdreg.h>
#include <linux/idr.h>
#include <linux/init.h>
#include <linux/interrupt.h>
@@ -1714,12 +1715,22 @@ static void nvme_release(struct gendisk *disk, fmode_t mode)
kref_put(&dev->kref, nvme_free_dev);
}
+static int nvme_getgeo(struct block_device *bd, struct hd_geometry *geo)
+{
+ /* some standard values */
+ geo->heads = 1 << 6;
+ geo->sectors = 1 << 5;
+ geo->cylinders = get_capacity(bd->bd_disk) >> 11;
+ return 0;
+}
+
static const struct block_device_operations nvme_fops = {
.owner = THIS_MODULE,
.ioctl = nvme_ioctl,
.compat_ioctl = nvme_compat_ioctl,
.open = nvme_open,
.release = nvme_release,
+ .getgeo = nvme_getgeo,
};
static void nvme_resubmit_bios(struct nvme_queue *nvmeq)