aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph/msgpool.c
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2010-04-01 19:06:19 -0400
committerSage Weil <sage@newdream.net>2010-05-17 18:25:18 -0400
commita79832f26be370ee26ea81eecdfd42d10e49d66a (patch)
tree59d55f3c928558505a420830eddfb01b3186d467 /fs/ceph/msgpool.c
parentd52f847a841bfeba0ea87a7842732d388a1ca2e8 (diff)
ceph: make ceph_msg_new return NULL on failure; clean up, fix callers
Returning ERR_PTR(-ENOMEM) is useless extra work. Return NULL on failure instead, and fix up the callers (about half of which were wrong anyway). 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, 2 insertions, 11 deletions
diff --git a/fs/ceph/msgpool.c b/fs/ceph/msgpool.c
index ca032223e87b..04fea84890da 100644
--- a/fs/ceph/msgpool.c
+++ b/fs/ceph/msgpool.c
@@ -10,12 +10,8 @@
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 struct ceph_msg *m;
14 13
15 m = ceph_msg_new(0, pool->front_len, 0, 0, NULL); 14 return ceph_msg_new(0, pool->front_len, 0, 0, NULL);
16 if (IS_ERR(m))
17 return NULL;
18 return m;
19} 15}
20 16
21static void free_fn(void *element, void *arg) 17static void free_fn(void *element, void *arg)
@@ -42,17 +38,12 @@ struct ceph_msg *ceph_msgpool_get(struct ceph_msgpool *pool,
42 int front_len) 38 int front_len)
43{ 39{
44 if (front_len > pool->front_len) { 40 if (front_len > pool->front_len) {
45 struct ceph_msg *msg;
46
47 pr_err("msgpool_get pool %p need front %d, pool size is %d\n", 41 pr_err("msgpool_get pool %p need front %d, pool size is %d\n",
48 pool, front_len, pool->front_len); 42 pool, front_len, pool->front_len);
49 WARN_ON(1); 43 WARN_ON(1);
50 44
51 /* try to alloc a fresh message */ 45 /* try to alloc a fresh message */
52 msg = ceph_msg_new(0, front_len, 0, 0, NULL); 46 return ceph_msg_new(0, front_len, 0, 0, NULL);
53 if (!IS_ERR(msg))
54 return msg;
55 return NULL;
56 } 47 }
57 48
58 return mempool_alloc(pool->pool, GFP_NOFS); 49 return mempool_alloc(pool->pool, GFP_NOFS);