All of lore.kernel.org
 help / color / mirror / Atom feed
From: Danil Kipnis <danil.kipnis@cloud.ionos.com>
To: linux-block@vger.kernel.org, linux-rdma@vger.kernel.org
Cc: axboe@kernel.dk, hch@infradead.org, sagi@grimberg.me,
	bvanassche@acm.org, leon@kernel.org, dledford@redhat.com,
	jgg@ziepe.ca, danil.kipnis@cloud.ionos.com,
	jinpu.wang@cloud.ionos.com, pankaj.gupta@cloud.ionos.com
Subject: [PATCH v15 19/25] block/rnbd: server: private header with server structs and functions
Date: Mon, 11 May 2020 15:51:25 +0200	[thread overview]
Message-ID: <20200511135131.27580-20-danil.kipnis@cloud.ionos.com> (raw)
In-Reply-To: <20200511135131.27580-1-danil.kipnis@cloud.ionos.com>

From: Jack Wang <jinpu.wang@cloud.ionos.com>

This header describes main structs and functions used by rnbd-server
module, namely structs for managing sessions from different clients
and mapped (opened) devices.

Signed-off-by: Danil Kipnis <danil.kipnis@cloud.ionos.com>
Signed-off-by: Jack Wang <jinpu.wang@cloud.ionos.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/block/rnbd/rnbd-srv.h | 78 +++++++++++++++++++++++++++++++++++
 1 file changed, 78 insertions(+)
 create mode 100644 drivers/block/rnbd/rnbd-srv.h

diff --git a/drivers/block/rnbd/rnbd-srv.h b/drivers/block/rnbd/rnbd-srv.h
new file mode 100644
index 000000000000..5a8544b5e74f
--- /dev/null
+++ b/drivers/block/rnbd/rnbd-srv.h
@@ -0,0 +1,78 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * RDMA Network Block Driver
+ *
+ * Copyright (c) 2014 - 2018 ProfitBricks GmbH. All rights reserved.
+ * Copyright (c) 2018 - 2019 1&1 IONOS Cloud GmbH. All rights reserved.
+ * Copyright (c) 2019 - 2020 1&1 IONOS SE. All rights reserved.
+ */
+#ifndef RNBD_SRV_H
+#define RNBD_SRV_H
+
+#include <linux/types.h>
+#include <linux/idr.h>
+#include <linux/kref.h>
+
+#include <rtrs.h>
+#include "rnbd-proto.h"
+#include "rnbd-log.h"
+
+struct rnbd_srv_session {
+	/* Entry inside global sess_list */
+	struct list_head        list;
+	struct rtrs_srv		*rtrs;
+	char			sessname[NAME_MAX];
+	int			queue_depth;
+	struct bio_set		sess_bio_set;
+
+	struct xarray		index_idr;
+	/* List of struct rnbd_srv_sess_dev */
+	struct list_head        sess_dev_list;
+	struct mutex		lock;
+	u8			ver;
+};
+
+struct rnbd_srv_dev {
+	/* Entry inside global dev_list */
+	struct list_head                list;
+	struct kobject                  dev_kobj;
+	struct kobject                  *dev_sessions_kobj;
+	struct kref                     kref;
+	char				id[NAME_MAX];
+	/* List of rnbd_srv_sess_dev structs */
+	struct list_head		sess_dev_list;
+	struct mutex			lock;
+	int				open_write_cnt;
+};
+
+/* Structure which binds N devices and N sessions */
+struct rnbd_srv_sess_dev {
+	/* Entry inside rnbd_srv_dev struct */
+	struct list_head		dev_list;
+	/* Entry inside rnbd_srv_session struct */
+	struct list_head		sess_list;
+	struct rnbd_dev			*rnbd_dev;
+	struct rnbd_srv_session		*sess;
+	struct rnbd_srv_dev		*dev;
+	struct kobject                  kobj;
+	u32                             device_id;
+	fmode_t                         open_flags;
+	struct kref			kref;
+	struct completion               *destroy_comp;
+	char				pathname[NAME_MAX];
+	enum rnbd_access_mode		access_mode;
+};
+
+/* rnbd-srv-sysfs.c */
+
+int rnbd_srv_create_dev_sysfs(struct rnbd_srv_dev *dev,
+			      struct block_device *bdev,
+			      const char *dir_name);
+void rnbd_srv_destroy_dev_sysfs(struct rnbd_srv_dev *dev);
+int rnbd_srv_create_dev_session_sysfs(struct rnbd_srv_sess_dev *sess_dev);
+void rnbd_srv_destroy_dev_session_sysfs(struct rnbd_srv_sess_dev *sess_dev);
+int rnbd_srv_create_sysfs_files(void);
+void rnbd_srv_destroy_sysfs_files(void);
+void rnbd_destroy_sess_dev(struct rnbd_srv_sess_dev *sess_dev);
+
+#endif /* RNBD_SRV_H */
-- 
2.20.1


  parent reply	other threads:[~2020-05-11 13:53 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-11 13:51 [PATCH v15 00/25] RTRS (former IBTRS) RDMA Transport Library and RNBD (former IBNBD) RDMA Network Block Device Danil Kipnis
2020-05-11 13:51 ` [PATCH v15 01/25] sysfs: export sysfs_remove_file_self() Danil Kipnis
2020-05-11 13:51 ` [PATCH v15 02/25] RDMA/rtrs: public interface header to establish RDMA connections Danil Kipnis
2020-05-11 13:51 ` [PATCH v15 03/25] RDMA/rtrs: private headers with rtrs protocol structs and helpers Danil Kipnis
2020-05-11 13:51 ` [PATCH v15 04/25] RDMA/rtrs: core: lib functions shared between client and server modules Danil Kipnis
2020-05-11 13:51 ` [PATCH v15 05/25] RDMA/rtrs: client: private header with client structs and functions Danil Kipnis
2020-05-11 13:51 ` [PATCH v15 06/25] RDMA/rtrs: client: main functionality Danil Kipnis
2020-05-11 13:51 ` [PATCH v15 07/25] RDMA/rtrs: client: statistics functions Danil Kipnis
2020-05-11 13:51 ` [PATCH v15 08/25] RDMA/rtrs: client: sysfs interface functions Danil Kipnis
2020-05-11 13:51 ` [PATCH v15 09/25] RDMA/rtrs: server: private header with server structs and functions Danil Kipnis
2020-05-11 13:51 ` [PATCH v15 10/25] RDMA/rtrs: server: main functionality Danil Kipnis
2020-05-11 13:51 ` [PATCH v15 11/25] RDMA/rtrs: server: statistics functions Danil Kipnis
2020-05-11 13:51 ` [PATCH v15 12/25] RDMA/rtrs: server: sysfs interface functions Danil Kipnis
2020-05-11 13:51 ` [PATCH v15 13/25] RDMA/rtrs: include client and server modules into kernel compilation Danil Kipnis
2020-05-11 13:51 ` [PATCH v15 14/25] RDMA/rtrs: a bit of documentation Danil Kipnis
2020-05-11 13:51 ` [PATCH v15 15/25] block/rnbd: private headers with rnbd protocol structs and helpers Danil Kipnis
2020-05-11 13:51 ` [PATCH v15 16/25] block/rnbd: client: private header with client structs and functions Danil Kipnis
2020-05-11 13:51 ` [PATCH v15 17/25] block/rnbd: client: main functionality Danil Kipnis
2020-05-11 13:51 ` [PATCH v15 18/25] block/rnbd: client: sysfs interface functions Danil Kipnis
2020-05-11 13:51 ` Danil Kipnis [this message]
2020-05-11 13:51 ` [PATCH v15 20/25] block/rnbd: server: main functionality Danil Kipnis
2020-05-11 13:51 ` [PATCH v15 21/25] block/rnbd: server: functionality for IO submitting to block dev Danil Kipnis
2020-05-11 13:51 ` [PATCH v15 22/25] block/rnbd: server: sysfs interface functions Danil Kipnis
2020-05-11 13:51 ` [PATCH v15 23/25] block/rnbd: include client and server modules into kernel compilation Danil Kipnis
2020-05-11 13:51 ` [PATCH v15 24/25] block/rnbd: a bit of documentation Danil Kipnis
2020-05-11 13:51 ` [PATCH v15 25/25] MAINTAINERS: Add maintainers for RNBD/RTRS modules Danil Kipnis
2020-05-15 10:29 ` [PATCH v15 00/25] RTRS (former IBTRS) RDMA Transport Library and RNBD (former IBNBD) RDMA Network Block Device Danil Kipnis
2020-05-15 13:53   ` Jens Axboe
2020-05-15 14:39     ` Jinpu Wang
2020-05-15 14:42     ` Danil Kipnis
2020-05-17 22:17 ` Jason Gunthorpe

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=20200511135131.27580-20-danil.kipnis@cloud.ionos.com \
    --to=danil.kipnis@cloud.ionos.com \
    --cc=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=dledford@redhat.com \
    --cc=hch@infradead.org \
    --cc=jgg@ziepe.ca \
    --cc=jinpu.wang@cloud.ionos.com \
    --cc=leon@kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=pankaj.gupta@cloud.ionos.com \
    --cc=sagi@grimberg.me \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.