aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph/msgpool.c
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2010-04-24 12:56:35 -0400
committerSage Weil <sage@newdream.net>2010-05-17 18:25:24 -0400
commit4f48280ee1d0654390cd50ad0c41ea93309e7c91 (patch)
treee0a9b6502ddcf09caa66c99b787685f4846ea7ef /fs/ceph/msgpool.c
parent8c6efb58a5bab880d45b2078cb55ec4320707daf (diff)
ceph: name msgpools; useful error messages
Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph/msgpool.c')
-rw-r--r--fs/ceph/msgpool.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/fs/ceph/msgpool.c b/fs/ceph/msgpool.c
index 10d3632cc403..50fe5cc5de76 100644
--- a/fs/ceph/msgpool.c
+++ b/fs/ceph/msgpool.c
@@ -10,8 +10,12 @@
10static void *alloc_fn(gfp_t gfp_mask, void *arg) 10static void *alloc_fn(gfp_t gfp_mask, void *arg)
11{ 11{
12 struct ceph_msgpool *pool = arg; 12 struct ceph_msgpool *pool = arg;
13 void *p;
13 14
14 return ceph_msg_new(0, pool->front_len); 15 p = ceph_msg_new(0, pool->front_len);
16 if (!p)
17 pr_err("msgpool %s alloc failed\n", pool->name);
18 return p;
15} 19}
16 20
17static void free_fn(void *element, void *arg) 21static void free_fn(void *element, void *arg)
@@ -20,12 +24,13 @@ static void free_fn(void *element, void *arg)
20} 24}
21 25
22int ceph_msgpool_init(struct ceph_msgpool *pool, 26int ceph_msgpool_init(struct ceph_msgpool *pool,
23 int front_len, int size, bool blocking) 27 int front_len, int size, bool blocking, const char *name)
24{ 28{
25 pool->front_len = front_len; 29 pool->front_len = front_len;
26 pool->pool = mempool_create(size, alloc_fn, free_fn, pool); 30 pool->pool = mempool_create(size, alloc_fn, free_fn, pool);
27 if (!pool->pool) 31 if (!pool->pool)
28 return -ENOMEM; 32 return -ENOMEM;
33 pool->name = name;
29 return 0; 34 return 0;
30} 35}
31 36
@@ -38,8 +43,8 @@ struct ceph_msg *ceph_msgpool_get(struct ceph_msgpool *pool,
38 int front_len) 43 int front_len)
39{ 44{
40 if (front_len > pool->front_len) { 45 if (front_len > pool->front_len) {
41 pr_err("msgpool_get pool %p need front %d, pool size is %d\n", 46 pr_err("msgpool_get pool %s need front %d, pool size is %d\n",
42 pool, front_len, pool->front_len); 47 pool->name, front_len, pool->front_len);
43 WARN_ON(1); 48 WARN_ON(1);
44 49
45 /* try to alloc a fresh message */ 50 /* try to alloc a fresh message */