diff options
| author | Chuck Lever <chuck.lever@oracle.com> | 2006-12-05 16:35:54 -0500 |
|---|---|---|
| committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-12-06 10:46:53 -0500 |
| commit | fbf76683ff9d1462ec0b2f90ec6ea4793652318c (patch) | |
| tree | 22a5738d7eb984ae7315e471814f43c5ea8d8b2e | |
| parent | 282b32e17f64be2204f1ac96d7f40f92cb768cd7 (diff) | |
SUNRPC: relocate the creation of socket-specific tunables
Clean-up:
The RPC client currently creates some sysctls that are specific to the
socket transport. Move those entirely into xprtsock.c.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
| -rw-r--r-- | net/sunrpc/sysctl.c | 50 | ||||
| -rw-r--r-- | net/sunrpc/xprtsock.c | 107 |
2 files changed, 104 insertions, 53 deletions
diff --git a/net/sunrpc/sysctl.c b/net/sunrpc/sysctl.c index d89b048ad6bb..82b27528d0c4 100644 --- a/net/sunrpc/sysctl.c +++ b/net/sunrpc/sysctl.c | |||
| @@ -18,7 +18,6 @@ | |||
| 18 | #include <linux/sunrpc/types.h> | 18 | #include <linux/sunrpc/types.h> |
| 19 | #include <linux/sunrpc/sched.h> | 19 | #include <linux/sunrpc/sched.h> |
| 20 | #include <linux/sunrpc/stats.h> | 20 | #include <linux/sunrpc/stats.h> |
| 21 | #include <linux/sunrpc/xprt.h> | ||
| 22 | 21 | ||
| 23 | /* | 22 | /* |
| 24 | * Declare the debug flags here | 23 | * Declare the debug flags here |
| @@ -119,11 +118,6 @@ done: | |||
| 119 | } | 118 | } |
| 120 | 119 | ||
| 121 | 120 | ||
| 122 | static unsigned int min_slot_table_size = RPC_MIN_SLOT_TABLE; | ||
| 123 | static unsigned int max_slot_table_size = RPC_MAX_SLOT_TABLE; | ||
| 124 | static unsigned int xprt_min_resvport_limit = RPC_MIN_RESVPORT; | ||
| 125 | static unsigned int xprt_max_resvport_limit = RPC_MAX_RESVPORT; | ||
| 126 | |||
| 127 | static ctl_table debug_table[] = { | 121 | static ctl_table debug_table[] = { |
| 128 | { | 122 | { |
| 129 | .ctl_name = CTL_RPCDEBUG, | 123 | .ctl_name = CTL_RPCDEBUG, |
| @@ -157,50 +151,6 @@ static ctl_table debug_table[] = { | |||
| 157 | .mode = 0644, | 151 | .mode = 0644, |
| 158 | .proc_handler = &proc_dodebug | 152 | .proc_handler = &proc_dodebug |
| 159 | }, | 153 | }, |
| 160 | { | ||
| 161 | .ctl_name = CTL_SLOTTABLE_UDP, | ||
| 162 | .procname = "udp_slot_table_entries", | ||
| 163 | .data = &xprt_udp_slot_table_entries, | ||
| 164 | .maxlen = sizeof(unsigned int), | ||
| 165 | .mode = 0644, | ||
| 166 | .proc_handler = &proc_dointvec_minmax, | ||
| 167 | .strategy = &sysctl_intvec, | ||
| 168 | .extra1 = &min_slot_table_size, | ||
| 169 | .extra2 = &max_slot_table_size | ||
| 170 | }, | ||
| 171 | { | ||
| 172 | .ctl_name = CTL_SLOTTABLE_TCP, | ||
| 173 | .procname = "tcp_slot_table_entries", | ||
| 174 | .data = &xprt_tcp_slot_table_entries, | ||
| 175 | .maxlen = sizeof(unsigned int), | ||
| 176 | .mode = 0644, | ||
| 177 | .proc_handler = &proc_dointvec_minmax, | ||
| 178 | .strategy = &sysctl_intvec, | ||
| 179 | .extra1 = &min_slot_table_size, | ||
| 180 | .extra2 = &max_slot_table_size | ||
| 181 | }, | ||
| 182 | { | ||
| 183 | .ctl_name = CTL_MIN_RESVPORT, | ||
| 184 | .procname = "min_resvport", | ||
| 185 | .data = &xprt_min_resvport, | ||
| 186 | .maxlen = sizeof(unsigned int), | ||
| 187 | .mode = 0644, | ||
| 188 | .proc_handler = &proc_dointvec_minmax, | ||
| 189 | .strategy = &sysctl_intvec, | ||
| 190 | .extra1 = &xprt_min_resvport_limit, | ||
| 191 | .extra2 = &xprt_max_resvport_limit | ||
| 192 | }, | ||
| 193 | { | ||
| 194 | .ctl_name = CTL_MAX_RESVPORT, | ||
| 195 | .procname = "max_resvport", | ||
| 196 | .data = &xprt_max_resvport, | ||
| 197 | .maxlen = sizeof(unsigned int), | ||
| 198 | .mode = 0644, | ||
| 199 | .proc_handler = &proc_dointvec_minmax, | ||
| 200 | .strategy = &sysctl_intvec, | ||
| 201 | .extra1 = &xprt_min_resvport_limit, | ||
| 202 | .extra2 = &xprt_max_resvport_limit | ||
| 203 | }, | ||
| 204 | { .ctl_name = 0 } | 154 | { .ctl_name = 0 } |
| 205 | }; | 155 | }; |
| 206 | 156 | ||
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index 70131c36f371..21438d7dc47b 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c | |||
| @@ -46,6 +46,92 @@ unsigned int xprt_min_resvport = RPC_DEF_MIN_RESVPORT; | |||
| 46 | unsigned int xprt_max_resvport = RPC_DEF_MAX_RESVPORT; | 46 | unsigned int xprt_max_resvport = RPC_DEF_MAX_RESVPORT; |
| 47 | 47 | ||
| 48 | /* | 48 | /* |
| 49 | * We can register our own files under /proc/sys/sunrpc by | ||
| 50 | * calling register_sysctl_table() again. The files in that | ||
| 51 | * directory become the union of all files registered there. | ||
| 52 | * | ||
| 53 | * We simply need to make sure that we don't collide with | ||
| 54 | * someone else's file names! | ||
| 55 | */ | ||
| 56 | |||
| 57 | #ifdef RPC_DEBUG | ||
| 58 | |||
| 59 | static unsigned int min_slot_table_size = RPC_MIN_SLOT_TABLE; | ||
| 60 | static unsigned int max_slot_table_size = RPC_MAX_SLOT_TABLE; | ||
| 61 | static unsigned int xprt_min_resvport_limit = RPC_MIN_RESVPORT; | ||
| 62 | static unsigned int xprt_max_resvport_limit = RPC_MAX_RESVPORT; | ||
| 63 | |||
| 64 | static struct ctl_table_header *sunrpc_table_header; | ||
| 65 | |||
| 66 | /* | ||
| 67 | * FIXME: changing the UDP slot table size should also resize the UDP | ||
| 68 | * socket buffers for existing UDP transports | ||
| 69 | */ | ||
| 70 | static ctl_table xs_tunables_table[] = { | ||
| 71 | { | ||
| 72 | .ctl_name = CTL_SLOTTABLE_UDP, | ||
| 73 | .procname = "udp_slot_table_entries", | ||
| 74 | .data = &xprt_udp_slot_table_entries, | ||
| 75 | .maxlen = sizeof(unsigned int), | ||
| 76 | .mode = 0644, | ||
| 77 | .proc_handler = &proc_dointvec_minmax, | ||
| 78 | .strategy = &sysctl_intvec, | ||
| 79 | .extra1 = &min_slot_table_size, | ||
| 80 | .extra2 = &max_slot_table_size | ||
| 81 | }, | ||
| 82 | { | ||
| 83 | .ctl_name = CTL_SLOTTABLE_TCP, | ||
| 84 | .procname = "tcp_slot_table_entries", | ||
| 85 | .data = &xprt_tcp_slot_table_entries, | ||
| 86 | .maxlen = sizeof(unsigned int), | ||
| 87 | .mode = 0644, | ||
| 88 | .proc_handler = &proc_dointvec_minmax, | ||
| 89 | .strategy = &sysctl_intvec, | ||
| 90 | .extra1 = &min_slot_table_size, | ||
| 91 | .extra2 = &max_slot_table_size | ||
| 92 | }, | ||
| 93 | { | ||
| 94 | .ctl_name = CTL_MIN_RESVPORT, | ||
| 95 | .procname = "min_resvport", | ||
| 96 | .data = &xprt_min_resvport, | ||
| 97 | .maxlen = sizeof(unsigned int), | ||
| 98 | .mode = 0644, | ||
| 99 | .proc_handler = &proc_dointvec_minmax, | ||
| 100 | .strategy = &sysctl_intvec, | ||
| 101 | .extra1 = &xprt_min_resvport_limit, | ||
| 102 | .extra2 = &xprt_max_resvport_limit | ||
| 103 | }, | ||
| 104 | { | ||
| 105 | .ctl_name = CTL_MAX_RESVPORT, | ||
| 106 | .procname = "max_resvport", | ||
| 107 | .data = &xprt_max_resvport, | ||
| 108 | .maxlen = sizeof(unsigned int), | ||
| 109 | .mode = 0644, | ||
| 110 | .proc_handler = &proc_dointvec_minmax, | ||
| 111 | .strategy = &sysctl_intvec, | ||
| 112 | .extra1 = &xprt_min_resvport_limit, | ||
| 113 | .extra2 = &xprt_max_resvport_limit | ||
| 114 | }, | ||
| 115 | { | ||
| 116 | .ctl_name = 0, | ||
| 117 | }, | ||
| 118 | }; | ||
| 119 | |||
| 120 | static ctl_table sunrpc_table[] = { | ||
| 121 | { | ||
| 122 | .ctl_name = CTL_SUNRPC, | ||
| 123 | .procname = "sunrpc", | ||
| 124 | .mode = 0555, | ||
| 125 | .child = xs_tunables_table | ||
| 126 | }, | ||
| 127 | { | ||
| 128 | .ctl_name = 0, | ||
| 129 | }, | ||
| 130 | }; | ||
| 131 | |||
| 132 | #endif | ||
| 133 | |||
| 134 | /* | ||
| 49 | * How many times to try sending a request on a socket before waiting | 135 | * How many times to try sending a request on a socket before waiting |
| 50 | * for the socket buffer to clear. | 136 | * for the socket buffer to clear. |
| 51 | */ | 137 | */ |
| @@ -1504,19 +1590,34 @@ struct rpc_xprt *xs_setup_tcp(struct sockaddr *addr, size_t addrlen, struct rpc_ | |||
| 1504 | } | 1590 | } |
| 1505 | 1591 | ||
| 1506 | /** | 1592 | /** |
| 1507 | * init_socket_xprt - stub | 1593 | * init_socket_xprt - set up xprtsock's sysctls |
| 1508 | * | 1594 | * |
| 1509 | */ | 1595 | */ |
| 1510 | int init_socket_xprt(void) | 1596 | int init_socket_xprt(void) |
| 1511 | { | 1597 | { |
| 1598 | #ifdef RPC_DEBUG | ||
| 1599 | if (!sunrpc_table_header) { | ||
| 1600 | sunrpc_table_header = register_sysctl_table(sunrpc_table, 1); | ||
| 1601 | #ifdef CONFIG_PROC_FS | ||
| 1602 | if (sunrpc_table[0].de) | ||
| 1603 | sunrpc_table[0].de->owner = THIS_MODULE; | ||
| 1604 | #endif | ||
| 1605 | } | ||
| 1606 | #endif | ||
| 1607 | |||
| 1512 | return 0; | 1608 | return 0; |
| 1513 | } | 1609 | } |
| 1514 | 1610 | ||
| 1515 | /** | 1611 | /** |
| 1516 | * cleanup_socket_xprt - stub | 1612 | * cleanup_socket_xprt - remove xprtsock's sysctls |
| 1517 | * | 1613 | * |
| 1518 | */ | 1614 | */ |
| 1519 | void cleanup_socket_xprt(void) | 1615 | void cleanup_socket_xprt(void) |
| 1520 | { | 1616 | { |
| 1521 | return; | 1617 | #ifdef RPC_DEBUG |
| 1618 | if (sunrpc_table_header) { | ||
| 1619 | unregister_sysctl_table(sunrpc_table_header); | ||
| 1620 | sunrpc_table_header = NULL; | ||
| 1621 | } | ||
| 1622 | #endif | ||
| 1522 | } | 1623 | } |
