diff options
author | Tom Tucker <tom@opengridcomputing.com> | 2008-05-28 15:05:54 -0400 |
---|---|---|
committer | Tom Tucker <tom@opengridcomputing.com> | 2008-07-02 16:02:01 -0400 |
commit | bf5927d84e70d522f234ca247b27d27c63878b93 (patch) | |
tree | 5fde73a6d64da9ee3682185ae5c09c3cfbe817d1 /net/sunrpc/xprtrdma | |
parent | 902a94e0889be1f9fcefc0e1b602b06136e01812 (diff) |
svcrdma: Create a kmem cache for the WR contexts
Create a kmem cache to hold WR contexts. Next we will convert
the WR context get and put services to use this kmem cache.
Signed-off-by: Tom Tucker <tom@opengridcomputing.com>
Diffstat (limited to 'net/sunrpc/xprtrdma')
-rw-r--r-- | net/sunrpc/xprtrdma/svc_rdma.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/net/sunrpc/xprtrdma/svc_rdma.c b/net/sunrpc/xprtrdma/svc_rdma.c index 527acfd3828..87101177825 100644 --- a/net/sunrpc/xprtrdma/svc_rdma.c +++ b/net/sunrpc/xprtrdma/svc_rdma.c | |||
@@ -69,8 +69,9 @@ atomic_t rdma_stat_rq_prod; | |||
69 | atomic_t rdma_stat_sq_poll; | 69 | atomic_t rdma_stat_sq_poll; |
70 | atomic_t rdma_stat_sq_prod; | 70 | atomic_t rdma_stat_sq_prod; |
71 | 71 | ||
72 | /* Temporary NFS request map cache */ | 72 | /* Temporary NFS request map and context caches */ |
73 | struct kmem_cache *svc_rdma_map_cachep; | 73 | struct kmem_cache *svc_rdma_map_cachep; |
74 | struct kmem_cache *svc_rdma_ctxt_cachep; | ||
74 | 75 | ||
75 | /* | 76 | /* |
76 | * This function implements reading and resetting an atomic_t stat | 77 | * This function implements reading and resetting an atomic_t stat |
@@ -246,6 +247,7 @@ void svc_rdma_cleanup(void) | |||
246 | } | 247 | } |
247 | svc_unreg_xprt_class(&svc_rdma_class); | 248 | svc_unreg_xprt_class(&svc_rdma_class); |
248 | kmem_cache_destroy(svc_rdma_map_cachep); | 249 | kmem_cache_destroy(svc_rdma_map_cachep); |
250 | kmem_cache_destroy(svc_rdma_ctxt_cachep); | ||
249 | } | 251 | } |
250 | 252 | ||
251 | int svc_rdma_init(void) | 253 | int svc_rdma_init(void) |
@@ -268,14 +270,27 @@ int svc_rdma_init(void) | |||
268 | NULL); | 270 | NULL); |
269 | if (!svc_rdma_map_cachep) { | 271 | if (!svc_rdma_map_cachep) { |
270 | printk(KERN_INFO "Could not allocate map cache.\n"); | 272 | printk(KERN_INFO "Could not allocate map cache.\n"); |
271 | goto err; | 273 | goto err0; |
274 | } | ||
275 | |||
276 | /* Create the temporary context cache */ | ||
277 | svc_rdma_ctxt_cachep = | ||
278 | kmem_cache_create("svc_rdma_ctxt_cache", | ||
279 | sizeof(struct svc_rdma_op_ctxt), | ||
280 | 0, | ||
281 | SLAB_HWCACHE_ALIGN, | ||
282 | NULL); | ||
283 | if (!svc_rdma_ctxt_cachep) { | ||
284 | printk(KERN_INFO "Could not allocate WR ctxt cache.\n"); | ||
285 | goto err1; | ||
272 | } | 286 | } |
273 | 287 | ||
274 | /* Register RDMA with the SVC transport switch */ | 288 | /* Register RDMA with the SVC transport switch */ |
275 | svc_reg_xprt_class(&svc_rdma_class); | 289 | svc_reg_xprt_class(&svc_rdma_class); |
276 | return 0; | 290 | return 0; |
277 | 291 | err1: | |
278 | err: | 292 | kmem_cache_destroy(svc_rdma_map_cachep); |
293 | err0: | ||
279 | unregister_sysctl_table(svcrdma_table_header); | 294 | unregister_sysctl_table(svcrdma_table_header); |
280 | return -ENOMEM; | 295 | return -ENOMEM; |
281 | } | 296 | } |