aboutsummaryrefslogtreecommitdiffstats
path: root/net/ceph/osd_client.c
diff options
context:
space:
mode:
authorIlya Dryomov <ilya.dryomov@inktank.com>2014-09-02 05:40:33 -0400
committerIlya Dryomov <idryomov@redhat.com>2014-10-14 13:03:18 -0400
commitf671b581f1dac61354186b7373af5f97fe420584 (patch)
tree4939c81c3fe69bcb6955b5c5677a662b98845a17 /net/ceph/osd_client.c
parentbfe01a5ba2490f299e1d2d5508cbbbadd897bbe9 (diff)
libceph: abstract out ceph_osd_request enqueue logic
Introduce __enqueue_request() and switch to it. Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com> Reviewed-by: Alex Elder <elder@linaro.org>
Diffstat (limited to 'net/ceph/osd_client.c')
-rw-r--r--net/ceph/osd_client.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index 30f6faf3584f..648a215d734e 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -1346,6 +1346,22 @@ static int __calc_request_pg(struct ceph_osdmap *osdmap,
1346 &req->r_target_oid, pg_out); 1346 &req->r_target_oid, pg_out);
1347} 1347}
1348 1348
1349static void __enqueue_request(struct ceph_osd_request *req)
1350{
1351 struct ceph_osd_client *osdc = req->r_osdc;
1352
1353 dout("%s %p tid %llu to osd%d\n", __func__, req, req->r_tid,
1354 req->r_osd ? req->r_osd->o_osd : -1);
1355
1356 if (req->r_osd) {
1357 __remove_osd_from_lru(req->r_osd);
1358 list_add_tail(&req->r_osd_item, &req->r_osd->o_requests);
1359 list_move_tail(&req->r_req_lru_item, &osdc->req_unsent);
1360 } else {
1361 list_move_tail(&req->r_req_lru_item, &osdc->req_notarget);
1362 }
1363}
1364
1349/* 1365/*
1350 * Pick an osd (the first 'up' osd in the pg), allocate the osd struct 1366 * Pick an osd (the first 'up' osd in the pg), allocate the osd struct
1351 * (as needed), and set the request r_osd appropriately. If there is 1367 * (as needed), and set the request r_osd appropriately. If there is
@@ -1423,13 +1439,7 @@ static int __map_request(struct ceph_osd_client *osdc,
1423 &osdc->osdmap->osd_addr[o]); 1439 &osdc->osdmap->osd_addr[o]);
1424 } 1440 }
1425 1441
1426 if (req->r_osd) { 1442 __enqueue_request(req);
1427 __remove_osd_from_lru(req->r_osd);
1428 list_add_tail(&req->r_osd_item, &req->r_osd->o_requests);
1429 list_move_tail(&req->r_req_lru_item, &osdc->req_unsent);
1430 } else {
1431 list_move_tail(&req->r_req_lru_item, &osdc->req_notarget);
1432 }
1433 err = 1; /* osd or pg changed */ 1443 err = 1; /* osd or pg changed */
1434 1444
1435out: 1445out: