From: Stefan Haberland <sth@linux.ibm.com>
To: hch@lst.de
Cc: axboe@kernel.dk, hoeppner@linux.ibm.com,
linux-s390@vger.kernel.org, heiko.carstens@de.ibm.com,
gor@linux.ibm.com, linux-kernel@vger.kernel.org,
borntraeger@de.ibm.com
Subject: [PATCH v3 2/3] block: add a s390-only biodasdinfo method
Date: Fri, 8 May 2020 15:14:54 +0200 [thread overview]
Message-ID: <20200508131455.55407-3-sth@linux.ibm.com> (raw)
In-Reply-To: <20200508131455.55407-1-sth@linux.ibm.com>
From: Christoph Hellwig <hch@lst.de>
The IBM partition parser needs to query the DASD driver for details that
are very s390 specific. Instead of using ioctl_by_bdev with a fake user
space pointer just add a s390-specific method to get the information
directly.
Signed-off-by: Christoph Hellwig <hch@lst.de>
[sth@linux.ibm.com: remove fop, add gendisk check, export funcion]
Signed-off-by: Stefan Haberland <sth@linux.ibm.com>
---
drivers/s390/block/dasd_int.h | 1 +
drivers/s390/block/dasd_ioctl.c | 21 +++++++++++++++++++++
include/linux/blkdev.h | 1 +
3 files changed, 23 insertions(+)
diff --git a/drivers/s390/block/dasd_int.h b/drivers/s390/block/dasd_int.h
index fa552f9f1666..6eac7b11c75b 100644
--- a/drivers/s390/block/dasd_int.h
+++ b/drivers/s390/block/dasd_int.h
@@ -845,6 +845,7 @@ void dasd_destroy_partitions(struct dasd_block *);
/* externals in dasd_ioctl.c */
int dasd_ioctl(struct block_device *, fmode_t, unsigned int, unsigned long);
+int dasd_biodasdinfo(struct gendisk *disk, struct dasd_information2_t *info);
/* externals in dasd_proc.c */
int dasd_proc_init(void);
diff --git a/drivers/s390/block/dasd_ioctl.c b/drivers/s390/block/dasd_ioctl.c
index dabcb4ce92da..d29045a37b92 100644
--- a/drivers/s390/block/dasd_ioctl.c
+++ b/drivers/s390/block/dasd_ioctl.c
@@ -666,3 +666,24 @@ int dasd_ioctl(struct block_device *bdev, fmode_t mode,
dasd_put_device(base);
return rc;
}
+
+int dasd_biodasdinfo(struct gendisk *disk, struct dasd_information2_t *info)
+{
+ struct dasd_device *base;
+ int error;
+
+ /*
+ * we might get called externaly, so check if the gendisk belongs
+ * to a DASD by checking the fops pointer
+ */
+ if (disk->fops != &dasd_device_operations)
+ return -EINVAL;
+
+ base = dasd_device_from_gendisk(disk);
+ if (!base)
+ return -ENODEV;
+ error = __dasd_ioctl_information(base->block, info);
+ dasd_put_device(base);
+ return error;
+}
+EXPORT_SYMBOL(dasd_biodasdinfo);
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 32868fbedc9e..915465aa8e43 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -43,6 +43,7 @@ struct pr_ops;
struct rq_qos;
struct blk_queue_stats;
struct blk_stat_callback;
+struct dasd_information2_t;
#define BLKDEV_MIN_RQ 4
#define BLKDEV_MAX_RQ 128 /* Default maximum */
--
2.17.1
next prev parent reply other threads:[~2020-05-08 13:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-08 13:14 [PATCH v3 0/3] s390/dasd: remove ioctl_by_bdev from DASD driver Stefan Haberland
2020-05-08 13:14 ` [PATCH v3 1/3] dasd: refactor dasd_ioctl_information Stefan Haberland
2020-05-08 13:14 ` Stefan Haberland [this message]
2020-05-08 15:53 ` [PATCH v3 2/3] block: add a s390-only biodasdinfo method Christoph Hellwig
2020-05-08 13:14 ` [PATCH v3 3/3] s390/dasd: remove ioctl_by_bdev calls Stefan Haberland
2020-05-08 15:53 ` Christoph Hellwig
2020-05-11 16:30 ` Stefan Haberland
2020-05-16 15:43 ` Christoph Hellwig
2020-05-18 8:13 ` Stefan Haberland
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=20200508131455.55407-3-sth@linux.ibm.com \
--to=sth@linux.ibm.com \
--cc=axboe@kernel.dk \
--cc=borntraeger@de.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hch@lst.de \
--cc=heiko.carstens@de.ibm.com \
--cc=hoeppner@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
/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