diff options
| author | Trond Myklebust <trond.myklebust@primarydata.com> | 2015-02-14 20:31:59 -0500 |
|---|---|---|
| committer | Trond Myklebust <trond.myklebust@primarydata.com> | 2016-02-05 18:48:54 -0500 |
| commit | 80b14d5e61ca6d08e46b4fc72baf6e4f738b30ce (patch) | |
| tree | 0919feba0c10ef4188805b635a97df6899fe9c4b /include/linux/sunrpc | |
| parent | fda1bfef9e465b28260d27cd9e538dd601c4cdc1 (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.h | 5 | ||||
| -rw-r--r-- | include/linux/sunrpc/xprtmultipath.h | 69 |
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 | |||
| 11 | struct rpc_xprt_iter_ops; | ||
| 12 | struct 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 | |||
| 26 | struct 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 | |||
| 34 | struct 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 | |||
| 40 | extern struct rpc_xprt_switch *xprt_switch_alloc(struct rpc_xprt *xprt, | ||
| 41 | gfp_t gfp_flags); | ||
| 42 | |||
| 43 | extern struct rpc_xprt_switch *xprt_switch_get(struct rpc_xprt_switch *xps); | ||
| 44 | extern void xprt_switch_put(struct rpc_xprt_switch *xps); | ||
| 45 | |||
| 46 | extern void rpc_xprt_switch_set_roundrobin(struct rpc_xprt_switch *xps); | ||
| 47 | |||
| 48 | extern void rpc_xprt_switch_add_xprt(struct rpc_xprt_switch *xps, | ||
| 49 | struct rpc_xprt *xprt); | ||
| 50 | extern void rpc_xprt_switch_remove_xprt(struct rpc_xprt_switch *xps, | ||
| 51 | struct rpc_xprt *xprt); | ||
| 52 | |||
| 53 | extern void xprt_iter_init(struct rpc_xprt_iter *xpi, | ||
| 54 | struct rpc_xprt_switch *xps); | ||
| 55 | |||
| 56 | extern void xprt_iter_init_listall(struct rpc_xprt_iter *xpi, | ||
| 57 | struct rpc_xprt_switch *xps); | ||
| 58 | |||
| 59 | extern void xprt_iter_destroy(struct rpc_xprt_iter *xpi); | ||
| 60 | |||
| 61 | extern struct rpc_xprt_switch *xprt_iter_xchg_switch( | ||
| 62 | struct rpc_xprt_iter *xpi, | ||
| 63 | struct rpc_xprt_switch *newswitch); | ||
| 64 | |||
| 65 | extern struct rpc_xprt *xprt_iter_xprt(struct rpc_xprt_iter *xpi); | ||
| 66 | extern struct rpc_xprt *xprt_iter_get_xprt(struct rpc_xprt_iter *xpi); | ||
| 67 | extern struct rpc_xprt *xprt_iter_get_next(struct rpc_xprt_iter *xpi); | ||
| 68 | |||
| 69 | #endif | ||
