mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andreas Hindborg <nmi@metaspace.dk>
To: Ming Lei <ming.lei@redhat.com>
Cc: Hans Holmberg <Hans.Holmberg@wdc.com>,
	Aravind Ramesh <Aravind.Ramesh@wdc.com>,
	Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org (open list:BLOCK LAYER),
	Christoph Hellwig <hch@infradead.org>,
	Matias Bjorling <Matias.Bjorling@wdc.com>,
	Andreas Hindborg <a.hindborg@samsung.com>,
	linux-kernel@vger.kernel.org (open list),
	Damien Le Moal <dlemoal@kernel.org>,
	gost.dev@samsung.com, Minwoo Im <minwoo.im.dev@gmail.com>
Subject: [PATCH v4 2/4] ublk: move types to shared header file
Date: Wed, 28 Jun 2023 21:06:47 +0200	[thread overview]
Message-ID: <20230628190649.11233-3-nmi@metaspace.dk> (raw)
In-Reply-To: <20230628190649.11233-1-nmi@metaspace.dk>

From: Andreas Hindborg <a.hindborg@samsung.com>

This change is in preparation for ublk zoned storage support.

Signed-off-by: Andreas Hindborg <a.hindborg@samsung.com>
---
 MAINTAINERS              |  1 +
 drivers/block/ublk_drv.c | 45 +-------------------------------
 drivers/block/ublk_drv.h | 55 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 57 insertions(+), 44 deletions(-)
 create mode 100644 drivers/block/ublk_drv.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 27ef11624748..ace71c90751c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -21554,6 +21554,7 @@ L:	linux-block@vger.kernel.org
 S:	Maintained
 F:	Documentation/block/ublk.rst
 F:	drivers/block/ublk_drv.c
+F:	drivers/block/ublk_drv.h
 F:	include/uapi/linux/ublk_cmd.h
 
 UCLINUX (M68KNOMMU AND COLDFIRE)
diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c
index 1c823750c95a..e519dc0d9fe7 100644
--- a/drivers/block/ublk_drv.c
+++ b/drivers/block/ublk_drv.c
@@ -45,6 +45,7 @@
 #include <linux/namei.h>
 #include <linux/kref.h>
 #include <uapi/linux/ublk_cmd.h>
+#include "ublk_drv.h"
 
 #define UBLK_MINORS		(1U << MINORBITS)
 
@@ -62,11 +63,6 @@
 #define UBLK_PARAM_TYPE_ALL (UBLK_PARAM_TYPE_BASIC | \
 		UBLK_PARAM_TYPE_DISCARD | UBLK_PARAM_TYPE_DEVT)
 
-struct ublk_rq_data {
-	struct llist_node node;
-
-	struct kref ref;
-};
 
 struct ublk_uring_cmd_pdu {
 	struct ublk_queue *ubq;
@@ -140,45 +136,6 @@ struct ublk_queue {
 
 #define UBLK_DAEMON_MONITOR_PERIOD	(5 * HZ)
 
-struct ublk_device {
-	struct gendisk		*ub_disk;
-
-	char	*__queues;
-
-	unsigned int	queue_size;
-	struct ublksrv_ctrl_dev_info	dev_info;
-
-	struct blk_mq_tag_set	tag_set;
-
-	struct cdev		cdev;
-	struct device		cdev_dev;
-
-#define UB_STATE_OPEN		0
-#define UB_STATE_USED		1
-#define UB_STATE_DELETED	2
-	unsigned long		state;
-	int			ub_number;
-
-	struct mutex		mutex;
-
-	spinlock_t		mm_lock;
-	struct mm_struct	*mm;
-
-	struct ublk_params	params;
-
-	struct completion	completion;
-	unsigned int		nr_queues_ready;
-	unsigned int		nr_privileged_daemon;
-
-	/*
-	 * Our ubq->daemon may be killed without any notification, so
-	 * monitor each queue's daemon periodically
-	 */
-	struct delayed_work	monitor_work;
-	struct work_struct	quiesce_work;
-	struct work_struct	stop_work;
-};
-
 /* header of ublk_params */
 struct ublk_params_header {
 	__u32	len;
diff --git a/drivers/block/ublk_drv.h b/drivers/block/ublk_drv.h
new file mode 100644
index 000000000000..f81e62256456
--- /dev/null
+++ b/drivers/block/ublk_drv.h
@@ -0,0 +1,55 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifndef _UBLK_DRV_H
+#define _UBLK_DRV_H
+
+#include <uapi/linux/ublk_cmd.h>
+#include <linux/blk-mq.h>
+#include <linux/cdev.h>
+
+struct ublk_device {
+	struct gendisk		*ub_disk;
+
+	char	*__queues;
+
+	unsigned int	queue_size;
+	struct ublksrv_ctrl_dev_info	dev_info;
+
+	struct blk_mq_tag_set	tag_set;
+
+	struct cdev		cdev;
+	struct device		cdev_dev;
+
+#define UB_STATE_OPEN		0
+#define UB_STATE_USED		1
+#define UB_STATE_DELETED	2
+	unsigned long		state;
+	int			ub_number;
+
+	struct mutex		mutex;
+
+	spinlock_t		mm_lock;
+	struct mm_struct	*mm;
+
+	struct ublk_params	params;
+
+	struct completion	completion;
+	unsigned int		nr_queues_ready;
+	unsigned int		nr_privileged_daemon;
+
+	/*
+	 * Our ubq->daemon may be killed without any notification, so
+	 * monitor each queue's daemon periodically
+	 */
+	struct delayed_work	monitor_work;
+	struct work_struct	quiesce_work;
+	struct work_struct	stop_work;
+};
+
+struct ublk_rq_data {
+	struct llist_node node;
+
+	struct kref ref;
+};
+
+#endif
-- 
2.41.0


  parent reply	other threads:[~2023-06-28 19:07 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-28 19:06 [PATCH v4 0/4] ublk: add zoned storage support Andreas Hindborg
2023-06-28 19:06 ` [PATCH v4 1/4] ublk: change ublk IO command defines to enum Andreas Hindborg
2023-06-28 22:47   ` Damien Le Moal
2023-06-29  0:38     ` Ming Lei
2023-06-29  1:14       ` Damien Le Moal
2023-06-29  7:09       ` Andreas Hindborg (Samsung)
2023-06-29  7:11     ` Andreas Hindborg (Samsung)
     [not found]   ` <83E5C27A-9AEF-4900-9652-78ACFF47E6B0@wdc.com>
2023-06-30 10:33     ` aravind.ramesh
2023-06-30 16:30       ` Andreas Hindborg (Samsung)
2023-06-28 19:06 ` Andreas Hindborg [this message]
2023-06-28 22:49   ` [PATCH v4 2/4] ublk: move types to shared header file Damien Le Moal
     [not found]   ` <6BEB9EA7-7445-498E-9492-21BC2B5D8B19@wdc.com>
2023-06-30 10:33     ` aravind.ramesh
2023-06-28 19:06 ` [PATCH v4 3/4] ublk: enable zoned storage support Andreas Hindborg
2023-06-28 23:16   ` Damien Le Moal
2023-06-29  7:50     ` Andreas Hindborg (Samsung)
2023-06-29  9:41       ` Damien Le Moal
2023-06-30 11:53         ` Andreas Hindborg (Samsung)
2023-06-29  2:39   ` Ming Lei
2023-06-30 16:51     ` Andreas Hindborg (Samsung)
2023-06-29  2:54   ` kernel test robot
2023-06-29  5:39   ` Christoph Hellwig
2023-06-29  7:25     ` Andreas Hindborg (Samsung)
2023-06-29  7:31       ` Christoph Hellwig
2023-06-29  7:22   ` kernel test robot
     [not found]   ` <62426D68-1E01-4804-9CFC-A1146770F362@wdc.com>
2023-06-30 10:34     ` aravind.ramesh
2023-06-30 16:37       ` Andreas Hindborg (Samsung)
2023-06-28 19:06 ` [PATCH v4 4/4] ublk: add zone append Andreas Hindborg
2023-06-28 23:17   ` Damien Le Moal
2023-06-29  2:46   ` Ming Lei
2023-06-29  9:17     ` Andreas Hindborg (Samsung)
2023-06-29  9:43       ` Damien Le Moal
     [not found]   ` <39701CAF-7AE2-4C83-A4DD-929A0A4FB8F0@wdc.com>
2023-06-30 10:35     ` aravind.ramesh
2023-06-30 16:33       ` Andreas Hindborg (Samsung)
     [not found] ` <5F597343-EC91-4698-ACBE-9111B52FC3FC@wdc.com>
2023-06-30 10:33   ` [PATCH v4 0/4] ublk: add zoned storage support aravind.ramesh
2023-06-30 14:26     ` Andreas Hindborg (Samsung)

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=20230628190649.11233-3-nmi@metaspace.dk \
    --to=nmi@metaspace.dk \
    --cc=Aravind.Ramesh@wdc.com \
    --cc=Hans.Holmberg@wdc.com \
    --cc=Matias.Bjorling@wdc.com \
    --cc=a.hindborg@samsung.com \
    --cc=axboe@kernel.dk \
    --cc=dlemoal@kernel.org \
    --cc=gost.dev@samsung.com \
    --cc=hch@infradead.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ming.lei@redhat.com \
    --cc=minwoo.im.dev@gmail.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

all inboxes | Powered by JetHome®