aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph/osd_client.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/osd_client.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/osd_client.c')
-rw-r--r--fs/ceph/osd_client.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/fs/ceph/osd_client.c b/fs/ceph/osd_client.c
index 3d2bfbc232dc..a51d0df2af30 100644
--- a/fs/ceph/osd_client.c
+++ b/fs/ceph/osd_client.c
@@ -147,7 +147,7 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc,
147 req = kzalloc(sizeof(*req), GFP_NOFS); 147 req = kzalloc(sizeof(*req), GFP_NOFS);
148 } 148 }
149 if (req == NULL) 149 if (req == NULL)
150 return ERR_PTR(-ENOMEM); 150 return NULL;
151 151
152 req->r_osdc = osdc; 152 req->r_osdc = osdc;
153 req->r_mempool = use_mempool; 153 req->r_mempool = use_mempool;
@@ -165,9 +165,9 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc,
165 else 165 else
166 msg = ceph_msg_new(CEPH_MSG_OSD_OPREPLY, 166 msg = ceph_msg_new(CEPH_MSG_OSD_OPREPLY,
167 OSD_OPREPLY_FRONT_LEN, 0, 0, NULL); 167 OSD_OPREPLY_FRONT_LEN, 0, 0, NULL);
168 if (IS_ERR(msg)) { 168 if (!msg) {
169 ceph_osdc_put_request(req); 169 ceph_osdc_put_request(req);
170 return ERR_PTR(PTR_ERR(msg)); 170 return NULL;
171 } 171 }
172 req->r_reply = msg; 172 req->r_reply = msg;
173 173
@@ -179,9 +179,9 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc,
179 msg = ceph_msgpool_get(&osdc->msgpool_op, 0); 179 msg = ceph_msgpool_get(&osdc->msgpool_op, 0);
180 else 180 else
181 msg = ceph_msg_new(CEPH_MSG_OSD_OP, msg_size, 0, 0, NULL); 181 msg = ceph_msg_new(CEPH_MSG_OSD_OP, msg_size, 0, 0, NULL);
182 if (IS_ERR(msg)) { 182 if (!msg) {
183 ceph_osdc_put_request(req); 183 ceph_osdc_put_request(req);
184 return ERR_PTR(PTR_ERR(msg)); 184 return NULL;
185 } 185 }
186 msg->hdr.type = cpu_to_le16(CEPH_MSG_OSD_OP); 186 msg->hdr.type = cpu_to_le16(CEPH_MSG_OSD_OP);
187 memset(msg->front.iov_base, 0, msg->front.iov_len); 187 memset(msg->front.iov_base, 0, msg->front.iov_len);
@@ -1263,8 +1263,8 @@ int ceph_osdc_readpages(struct ceph_osd_client *osdc,
1263 CEPH_OSD_OP_READ, CEPH_OSD_FLAG_READ, 1263 CEPH_OSD_OP_READ, CEPH_OSD_FLAG_READ,
1264 NULL, 0, truncate_seq, truncate_size, NULL, 1264 NULL, 0, truncate_seq, truncate_size, NULL,
1265 false, 1); 1265 false, 1);
1266 if (IS_ERR(req)) 1266 if (!req)
1267 return PTR_ERR(req); 1267 return -ENOMEM;
1268 1268
1269 /* it may be a short read due to an object boundary */ 1269 /* it may be a short read due to an object boundary */
1270 req->r_pages = pages; 1270 req->r_pages = pages;
@@ -1306,8 +1306,8 @@ int ceph_osdc_writepages(struct ceph_osd_client *osdc, struct ceph_vino vino,
1306 snapc, do_sync, 1306 snapc, do_sync,
1307 truncate_seq, truncate_size, mtime, 1307 truncate_seq, truncate_size, mtime,
1308 nofail, 1); 1308 nofail, 1);
1309 if (IS_ERR(req)) 1309 if (!req)
1310 return PTR_ERR(req); 1310 return -ENOMEM;
1311 1311
1312 /* it may be a short write due to an object boundary */ 1312 /* it may be a short write due to an object boundary */
1313 req->r_pages = pages; 1313 req->r_pages = pages;
@@ -1393,7 +1393,7 @@ static struct ceph_msg *get_reply(struct ceph_connection *con,
1393 pr_warning("get_reply front %d > preallocated %d\n", 1393 pr_warning("get_reply front %d > preallocated %d\n",
1394 front, (int)req->r_reply->front.iov_len); 1394 front, (int)req->r_reply->front.iov_len);
1395 m = ceph_msg_new(CEPH_MSG_OSD_OPREPLY, front, 0, 0, NULL); 1395 m = ceph_msg_new(CEPH_MSG_OSD_OPREPLY, front, 0, 0, NULL);
1396 if (IS_ERR(m)) 1396 if (!m)
1397 goto out; 1397 goto out;
1398 ceph_msg_put(req->r_reply); 1398 ceph_msg_put(req->r_reply);
1399 req->r_reply = m; 1399 req->r_reply = m;
@@ -1409,7 +1409,7 @@ static struct ceph_msg *get_reply(struct ceph_connection *con,
1409 tid, want, m->nr_pages); 1409 tid, want, m->nr_pages);
1410 *skip = 1; 1410 *skip = 1;
1411 ceph_msg_put(m); 1411 ceph_msg_put(m);
1412 m = ERR_PTR(-EIO); 1412 m = NULL;
1413 goto out; 1413 goto out;
1414 } 1414 }
1415 m->pages = req->r_pages; 1415 m->pages = req->r_pages;