From: Jack Wang <jinpu.wang@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, rpenyaev@suse.de,
pankaj.gupta@cloud.ionos.com
Subject: [PATCH v11 20/26] block/rnbd: server: private header with server structs and functions
Date: Fri, 20 Mar 2020 13:16:51 +0100 [thread overview]
Message-ID: <20200320121657.1165-21-jinpu.wang@cloud.ionos.com> (raw)
In-Reply-To: <20200320121657.1165-1-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 | 77 +++++++++++++++++++++++++++++++++++
1 file changed, 77 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..27cbcb86bc38
--- /dev/null
+++ b/drivers/block/rnbd/rnbd-srv.h
@@ -0,0 +1,77 @@
+/* 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];
+
+ rwlock_t index_lock ____cacheline_aligned;
+ struct idr 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;
+ struct completion *sysfs_release_compl;
+ 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);
+
+#endif /* RNBD_SRV_H */
--
2.17.1
next prev parent reply other threads:[~2020-03-20 12:17 UTC|newest]
Thread overview: 71+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-20 12:16 [PATCH v11 00/26] RTRS (former IBTRS) RDMA Transport Library and RNBD (former IBNBD) RDMA Network Block Device Jack Wang
2020-03-20 12:16 ` [PATCH v11 01/26] sysfs: export sysfs_remove_file_self() Jack Wang
2020-03-20 12:16 ` [PATCH v11 02/26] RDMA/rtrs: public interface header to establish RDMA connections Jack Wang
2020-03-20 12:16 ` [PATCH v11 03/26] RDMA/rtrs: private headers with rtrs protocol structs and helpers Jack Wang
2020-03-20 12:16 ` [PATCH v11 04/26] RDMA/rtrs: core: lib functions shared between client and server modules Jack Wang
2020-03-28 4:26 ` Bart Van Assche
2020-03-30 10:34 ` Jinpu Wang
2020-03-30 22:25 ` Bart Van Assche
2020-03-31 7:11 ` Jinpu Wang
2020-03-20 12:16 ` [PATCH v11 05/26] RDMA/rtrs: client: private header with client structs and functions Jack Wang
2020-03-20 12:16 ` [PATCH v11 06/26] RDMA/rtrs: client: main functionality Jack Wang
2020-03-20 12:16 ` [PATCH v11 07/26] RDMA/rtrs: client: statistics functions Jack Wang
2020-03-20 12:16 ` [PATCH v11 08/26] RDMA/rtrs: client: sysfs interface functions Jack Wang
2020-03-30 22:28 ` Bart Van Assche
2020-03-31 7:20 ` Jinpu Wang
2020-03-20 12:16 ` [PATCH v11 09/26] RDMA/rtrs: server: private header with server structs and functions Jack Wang
2020-03-20 12:16 ` [PATCH v11 10/26] RDMA/rtrs: server: main functionality Jack Wang
2020-03-20 12:16 ` [PATCH v11 11/26] RDMA/rtrs: server: statistics functions Jack Wang
2020-03-20 12:16 ` [PATCH v11 12/26] RDMA/rtrs: server: sysfs interface functions Jack Wang
2020-03-30 22:29 ` Bart Van Assche
2020-03-31 7:13 ` Jinpu Wang
2020-03-20 12:16 ` [PATCH v11 13/26] RDMA/rtrs: include client and server modules into kernel compilation Jack Wang
2020-03-20 12:16 ` [PATCH v11 14/26] RDMA/rtrs: a bit of documentation Jack Wang
2020-03-20 12:16 ` [PATCH v11 15/26] block: reexport bio_map_kern Jack Wang
2020-03-28 3:58 ` Bart Van Assche
2020-03-28 8:29 ` Christoph Hellwig
2020-03-28 16:16 ` Bart Van Assche
2020-03-29 15:05 ` Christoph Hellwig
2020-03-29 18:08 ` Chaitanya Kulkarni
2020-03-30 6:28 ` hch
2020-03-30 10:44 ` Jinpu Wang
2020-03-30 18:57 ` Chaitanya Kulkarni
2020-03-20 12:16 ` [PATCH v11 16/26] block/rnbd: private headers with rnbd protocol structs and helpers Jack Wang
2020-03-28 4:58 ` Bart Van Assche
2020-03-31 7:32 ` Jinpu Wang
2020-03-20 12:16 ` [PATCH v11 17/26] block/rnbd: client: private header with client structs and functions Jack Wang
2020-03-28 4:26 ` Bart Van Assche
2020-03-31 9:08 ` Jinpu Wang
2020-03-20 12:16 ` [PATCH v11 18/26] block/rnbd: client: main functionality Jack Wang
2020-03-28 4:45 ` Bart Van Assche
2020-03-31 9:23 ` Jinpu Wang
2020-04-02 16:27 ` Jinpu Wang
2020-03-28 4:59 ` Bart Van Assche
2020-03-31 9:25 ` Jinpu Wang
2020-03-31 14:12 ` Bart Van Assche
2020-03-31 14:20 ` Jinpu Wang
2020-03-20 12:16 ` [PATCH v11 19/26] block/rnbd: client: sysfs interface functions Jack Wang
2020-03-28 4:59 ` Bart Van Assche
2020-03-31 9:26 ` Jinpu Wang
2020-03-20 12:16 ` Jack Wang [this message]
2020-03-20 12:16 ` [PATCH v11 21/26] block/rnbd: server: main functionality Jack Wang
2020-03-28 17:40 ` Bart Van Assche
2020-03-31 9:29 ` Jinpu Wang
2020-03-31 15:32 ` Jinpu Wang
2020-03-20 12:16 ` [PATCH v11 22/26] block/rnbd: server: functionality for IO submission to file or block dev Jack Wang
2020-03-28 18:39 ` Bart Van Assche
2020-03-31 10:06 ` Jinpu Wang
2020-03-20 12:16 ` [PATCH v11 23/26] block/rnbd: server: sysfs interface functions Jack Wang
2020-03-28 19:31 ` Bart Van Assche
2020-03-28 23:06 ` Jason Gunthorpe
2020-03-30 13:14 ` Danil Kipnis
2020-03-20 12:16 ` [PATCH v11 24/26] block/rnbd: include client and server modules into kernel compilation Jack Wang
2020-03-28 19:34 ` Bart Van Assche
2020-03-31 7:23 ` Jinpu Wang
2020-03-20 12:16 ` [PATCH v11 25/26] block/rnbd: a bit of documentation Jack Wang
2020-03-28 19:40 ` Bart Van Assche
2020-03-30 10:17 ` Danil Kipnis
2020-03-20 12:16 ` [PATCH v11 26/26] MAINTAINERS: Add maintainers for RNBD/RTRS modules Jack Wang
2020-03-28 19:40 ` Bart Van Assche
2020-03-30 10:12 ` Danil Kipnis
2020-03-26 17:38 ` [PATCH v11 00/26] RTRS (former IBTRS) RDMA Transport Library and RNBD (former IBNBD) RDMA Network Block Device Jinpu Wang
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=20200320121657.1165-21-jinpu.wang@cloud.ionos.com \
--to=jinpu.wang@cloud.ionos.com \
--cc=axboe@kernel.dk \
--cc=bvanassche@acm.org \
--cc=danil.kipnis@cloud.ionos.com \
--cc=dledford@redhat.com \
--cc=hch@infradead.org \
--cc=jgg@ziepe.ca \
--cc=leon@kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=pankaj.gupta@cloud.ionos.com \
--cc=rpenyaev@suse.de \
--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 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).