Lines Matching refs:osd
30 static int __reset_osd(struct ceph_osd_client *osdc, struct ceph_osd *osd);
884 struct ceph_osd *osd = req->r_osd; in __kick_linger_request() local
905 WARN_ON(req->r_osd || !osd); in __kick_linger_request()
906 req->r_osd = osd; in __kick_linger_request()
916 struct ceph_osd *osd) in __kick_osd_requests() argument
923 dout("%s osd%d\n", __func__, osd->o_osd); in __kick_osd_requests()
924 err = __reset_osd(osdc, osd); in __kick_osd_requests()
945 list_for_each_entry(req, &osd->o_requests, r_osd_item) { in __kick_osd_requests()
966 list_for_each_entry_safe(req, nreq, &osd->o_linger_requests, in __kick_osd_requests()
981 struct ceph_osd *osd = con->private; in osd_reset() local
984 if (!osd) in osd_reset()
986 dout("osd_reset osd%d\n", osd->o_osd); in osd_reset()
987 osdc = osd->o_osdc; in osd_reset()
990 __kick_osd_requests(osdc, osd); in osd_reset()
1001 struct ceph_osd *osd; in create_osd() local
1003 osd = kzalloc(sizeof(*osd), GFP_NOFS); in create_osd()
1004 if (!osd) in create_osd()
1007 atomic_set(&osd->o_ref, 1); in create_osd()
1008 osd->o_osdc = osdc; in create_osd()
1009 osd->o_osd = onum; in create_osd()
1010 RB_CLEAR_NODE(&osd->o_node); in create_osd()
1011 INIT_LIST_HEAD(&osd->o_requests); in create_osd()
1012 INIT_LIST_HEAD(&osd->o_linger_requests); in create_osd()
1013 INIT_LIST_HEAD(&osd->o_osd_lru); in create_osd()
1014 osd->o_incarnation = 1; in create_osd()
1016 ceph_con_init(&osd->o_con, osd, &osd_con_ops, &osdc->client->msgr); in create_osd()
1018 INIT_LIST_HEAD(&osd->o_keepalive_item); in create_osd()
1019 return osd; in create_osd()
1022 static struct ceph_osd *get_osd(struct ceph_osd *osd) in get_osd() argument
1024 if (atomic_inc_not_zero(&osd->o_ref)) { in get_osd()
1025 dout("get_osd %p %d -> %d\n", osd, atomic_read(&osd->o_ref)-1, in get_osd()
1026 atomic_read(&osd->o_ref)); in get_osd()
1027 return osd; in get_osd()
1029 dout("get_osd %p FAIL\n", osd); in get_osd()
1034 static void put_osd(struct ceph_osd *osd) in put_osd() argument
1036 dout("put_osd %p %d -> %d\n", osd, atomic_read(&osd->o_ref), in put_osd()
1037 atomic_read(&osd->o_ref) - 1); in put_osd()
1038 if (atomic_dec_and_test(&osd->o_ref)) { in put_osd()
1039 struct ceph_auth_client *ac = osd->o_osdc->client->monc.auth; in put_osd()
1041 if (osd->o_auth.authorizer) in put_osd()
1042 ceph_auth_destroy_authorizer(ac, osd->o_auth.authorizer); in put_osd()
1043 kfree(osd); in put_osd()
1050 static void __remove_osd(struct ceph_osd_client *osdc, struct ceph_osd *osd) in __remove_osd() argument
1052 dout("%s %p osd%d\n", __func__, osd, osd->o_osd); in __remove_osd()
1053 WARN_ON(!list_empty(&osd->o_requests)); in __remove_osd()
1054 WARN_ON(!list_empty(&osd->o_linger_requests)); in __remove_osd()
1056 list_del_init(&osd->o_osd_lru); in __remove_osd()
1057 rb_erase(&osd->o_node, &osdc->osds); in __remove_osd()
1058 RB_CLEAR_NODE(&osd->o_node); in __remove_osd()
1061 static void remove_osd(struct ceph_osd_client *osdc, struct ceph_osd *osd) in remove_osd() argument
1063 dout("%s %p osd%d\n", __func__, osd, osd->o_osd); in remove_osd()
1065 if (!RB_EMPTY_NODE(&osd->o_node)) { in remove_osd()
1066 ceph_con_close(&osd->o_con); in remove_osd()
1067 __remove_osd(osdc, osd); in remove_osd()
1068 put_osd(osd); in remove_osd()
1077 struct ceph_osd *osd = rb_entry(rb_first(&osdc->osds), in remove_all_osds() local
1079 remove_osd(osdc, osd); in remove_all_osds()
1085 struct ceph_osd *osd) in __move_osd_to_lru() argument
1087 dout("%s %p\n", __func__, osd); in __move_osd_to_lru()
1088 BUG_ON(!list_empty(&osd->o_osd_lru)); in __move_osd_to_lru()
1090 list_add_tail(&osd->o_osd_lru, &osdc->osd_lru); in __move_osd_to_lru()
1091 osd->lru_ttl = jiffies + osdc->client->options->osd_idle_ttl * HZ; in __move_osd_to_lru()
1095 struct ceph_osd *osd) in maybe_move_osd_to_lru() argument
1097 dout("%s %p\n", __func__, osd); in maybe_move_osd_to_lru()
1099 if (list_empty(&osd->o_requests) && in maybe_move_osd_to_lru()
1100 list_empty(&osd->o_linger_requests)) in maybe_move_osd_to_lru()
1101 __move_osd_to_lru(osdc, osd); in maybe_move_osd_to_lru()
1104 static void __remove_osd_from_lru(struct ceph_osd *osd) in __remove_osd_from_lru() argument
1106 dout("__remove_osd_from_lru %p\n", osd); in __remove_osd_from_lru()
1107 if (!list_empty(&osd->o_osd_lru)) in __remove_osd_from_lru()
1108 list_del_init(&osd->o_osd_lru); in __remove_osd_from_lru()
1113 struct ceph_osd *osd, *nosd; in remove_old_osds() local
1117 list_for_each_entry_safe(osd, nosd, &osdc->osd_lru, o_osd_lru) { in remove_old_osds()
1118 if (time_before(jiffies, osd->lru_ttl)) in remove_old_osds()
1120 remove_osd(osdc, osd); in remove_old_osds()
1128 static int __reset_osd(struct ceph_osd_client *osdc, struct ceph_osd *osd) in __reset_osd() argument
1132 dout("__reset_osd %p osd%d\n", osd, osd->o_osd); in __reset_osd()
1133 if (list_empty(&osd->o_requests) && in __reset_osd()
1134 list_empty(&osd->o_linger_requests)) { in __reset_osd()
1135 remove_osd(osdc, osd); in __reset_osd()
1139 peer_addr = &osdc->osdmap->osd_addr[osd->o_osd]; in __reset_osd()
1140 if (!memcmp(peer_addr, &osd->o_con.peer_addr, sizeof (*peer_addr)) && in __reset_osd()
1141 !ceph_con_opened(&osd->o_con)) { in __reset_osd()
1147 list_for_each_entry(req, &osd->o_requests, r_osd_item) in __reset_osd()
1153 ceph_con_close(&osd->o_con); in __reset_osd()
1154 ceph_con_open(&osd->o_con, CEPH_ENTITY_TYPE_OSD, osd->o_osd, peer_addr); in __reset_osd()
1155 osd->o_incarnation++; in __reset_osd()
1164 struct ceph_osd *osd = NULL; in __insert_osd() local
1169 osd = rb_entry(parent, struct ceph_osd, o_node); in __insert_osd()
1170 if (new->o_osd < osd->o_osd) in __insert_osd()
1172 else if (new->o_osd > osd->o_osd) in __insert_osd()
1184 struct ceph_osd *osd; in __lookup_osd() local
1188 osd = rb_entry(n, struct ceph_osd, o_node); in __lookup_osd()
1189 if (o < osd->o_osd) in __lookup_osd()
1191 else if (o > osd->o_osd) in __lookup_osd()
1194 return osd; in __lookup_osd()
1571 struct ceph_osd *osd; in handle_timeout() local
1592 osd = req->r_osd; in handle_timeout()
1593 BUG_ON(!osd); in handle_timeout()
1595 req->r_tid, osd->o_osd); in handle_timeout()
1596 list_move_tail(&osd->o_keepalive_item, &slow_osds); in handle_timeout()
1599 osd = list_entry(slow_osds.next, struct ceph_osd, in handle_timeout()
1601 list_del_init(&osd->o_keepalive_item); in handle_timeout()
1602 ceph_con_keepalive(&osd->o_con); in handle_timeout()
1939 struct ceph_osd *osd = rb_entry(p, struct ceph_osd, o_node); in reset_changed_osds() local
1942 if (!ceph_osd_is_up(osdc->osdmap, osd->o_osd) || in reset_changed_osds()
1943 memcmp(&osd->o_con.peer_addr, in reset_changed_osds()
1945 osd->o_osd), in reset_changed_osds()
1947 __reset_osd(osdc, osd); in reset_changed_osds()
2784 struct ceph_osd *osd = con->private; in dispatch() local
2788 if (!osd) in dispatch()
2790 osdc = osd->o_osdc; in dispatch()
2819 struct ceph_osd *osd = con->private; in get_reply() local
2820 struct ceph_osd_client *osdc = osd->o_osdc; in get_reply()
2834 osd->o_osd); in get_reply()
2892 struct ceph_osd *osd = con->private; in alloc_msg() local
2905 osd->o_osd); in alloc_msg()
2916 struct ceph_osd *osd = con->private; in get_osd_con() local
2917 if (get_osd(osd)) in get_osd_con()
2924 struct ceph_osd *osd = con->private; in put_osd_con() local
2925 put_osd(osd); in put_osd_con()