diff options
author | Alex Elder <elder@inktank.com> | 2012-05-27 00:26:43 -0400 |
---|---|---|
committer | Alex Elder <elder@dreamhost.com> | 2012-06-01 09:37:56 -0400 |
commit | e10006f807ffc4d5b1d861305d18d9e8145891ca (patch) | |
tree | 9ec1b9111d6fdf4a6d5570b634bfc53caeccea67 | |
parent | ce2c8903e76e690846a00a0284e4bd9ee954d680 (diff) |
libceph: provide osd number when creating osd
Pass the osd number to the create_osd() routine, and move the
initialization of fields that depend on it therein.
Signed-off-by: Alex Elder <elder@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
-rw-r--r-- | net/ceph/osd_client.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index cca4c7f1c780..e30efbcc6388 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c | |||
@@ -624,7 +624,7 @@ static void osd_reset(struct ceph_connection *con) | |||
624 | /* | 624 | /* |
625 | * Track open sessions with osds. | 625 | * Track open sessions with osds. |
626 | */ | 626 | */ |
627 | static struct ceph_osd *create_osd(struct ceph_osd_client *osdc) | 627 | static struct ceph_osd *create_osd(struct ceph_osd_client *osdc, int onum) |
628 | { | 628 | { |
629 | struct ceph_osd *osd; | 629 | struct ceph_osd *osd; |
630 | 630 | ||
@@ -634,6 +634,7 @@ static struct ceph_osd *create_osd(struct ceph_osd_client *osdc) | |||
634 | 634 | ||
635 | atomic_set(&osd->o_ref, 1); | 635 | atomic_set(&osd->o_ref, 1); |
636 | osd->o_osdc = osdc; | 636 | osd->o_osdc = osdc; |
637 | osd->o_osd = onum; | ||
637 | INIT_LIST_HEAD(&osd->o_requests); | 638 | INIT_LIST_HEAD(&osd->o_requests); |
638 | INIT_LIST_HEAD(&osd->o_linger_requests); | 639 | INIT_LIST_HEAD(&osd->o_linger_requests); |
639 | INIT_LIST_HEAD(&osd->o_osd_lru); | 640 | INIT_LIST_HEAD(&osd->o_osd_lru); |
@@ -643,6 +644,7 @@ static struct ceph_osd *create_osd(struct ceph_osd_client *osdc) | |||
643 | osd->o_con.private = osd; | 644 | osd->o_con.private = osd; |
644 | osd->o_con.ops = &osd_con_ops; | 645 | osd->o_con.ops = &osd_con_ops; |
645 | osd->o_con.peer_name.type = CEPH_ENTITY_TYPE_OSD; | 646 | osd->o_con.peer_name.type = CEPH_ENTITY_TYPE_OSD; |
647 | osd->o_con.peer_name.num = cpu_to_le64(onum); | ||
646 | 648 | ||
647 | INIT_LIST_HEAD(&osd->o_keepalive_item); | 649 | INIT_LIST_HEAD(&osd->o_keepalive_item); |
648 | return osd; | 650 | return osd; |
@@ -998,15 +1000,13 @@ static int __map_request(struct ceph_osd_client *osdc, | |||
998 | req->r_osd = __lookup_osd(osdc, o); | 1000 | req->r_osd = __lookup_osd(osdc, o); |
999 | if (!req->r_osd && o >= 0) { | 1001 | if (!req->r_osd && o >= 0) { |
1000 | err = -ENOMEM; | 1002 | err = -ENOMEM; |
1001 | req->r_osd = create_osd(osdc); | 1003 | req->r_osd = create_osd(osdc, o); |
1002 | if (!req->r_osd) { | 1004 | if (!req->r_osd) { |
1003 | list_move(&req->r_req_lru_item, &osdc->req_notarget); | 1005 | list_move(&req->r_req_lru_item, &osdc->req_notarget); |
1004 | goto out; | 1006 | goto out; |
1005 | } | 1007 | } |
1006 | 1008 | ||
1007 | dout("map_request osd %p is osd%d\n", req->r_osd, o); | 1009 | dout("map_request osd %p is osd%d\n", req->r_osd, o); |
1008 | req->r_osd->o_osd = o; | ||
1009 | req->r_osd->o_con.peer_name.num = cpu_to_le64(o); | ||
1010 | __insert_osd(osdc, req->r_osd); | 1010 | __insert_osd(osdc, req->r_osd); |
1011 | 1011 | ||
1012 | ceph_con_open(&req->r_osd->o_con, &osdc->osdmap->osd_addr[o]); | 1012 | ceph_con_open(&req->r_osd->o_con, &osdc->osdmap->osd_addr[o]); |