Lines Matching refs:osd
30 static int __reset_osd(struct ceph_osd_client *osdc, struct ceph_osd *osd);
900 struct ceph_osd *osd = req->r_osd; in __kick_linger_request() local
921 WARN_ON(req->r_osd || !osd); in __kick_linger_request()
922 req->r_osd = osd; in __kick_linger_request()
932 struct ceph_osd *osd) in __kick_osd_requests() argument
939 dout("%s osd%d\n", __func__, osd->o_osd); in __kick_osd_requests()
940 err = __reset_osd(osdc, osd); in __kick_osd_requests()
961 list_for_each_entry(req, &osd->o_requests, r_osd_item) { in __kick_osd_requests()
982 list_for_each_entry_safe(req, nreq, &osd->o_linger_requests, in __kick_osd_requests()
997 struct ceph_osd *osd = con->private; in osd_reset() local
1000 if (!osd) in osd_reset()
1002 dout("osd_reset osd%d\n", osd->o_osd); in osd_reset()
1003 osdc = osd->o_osdc; in osd_reset()
1006 __kick_osd_requests(osdc, osd); in osd_reset()
1017 struct ceph_osd *osd; in create_osd() local
1019 osd = kzalloc(sizeof(*osd), GFP_NOFS); in create_osd()
1020 if (!osd) in create_osd()
1023 atomic_set(&osd->o_ref, 1); in create_osd()
1024 osd->o_osdc = osdc; in create_osd()
1025 osd->o_osd = onum; in create_osd()
1026 RB_CLEAR_NODE(&osd->o_node); in create_osd()
1027 INIT_LIST_HEAD(&osd->o_requests); in create_osd()
1028 INIT_LIST_HEAD(&osd->o_linger_requests); in create_osd()
1029 INIT_LIST_HEAD(&osd->o_osd_lru); in create_osd()
1030 osd->o_incarnation = 1; in create_osd()
1032 ceph_con_init(&osd->o_con, osd, &osd_con_ops, &osdc->client->msgr); in create_osd()
1034 INIT_LIST_HEAD(&osd->o_keepalive_item); in create_osd()
1035 return osd; in create_osd()
1038 static struct ceph_osd *get_osd(struct ceph_osd *osd) in get_osd() argument
1040 if (atomic_inc_not_zero(&osd->o_ref)) { in get_osd()
1041 dout("get_osd %p %d -> %d\n", osd, atomic_read(&osd->o_ref)-1, in get_osd()
1042 atomic_read(&osd->o_ref)); in get_osd()
1043 return osd; in get_osd()
1045 dout("get_osd %p FAIL\n", osd); in get_osd()
1050 static void put_osd(struct ceph_osd *osd) in put_osd() argument
1052 dout("put_osd %p %d -> %d\n", osd, atomic_read(&osd->o_ref), in put_osd()
1053 atomic_read(&osd->o_ref) - 1); in put_osd()
1054 if (atomic_dec_and_test(&osd->o_ref)) { in put_osd()
1055 struct ceph_auth_client *ac = osd->o_osdc->client->monc.auth; in put_osd()
1057 if (osd->o_auth.authorizer) in put_osd()
1058 ceph_auth_destroy_authorizer(ac, osd->o_auth.authorizer); in put_osd()
1059 kfree(osd); in put_osd()
1066 static void __remove_osd(struct ceph_osd_client *osdc, struct ceph_osd *osd) in __remove_osd() argument
1068 dout("%s %p osd%d\n", __func__, osd, osd->o_osd); in __remove_osd()
1069 WARN_ON(!list_empty(&osd->o_requests)); in __remove_osd()
1070 WARN_ON(!list_empty(&osd->o_linger_requests)); in __remove_osd()
1072 list_del_init(&osd->o_osd_lru); in __remove_osd()
1073 rb_erase(&osd->o_node, &osdc->osds); in __remove_osd()
1074 RB_CLEAR_NODE(&osd->o_node); in __remove_osd()
1077 static void remove_osd(struct ceph_osd_client *osdc, struct ceph_osd *osd) in remove_osd() argument
1079 dout("%s %p osd%d\n", __func__, osd, osd->o_osd); in remove_osd()
1081 if (!RB_EMPTY_NODE(&osd->o_node)) { in remove_osd()
1082 ceph_con_close(&osd->o_con); in remove_osd()
1083 __remove_osd(osdc, osd); in remove_osd()
1084 put_osd(osd); in remove_osd()
1093 struct ceph_osd *osd = rb_entry(rb_first(&osdc->osds), in remove_all_osds() local
1095 remove_osd(osdc, osd); in remove_all_osds()
1101 struct ceph_osd *osd) in __move_osd_to_lru() argument
1103 dout("%s %p\n", __func__, osd); in __move_osd_to_lru()
1104 BUG_ON(!list_empty(&osd->o_osd_lru)); in __move_osd_to_lru()
1106 list_add_tail(&osd->o_osd_lru, &osdc->osd_lru); in __move_osd_to_lru()
1107 osd->lru_ttl = jiffies + osdc->client->options->osd_idle_ttl; in __move_osd_to_lru()
1111 struct ceph_osd *osd) in maybe_move_osd_to_lru() argument
1113 dout("%s %p\n", __func__, osd); in maybe_move_osd_to_lru()
1115 if (list_empty(&osd->o_requests) && in maybe_move_osd_to_lru()
1116 list_empty(&osd->o_linger_requests)) in maybe_move_osd_to_lru()
1117 __move_osd_to_lru(osdc, osd); in maybe_move_osd_to_lru()
1120 static void __remove_osd_from_lru(struct ceph_osd *osd) in __remove_osd_from_lru() argument
1122 dout("__remove_osd_from_lru %p\n", osd); in __remove_osd_from_lru()
1123 if (!list_empty(&osd->o_osd_lru)) in __remove_osd_from_lru()
1124 list_del_init(&osd->o_osd_lru); in __remove_osd_from_lru()
1129 struct ceph_osd *osd, *nosd; in remove_old_osds() local
1133 list_for_each_entry_safe(osd, nosd, &osdc->osd_lru, o_osd_lru) { in remove_old_osds()
1134 if (time_before(jiffies, osd->lru_ttl)) in remove_old_osds()
1136 remove_osd(osdc, osd); in remove_old_osds()
1144 static int __reset_osd(struct ceph_osd_client *osdc, struct ceph_osd *osd) in __reset_osd() argument
1148 dout("__reset_osd %p osd%d\n", osd, osd->o_osd); in __reset_osd()
1149 if (list_empty(&osd->o_requests) && in __reset_osd()
1150 list_empty(&osd->o_linger_requests)) { in __reset_osd()
1151 remove_osd(osdc, osd); in __reset_osd()
1155 peer_addr = &osdc->osdmap->osd_addr[osd->o_osd]; in __reset_osd()
1156 if (!memcmp(peer_addr, &osd->o_con.peer_addr, sizeof (*peer_addr)) && in __reset_osd()
1157 !ceph_con_opened(&osd->o_con)) { in __reset_osd()
1163 list_for_each_entry(req, &osd->o_requests, r_osd_item) in __reset_osd()
1169 ceph_con_close(&osd->o_con); in __reset_osd()
1170 ceph_con_open(&osd->o_con, CEPH_ENTITY_TYPE_OSD, osd->o_osd, peer_addr); in __reset_osd()
1171 osd->o_incarnation++; in __reset_osd()
1180 struct ceph_osd *osd = NULL; in __insert_osd() local
1185 osd = rb_entry(parent, struct ceph_osd, o_node); in __insert_osd()
1186 if (new->o_osd < osd->o_osd) in __insert_osd()
1188 else if (new->o_osd > osd->o_osd) in __insert_osd()
1200 struct ceph_osd *osd; in __lookup_osd() local
1204 osd = rb_entry(n, struct ceph_osd, o_node); in __lookup_osd()
1205 if (o < osd->o_osd) in __lookup_osd()
1207 else if (o > osd->o_osd) in __lookup_osd()
1210 return osd; in __lookup_osd()
1588 struct ceph_osd *osd; in handle_timeout() local
1608 osd = req->r_osd; in handle_timeout()
1609 BUG_ON(!osd); in handle_timeout()
1611 req->r_tid, osd->o_osd); in handle_timeout()
1612 list_move_tail(&osd->o_keepalive_item, &slow_osds); in handle_timeout()
1615 osd = list_entry(slow_osds.next, struct ceph_osd, in handle_timeout()
1617 list_del_init(&osd->o_keepalive_item); in handle_timeout()
1618 ceph_con_keepalive(&osd->o_con); in handle_timeout()
1953 struct ceph_osd *osd = rb_entry(p, struct ceph_osd, o_node); in reset_changed_osds() local
1956 if (!ceph_osd_is_up(osdc->osdmap, osd->o_osd) || in reset_changed_osds()
1957 memcmp(&osd->o_con.peer_addr, in reset_changed_osds()
1959 osd->o_osd), in reset_changed_osds()
1961 __reset_osd(osdc, osd); in reset_changed_osds()
2798 struct ceph_osd *osd = con->private; in dispatch() local
2802 if (!osd) in dispatch()
2804 osdc = osd->o_osdc; in dispatch()
2834 struct ceph_osd *osd = con->private; in get_reply() local
2835 struct ceph_osd_client *osdc = osd->o_osdc; in get_reply()
2847 osd->o_osd, tid); in get_reply()
2857 __func__, osd->o_osd, req->r_tid, front_len, in get_reply()
2869 __func__, osd->o_osd, req->r_tid, data_len, in get_reply()
2888 struct ceph_osd *osd = con->private; in alloc_msg() local
2901 osd->o_osd); in alloc_msg()
2912 struct ceph_osd *osd = con->private; in get_osd_con() local
2913 if (get_osd(osd)) in get_osd_con()
2920 struct ceph_osd *osd = con->private; in put_osd_con() local
2921 put_osd(osd); in put_osd_con()