aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/sunrpc
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@primarydata.com>2015-02-14 20:31:59 -0500
committerTrond Myklebust <trond.myklebust@primarydata.com>2016-02-05 18:48:54 -0500
commit80b14d5e61ca6d08e46b4fc72baf6e4f738b30ce (patch)
tree0919feba0c10ef4188805b635a97df6899fe9c4b /include/linux/sunrpc
parentfda1bfef9e465b28260d27cd9e538dd601c4cdc1 (diff)
SUNRPC: Add a structure to track multiple transports
In order to support multipathing/trunking we will need the ability to track multiple transports. This patch sets up a basic structure for doing so. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'include/linux/sunrpc')
-rw-r--r--include/linux/sunrpc/xprt.h5
-rw-r--r--include/linux/sunrpc/xprtmultipath.h69
2 files changed, 74 insertions, 0 deletions
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index 83218129ff28..fb0d212e0d3a 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -198,6 +198,11 @@ struct rpc_xprt {
198 unsigned int bind_index; /* bind function index */ 198 unsigned int bind_index; /* bind function index */
199 199
200 /* 200 /*
201 * Multipath
202 */
203 struct list_head xprt_switch;
204
205 /*
201 * Connection of transports 206 * Connection of transports
202 */ 207 */
203 unsigned long bind_timeout, 208 unsigned long bind_timeout,
diff --git a/include/linux/sunrpc/xprtmultipath.h b/include/linux/sunrpc/xprtmultipath.h
new file mode 100644
index 000000000000..5a9acffa41be
--- /dev/null
+++ b/include/linux/sunrpc/xprtmultipath.h
@@ -0,0 +1,69 @@
1/*
2 * RPC client multipathing definitions
3 *
4 * Copyright (c) 2015, 2016, Primary Data, Inc. All rights reserved.
5 *
6 * Trond Myklebust <trond.myklebust@primarydata.com>
7 */
8#ifndef _NET_SUNRPC_XPRTMULTIPATH_H
9#define _NET_SUNRPC_XPRTMULTIPATH_H
10
11struct rpc_xprt_iter_ops;
12struct rpc_xprt_switch {
13 spinlock_t xps_lock;
14 struct kref xps_kref;
15
16 unsigned int xps_nxprts;
17 struct list_head xps_xprt_list;
18
19 struct net * xps_net;
20
21 const struct rpc_xprt_iter_ops *xps_iter_ops;
22
23 struct rcu_head xps_rcu;
24};
25
26struct rpc_xprt_iter {
27 struct rpc_xprt_switch __rcu *xpi_xpswitch;
28 struct rpc_xprt * xpi_cursor;
29
30 const struct rpc_xprt_iter_ops *xpi_ops;
31};
32
33
34struct rpc_xprt_iter_ops {
35 void (*xpi_rewind)(struct rpc_xprt_iter *);
36 struct rpc_xprt *(*xpi_xprt)(struct rpc_xprt_iter *);
37 struct rpc_xprt *(*xpi_next)(struct rpc_xprt_iter *);
38};
39
40extern struct rpc_xprt_switch *xprt_switch_alloc(struct rpc_xprt *xprt,
41 gfp_t gfp_flags);
42
43extern struct rpc_xprt_switch *xprt_switch_get(struct rpc_xprt_switch *xps);
44extern void xprt_switch_put(struct rpc_xprt_switch *xps);
45
46extern void rpc_xprt_switch_set_roundrobin(struct rpc_xprt_switch *xps);
47
48extern void rpc_xprt_switch_add_xprt(struct rpc_xprt_switch *xps,
49 struct rpc_xprt *xprt);
50extern void rpc_xprt_switch_remove_xprt(struct rpc_xprt_switch *xps,
51 struct rpc_xprt *xprt);
52
53extern void xprt_iter_init(struct rpc_xprt_iter *xpi,
54 struct rpc_xprt_switch *xps);
55
56extern void xprt_iter_init_listall(struct rpc_xprt_iter *xpi,
57 struct rpc_xprt_switch *xps);
58
59extern void xprt_iter_destroy(struct rpc_xprt_iter *xpi);
60
61extern struct rpc_xprt_switch *xprt_iter_xchg_switch(
62 struct rpc_xprt_iter *xpi,
63 struct rpc_xprt_switch *newswitch);
64
65extern struct rpc_xprt *xprt_iter_xprt(struct rpc_xprt_iter *xpi);
66extern struct rpc_xprt *xprt_iter_get_xprt(struct rpc_xprt_iter *xpi);
67extern struct rpc_xprt *xprt_iter_get_next(struct rpc_xprt_iter *xpi);
68
69#endif