From: Boaz Harrosh <boaz@plexistor.com>
To: Jens Axboe <axboe@kernel.dk>,
Ross Zwisler <ross.zwisler@linux.intel.com>,
Matthew Wilcox <willy@linux.intel.com>,
linux-kernel <linux-kernel@vger.kernel.org>
Cc: linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: [PATCH 2/4] brd: Add getgeo to block ops
Date: Wed, 06 Aug 2014 14:30:33 +0300 [thread overview]
Message-ID: <53E211D9.7030102@plexistor.com> (raw)
In-Reply-To: <53E21125.9080308@plexistor.com>
From: Ross Zwisler <ross.zwisler@linux.intel.com>
Some programs require HDIO_GETGEO work, which requires we implement
getgeo. Based off of the work done to the NVMe driver in this commit:
4cc09e2dc4cb NVMe: Add getgeo to block ops
[Boaz] Converted original work done for prd.c for here.
This is needed if we want to support partitions, fdisk
calls this.
Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
Signed-off-by: Boaz Harrosh <boaz@plexistor.com>
---
drivers/block/brd.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/block/brd.c b/drivers/block/brd.c
index a10a0a9..3f07cb4 100644
--- a/drivers/block/brd.c
+++ b/drivers/block/brd.c
@@ -19,6 +19,7 @@
#include <linux/radix-tree.h>
#include <linux/fs.h>
#include <linux/slab.h>
+#include <linux/hdreg.h>
#include <asm/uaccess.h>
@@ -424,6 +425,15 @@ static int brd_ioctl(struct block_device *bdev, fmode_t mode,
return error;
}
+static int brd_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 brd_fops = {
.owner = THIS_MODULE,
.rw_page = brd_rw_page,
@@ -431,6 +441,7 @@ static const struct block_device_operations brd_fops = {
#ifdef CONFIG_BLK_DEV_XIP
.direct_access = brd_direct_access,
#endif
+ .getgeo = brd_getgeo,
};
/*
--
1.9.3
next prev parent reply other threads:[~2014-08-06 11:30 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-06 11:27 [PATCHSET 0/4] brd: partition fixes Boaz Harrosh
2014-08-06 11:29 ` [PATCH 1/4] Change direct_access calling convention Boaz Harrosh
2014-08-06 11:30 ` Boaz Harrosh [this message]
2014-08-06 17:52 ` [PATCH 2/4] brd: Add getgeo to block ops Ross Zwisler
2014-08-07 9:20 ` Boaz Harrosh
2014-08-07 14:03 ` [PATCH 2/4 v2] " Boaz Harrosh
2014-08-07 18:20 ` One Thousand Gnomes
2014-08-08 6:52 ` Boaz Harrosh
2014-08-08 6:58 ` Davidlohr Bueso
2014-08-06 11:33 ` [PATCH 3/4] brd: Fix all partitions BUGs Boaz Harrosh
2014-08-06 23:06 ` Ross Zwisler
2014-08-07 9:11 ` Boaz Harrosh
2014-08-07 18:50 ` Ross Zwisler
2014-08-07 18:53 ` Ross Zwisler
2014-08-06 11:35 ` [PATCH 4/4] brd: Request from fdisk 4k alignment Boaz Harrosh
2014-08-06 22:03 ` Ross Zwisler
2014-08-07 12:17 ` Boaz Harrosh
2014-08-07 13:00 ` Karel Zak
2014-08-07 13:51 ` Karel Zak
2014-08-07 13:57 ` Boaz Harrosh
2014-08-07 15:21 ` Karel Zak
2014-08-07 15:40 ` Boaz Harrosh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53E211D9.7030102@plexistor.com \
--to=boaz@plexistor.com \
--cc=axboe@kernel.dk \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ross.zwisler@linux.intel.com \
--cc=willy@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).