Lines Matching refs:osdc
69 static inline void verify_osdc_locked(struct ceph_osd_client *osdc) in verify_osdc_locked() argument
71 WARN_ON(!rwsem_is_locked(&osdc->lock)); in verify_osdc_locked()
73 static inline void verify_osdc_wrlocked(struct ceph_osd_client *osdc) in verify_osdc_wrlocked() argument
75 WARN_ON(!rwsem_is_wrlocked(&osdc->lock)); in verify_osdc_wrlocked()
79 struct ceph_osd_client *osdc = osd->o_osdc; in verify_osd_locked() local
82 rwsem_is_locked(&osdc->lock)) && in verify_osd_locked()
83 !rwsem_is_wrlocked(&osdc->lock)); in verify_osd_locked()
90 static inline void verify_osdc_locked(struct ceph_osd_client *osdc) { } in verify_osdc_locked() argument
91 static inline void verify_osdc_wrlocked(struct ceph_osd_client *osdc) { } in verify_osdc_wrlocked() argument
544 struct ceph_osd_client *osdc = req->r_osdc; in request_reinit() local
562 req->r_osdc = osdc; in request_reinit()
572 struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *osdc, in ceph_osdc_alloc_request() argument
582 req = mempool_alloc(osdc->req_mempool, gfp_flags); in ceph_osdc_alloc_request()
593 req->r_osdc = osdc; in ceph_osdc_alloc_request()
611 struct ceph_osd_client *osdc = req->r_osdc; in ceph_osdc_alloc_messages() local
636 msg = ceph_msgpool_get(&osdc->msgpool_op, 0); in ceph_osdc_alloc_messages()
651 msg = ceph_msgpool_get(&osdc->msgpool_op_reply, 0); in ceph_osdc_alloc_messages()
981 struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc, in ceph_osdc_new_request() argument
1002 req = ceph_osdc_alloc_request(osdc, snapc, num_ops, use_mempool, in ceph_osdc_new_request()
1062 static void for_each_request(struct ceph_osd_client *osdc, in DEFINE_RB_FUNCS()
1068 for (n = rb_first(&osdc->osds); n; n = rb_next(n)) { in DEFINE_RB_FUNCS()
1081 for (p = rb_first(&osdc->homeless_osd.o_requests); p; ) { in DEFINE_RB_FUNCS()
1139 static struct ceph_osd *create_osd(struct ceph_osd_client *osdc, int onum) in create_osd() argument
1147 osd->o_osdc = osdc; in create_osd()
1150 ceph_con_init(&osd->o_con, osd, &osd_con_ops, &osdc->client->msgr); in create_osd()
1181 struct ceph_osd_client *osdc = osd->o_osdc; in DEFINE_RB_FUNCS() local
1186 spin_lock(&osdc->osd_lru_lock); in DEFINE_RB_FUNCS()
1187 list_add_tail(&osd->o_osd_lru, &osdc->osd_lru); in DEFINE_RB_FUNCS()
1188 spin_unlock(&osdc->osd_lru_lock); in DEFINE_RB_FUNCS()
1190 osd->lru_ttl = jiffies + osdc->client->options->osd_idle_ttl; in DEFINE_RB_FUNCS()
1202 struct ceph_osd_client *osdc = osd->o_osdc; in __remove_osd_from_lru() local
1206 spin_lock(&osdc->osd_lru_lock); in __remove_osd_from_lru()
1209 spin_unlock(&osdc->osd_lru_lock); in __remove_osd_from_lru()
1218 struct ceph_osd_client *osdc = osd->o_osdc; in close_osd() local
1221 verify_osdc_wrlocked(osdc); in close_osd()
1234 link_request(&osdc->homeless_osd, req); in close_osd()
1245 link_linger(&osdc->homeless_osd, lreq); in close_osd()
1250 erase_osd(&osdc->osds, osd); in close_osd()
1293 static struct ceph_osd *lookup_create_osd(struct ceph_osd_client *osdc, int o, in lookup_create_osd() argument
1299 verify_osdc_wrlocked(osdc); in lookup_create_osd()
1301 verify_osdc_locked(osdc); in lookup_create_osd()
1304 osd = lookup_osd(&osdc->osds, o); in lookup_create_osd()
1306 osd = &osdc->homeless_osd; in lookup_create_osd()
1311 osd = create_osd(osdc, o); in lookup_create_osd()
1312 insert_osd(&osdc->osds, osd); in lookup_create_osd()
1314 &osdc->osdmap->osd_addr[osd->o_osd]); in lookup_create_osd()
1317 dout("%s osdc %p osd%d -> osd %p\n", __func__, osdc, o, osd); in lookup_create_osd()
1365 static bool have_pool_full(struct ceph_osd_client *osdc) in have_pool_full() argument
1369 for (n = rb_first(&osdc->osdmap->pg_pools); n; n = rb_next(n)) { in have_pool_full()
1380 static bool pool_full(struct ceph_osd_client *osdc, s64 pool_id) in pool_full() argument
1384 pi = ceph_pg_pool_by_id(osdc->osdmap, pool_id); in pool_full()
1395 static bool target_should_be_paused(struct ceph_osd_client *osdc, in target_should_be_paused() argument
1399 bool pauserd = ceph_osdmap_flag(osdc, CEPH_OSDMAP_PAUSERD); in target_should_be_paused()
1400 bool pausewr = ceph_osdmap_flag(osdc, CEPH_OSDMAP_PAUSEWR) || in target_should_be_paused()
1401 ceph_osdmap_flag(osdc, CEPH_OSDMAP_FULL) || in target_should_be_paused()
1407 (osdc->osdmap->epoch < osdc->epoch_barrier); in target_should_be_paused()
1416 static enum calc_target_result calc_target(struct ceph_osd_client *osdc, in calc_target() argument
1428 bool sort_bitwise = ceph_osdmap_flag(osdc, CEPH_OSDMAP_SORTBITWISE); in calc_target()
1429 bool recovery_deletes = ceph_osdmap_flag(osdc, in calc_target()
1433 t->epoch = osdc->osdmap->epoch; in calc_target()
1434 pi = ceph_pg_pool_by_id(osdc->osdmap, t->base_oloc.pool); in calc_target()
1441 if (osdc->osdmap->epoch == pi->last_force_request_resend) { in calc_target()
1459 pi = ceph_pg_pool_by_id(osdc->osdmap, t->target_oloc.pool); in calc_target()
1471 ceph_pg_to_up_acting_osds(osdc->osdmap, pi, &pgid, &up, &acting); in calc_target()
1490 if (t->paused && !target_should_be_paused(osdc, t, pi)) { in calc_target()
1501 ceph_pg_to_primary_shard(osdc->osdmap, pi, &pgid, &t->spgid); in calc_target()
2161 static void maybe_request_map(struct ceph_osd_client *osdc) in maybe_request_map() argument
2165 verify_osdc_locked(osdc); in maybe_request_map()
2166 WARN_ON(!osdc->osdmap->epoch); in maybe_request_map()
2168 if (ceph_osdmap_flag(osdc, CEPH_OSDMAP_FULL) || in maybe_request_map()
2169 ceph_osdmap_flag(osdc, CEPH_OSDMAP_PAUSERD) || in maybe_request_map()
2170 ceph_osdmap_flag(osdc, CEPH_OSDMAP_PAUSEWR)) { in maybe_request_map()
2171 dout("%s osdc %p continuous\n", __func__, osdc); in maybe_request_map()
2174 dout("%s osdc %p onetime\n", __func__, osdc); in maybe_request_map()
2177 if (ceph_monc_want_map(&osdc->client->monc, CEPH_SUB_OSDMAP, in maybe_request_map()
2178 osdc->osdmap->epoch + 1, continuous)) in maybe_request_map()
2179 ceph_monc_renew_subs(&osdc->client->monc); in maybe_request_map()
2187 struct ceph_osd_client *osdc = req->r_osdc; in __submit_request() local
2198 ct_res = calc_target(osdc, &req->r_t, NULL, false); in __submit_request()
2202 osd = lookup_create_osd(osdc, req->r_t.osd, wrlocked); in __submit_request()
2208 if (osdc->abort_err) { in __submit_request()
2209 dout("req %p abort_err %d\n", req, osdc->abort_err); in __submit_request()
2210 err = osdc->abort_err; in __submit_request()
2211 } else if (osdc->osdmap->epoch < osdc->epoch_barrier) { in __submit_request()
2212 dout("req %p epoch %u barrier %u\n", req, osdc->osdmap->epoch, in __submit_request()
2213 osdc->epoch_barrier); in __submit_request()
2215 maybe_request_map(osdc); in __submit_request()
2217 ceph_osdmap_flag(osdc, CEPH_OSDMAP_PAUSEWR)) { in __submit_request()
2220 maybe_request_map(osdc); in __submit_request()
2222 ceph_osdmap_flag(osdc, CEPH_OSDMAP_PAUSERD)) { in __submit_request()
2225 maybe_request_map(osdc); in __submit_request()
2229 (ceph_osdmap_flag(osdc, CEPH_OSDMAP_FULL) || in __submit_request()
2230 pool_full(osdc, req->r_t.base_oloc.pool))) { in __submit_request()
2232 if (osdc->abort_on_full) { in __submit_request()
2237 maybe_request_map(osdc); in __submit_request()
2242 maybe_request_map(osdc); in __submit_request()
2251 req->r_tid = atomic64_inc_return(&osdc->last_tid); in __submit_request()
2263 downgrade_write(&osdc->lock); in __submit_request()
2267 up_read(&osdc->lock); in __submit_request()
2268 down_write(&osdc->lock); in __submit_request()
2294 struct ceph_osd_client *osdc = req->r_osdc; in finish_request() local
2296 WARN_ON(lookup_request_mc(&osdc->map_checks, req->r_tid)); in finish_request()
2301 atomic_dec(&osdc->num_requests); in finish_request()
2348 struct ceph_osd_client *osdc = req->r_osdc; in cancel_map_check() local
2351 verify_osdc_wrlocked(osdc); in cancel_map_check()
2353 lookup_req = lookup_request_mc(&osdc->map_checks, req->r_tid); in cancel_map_check()
2358 erase_request_mc(&osdc->map_checks, req); in cancel_map_check()
2392 void ceph_osdc_abort_requests(struct ceph_osd_client *osdc, int err) in ceph_osdc_abort_requests() argument
2394 dout("%s osdc %p err %d\n", __func__, osdc, err); in ceph_osdc_abort_requests()
2395 down_write(&osdc->lock); in ceph_osdc_abort_requests()
2396 for_each_request(osdc, abort_fn, &err); in ceph_osdc_abort_requests()
2397 osdc->abort_err = err; in ceph_osdc_abort_requests()
2398 up_write(&osdc->lock); in ceph_osdc_abort_requests()
2402 static void update_epoch_barrier(struct ceph_osd_client *osdc, u32 eb) in update_epoch_barrier() argument
2404 if (likely(eb > osdc->epoch_barrier)) { in update_epoch_barrier()
2406 osdc->epoch_barrier, eb); in update_epoch_barrier()
2407 osdc->epoch_barrier = eb; in update_epoch_barrier()
2409 if (eb > osdc->osdmap->epoch) in update_epoch_barrier()
2410 maybe_request_map(osdc); in update_epoch_barrier()
2414 void ceph_osdc_update_epoch_barrier(struct ceph_osd_client *osdc, u32 eb) in ceph_osdc_update_epoch_barrier() argument
2416 down_read(&osdc->lock); in ceph_osdc_update_epoch_barrier()
2417 if (unlikely(eb > osdc->epoch_barrier)) { in ceph_osdc_update_epoch_barrier()
2418 up_read(&osdc->lock); in ceph_osdc_update_epoch_barrier()
2419 down_write(&osdc->lock); in ceph_osdc_update_epoch_barrier()
2420 update_epoch_barrier(osdc, eb); in ceph_osdc_update_epoch_barrier()
2421 up_write(&osdc->lock); in ceph_osdc_update_epoch_barrier()
2423 up_read(&osdc->lock); in ceph_osdc_update_epoch_barrier()
2436 struct ceph_osd_client *osdc = req->r_osdc; in abort_on_full_fn() local
2440 (ceph_osdmap_flag(osdc, CEPH_OSDMAP_FULL) || in abort_on_full_fn()
2441 pool_full(osdc, req->r_t.base_oloc.pool))) { in abort_on_full_fn()
2443 update_epoch_barrier(osdc, osdc->osdmap->epoch); in abort_on_full_fn()
2458 static void ceph_osdc_abort_on_full(struct ceph_osd_client *osdc) in ceph_osdc_abort_on_full() argument
2462 if (osdc->abort_on_full && in ceph_osdc_abort_on_full()
2463 (ceph_osdmap_flag(osdc, CEPH_OSDMAP_FULL) || have_pool_full(osdc))) in ceph_osdc_abort_on_full()
2464 for_each_request(osdc, abort_on_full_fn, &victims); in ceph_osdc_abort_on_full()
2469 struct ceph_osd_client *osdc = req->r_osdc; in check_pool_dne() local
2470 struct ceph_osdmap *map = osdc->osdmap; in check_pool_dne()
2472 verify_osdc_wrlocked(osdc); in check_pool_dne()
2503 struct ceph_osd_client *osdc = &greq->monc->client->osdc; in map_check_cb() local
2509 down_write(&osdc->lock); in map_check_cb()
2510 req = lookup_request_mc(&osdc->map_checks, tid); in map_check_cb()
2520 erase_request_mc(&osdc->map_checks, req); in map_check_cb()
2525 up_write(&osdc->lock); in map_check_cb()
2530 struct ceph_osd_client *osdc = req->r_osdc; in send_map_check() local
2534 verify_osdc_wrlocked(osdc); in send_map_check()
2536 lookup_req = lookup_request_mc(&osdc->map_checks, req->r_tid); in send_map_check()
2543 insert_request_mc(&osdc->map_checks, req); in send_map_check()
2544 ret = ceph_monc_get_version_async(&osdc->client->monc, "osdmap", in send_map_check()
2588 linger_alloc(struct ceph_osd_client *osdc) in linger_alloc() argument
2606 lreq->osdc = osdc; in linger_alloc()
2660 verify_osdc_locked(lreq->osdc); in __linger_registered()
2667 struct ceph_osd_client *osdc = lreq->osdc; in linger_registered() local
2670 down_read(&osdc->lock); in linger_registered()
2672 up_read(&osdc->lock); in linger_registered()
2679 struct ceph_osd_client *osdc = lreq->osdc; in linger_register() local
2681 verify_osdc_wrlocked(osdc); in linger_register()
2685 lreq->linger_id = ++osdc->last_linger_id; in linger_register()
2686 insert_linger_osdc(&osdc->linger_requests, lreq); in linger_register()
2691 struct ceph_osd_client *osdc = lreq->osdc; in linger_unregister() local
2693 verify_osdc_wrlocked(osdc); in linger_unregister()
2695 erase_linger_osdc(&osdc->linger_requests, lreq); in linger_unregister()
2760 struct ceph_osd_client *osdc = lreq->osdc; in lwork_queue() local
2767 queue_work(osdc->notify_wq, &lwork->work); in lwork_queue()
2964 struct ceph_osd_client *osdc = lreq->osdc; in send_linger_ping() local
2968 if (ceph_osdmap_flag(osdc, CEPH_OSDMAP_PAUSERD)) { in send_linger_ping()
2994 req->r_tid = atomic64_inc_return(&osdc->last_tid); in send_linger_ping()
3001 struct ceph_osd_client *osdc = lreq->osdc; in linger_submit() local
3004 calc_target(osdc, &lreq->t, NULL, false); in linger_submit()
3005 osd = lookup_create_osd(osdc, lreq->t.osd, true); in linger_submit()
3013 struct ceph_osd_client *osdc = lreq->osdc; in cancel_linger_map_check() local
3016 verify_osdc_wrlocked(osdc); in cancel_linger_map_check()
3018 lookup_lreq = lookup_linger_mc(&osdc->linger_map_checks, in cancel_linger_map_check()
3024 erase_linger_mc(&osdc->linger_map_checks, lreq); in cancel_linger_map_check()
3044 struct ceph_osd_client *osdc = lreq->osdc; in linger_cancel() local
3046 down_write(&osdc->lock); in linger_cancel()
3049 up_write(&osdc->lock); in linger_cancel()
3056 struct ceph_osd_client *osdc = lreq->osdc; in check_linger_pool_dne() local
3057 struct ceph_osdmap *map = osdc->osdmap; in check_linger_pool_dne()
3059 verify_osdc_wrlocked(osdc); in check_linger_pool_dne()
3087 struct ceph_osd_client *osdc = &greq->monc->client->osdc; in linger_map_check_cb() local
3093 down_write(&osdc->lock); in linger_map_check_cb()
3094 lreq = lookup_linger_mc(&osdc->linger_map_checks, linger_id); in linger_map_check_cb()
3105 erase_linger_mc(&osdc->linger_map_checks, lreq); in linger_map_check_cb()
3110 up_write(&osdc->lock); in linger_map_check_cb()
3115 struct ceph_osd_client *osdc = lreq->osdc; in send_linger_map_check() local
3119 verify_osdc_wrlocked(osdc); in send_linger_map_check()
3121 lookup_lreq = lookup_linger_mc(&osdc->linger_map_checks, in send_linger_map_check()
3129 insert_linger_mc(&osdc->linger_map_checks, lreq); in send_linger_map_check()
3130 ret = ceph_monc_get_version_async(&osdc->client->monc, "osdmap", in send_linger_map_check()
3161 struct ceph_osd_client *osdc = in handle_timeout() local
3163 struct ceph_options *opts = osdc->client->options; in handle_timeout()
3169 dout("%s osdc %p\n", __func__, osdc); in handle_timeout()
3170 down_write(&osdc->lock); in handle_timeout()
3177 for (n = rb_first(&osdc->osds); n; n = rb_next(n)) { in handle_timeout()
3218 for (p = rb_first(&osdc->homeless_osd.o_requests); p; ) { in handle_timeout()
3226 req->r_tid, osdc->homeless_osd.o_osd); in handle_timeout()
3232 if (atomic_read(&osdc->num_homeless) || !list_empty(&slow_osds)) in handle_timeout()
3233 maybe_request_map(osdc); in handle_timeout()
3243 up_write(&osdc->lock); in handle_timeout()
3244 schedule_delayed_work(&osdc->timeout_work, in handle_timeout()
3245 osdc->client->options->osd_keepalive_timeout); in handle_timeout()
3250 struct ceph_osd_client *osdc = in handle_osds_timeout() local
3253 unsigned long delay = osdc->client->options->osd_idle_ttl / 4; in handle_osds_timeout()
3256 dout("%s osdc %p\n", __func__, osdc); in handle_osds_timeout()
3257 down_write(&osdc->lock); in handle_osds_timeout()
3258 list_for_each_entry_safe(osd, nosd, &osdc->osd_lru, o_osd_lru) { in handle_osds_timeout()
3267 up_write(&osdc->lock); in handle_osds_timeout()
3268 schedule_delayed_work(&osdc->osds_timeout_work, in handle_osds_timeout()
3484 struct ceph_osd_client *osdc = osd->o_osdc; in handle_reply() local
3494 down_read(&osdc->lock); in handle_reply()
3578 up_read(&osdc->lock); in handle_reply()
3588 up_read(&osdc->lock); in handle_reply()
3591 static void set_pool_was_full(struct ceph_osd_client *osdc) in set_pool_was_full() argument
3595 for (n = rb_first(&osdc->osdmap->pg_pools); n; n = rb_next(n)) { in set_pool_was_full()
3603 static bool pool_cleared_full(struct ceph_osd_client *osdc, s64 pool_id) in pool_cleared_full() argument
3607 pi = ceph_pg_pool_by_id(osdc->osdmap, pool_id); in pool_cleared_full()
3617 struct ceph_osd_client *osdc = lreq->osdc; in recalc_linger_target() local
3620 ct_res = calc_target(osdc, &lreq->t, NULL, true); in recalc_linger_target()
3624 osd = lookup_create_osd(osdc, lreq->t.osd, true); in recalc_linger_target()
3644 struct ceph_osd_client *osdc = osd->o_osdc; in scan_requests() local
3662 pool_cleared_full(osdc, lreq->t.base_oloc.pool)); in scan_requests()
3692 ct_res = calc_target(osdc, &req->r_t, &req->r_osd->o_con, in scan_requests()
3698 pool_cleared_full(osdc, req->r_t.base_oloc.pool)); in scan_requests()
3717 static int handle_one_map(struct ceph_osd_client *osdc, in handle_one_map() argument
3727 was_full = ceph_osdmap_flag(osdc, CEPH_OSDMAP_FULL); in handle_one_map()
3728 set_pool_was_full(osdc); in handle_one_map()
3731 newmap = osdmap_apply_incremental(&p, end, osdc->osdmap); in handle_one_map()
3737 if (newmap != osdc->osdmap) { in handle_one_map()
3748 old_pi = ceph_pg_pool_by_id(osdc->osdmap, pi->id); in handle_one_map()
3755 if (osdc->osdmap->epoch && in handle_one_map()
3756 osdc->osdmap->epoch + 1 < newmap->epoch) { in handle_one_map()
3761 ceph_osdmap_destroy(osdc->osdmap); in handle_one_map()
3762 osdc->osdmap = newmap; in handle_one_map()
3765 was_full &= !ceph_osdmap_flag(osdc, CEPH_OSDMAP_FULL); in handle_one_map()
3766 scan_requests(&osdc->homeless_osd, skipped_map, was_full, true, in handle_one_map()
3769 for (n = rb_first(&osdc->osds); n; ) { in handle_one_map()
3776 if (!ceph_osd_is_up(osdc->osdmap, osd->o_osd) || in handle_one_map()
3778 ceph_osd_addr(osdc->osdmap, osd->o_osd), in handle_one_map()
3786 static void kick_requests(struct ceph_osd_client *osdc, in kick_requests() argument
3801 if (req->r_t.epoch < osdc->osdmap->epoch) { in kick_requests()
3802 ct_res = calc_target(osdc, &req->r_t, NULL, false); in kick_requests()
3818 osd = lookup_create_osd(osdc, req->r_t.osd, true); in kick_requests()
3843 void ceph_osdc_handle_map(struct ceph_osd_client *osdc, struct ceph_msg *msg) in ceph_osdc_handle_map() argument
3857 dout("%s have %u\n", __func__, osdc->osdmap->epoch); in ceph_osdc_handle_map()
3858 down_write(&osdc->lock); in ceph_osdc_handle_map()
3863 if (ceph_check_fsid(osdc->client, &fsid) < 0) in ceph_osdc_handle_map()
3866 was_pauserd = ceph_osdmap_flag(osdc, CEPH_OSDMAP_PAUSERD); in ceph_osdc_handle_map()
3867 was_pausewr = ceph_osdmap_flag(osdc, CEPH_OSDMAP_PAUSEWR) || in ceph_osdc_handle_map()
3868 ceph_osdmap_flag(osdc, CEPH_OSDMAP_FULL) || in ceph_osdc_handle_map()
3869 have_pool_full(osdc); in ceph_osdc_handle_map()
3879 if (osdc->osdmap->epoch && in ceph_osdc_handle_map()
3880 osdc->osdmap->epoch + 1 == epoch) { in ceph_osdc_handle_map()
3883 err = handle_one_map(osdc, p, p + maplen, true, in ceph_osdc_handle_map()
3909 } else if (osdc->osdmap->epoch >= epoch) { in ceph_osdc_handle_map()
3912 osdc->osdmap->epoch); in ceph_osdc_handle_map()
3915 err = handle_one_map(osdc, p, p + maplen, false, in ceph_osdc_handle_map()
3930 pauserd = ceph_osdmap_flag(osdc, CEPH_OSDMAP_PAUSERD); in ceph_osdc_handle_map()
3931 pausewr = ceph_osdmap_flag(osdc, CEPH_OSDMAP_PAUSEWR) || in ceph_osdc_handle_map()
3932 ceph_osdmap_flag(osdc, CEPH_OSDMAP_FULL) || in ceph_osdc_handle_map()
3933 have_pool_full(osdc); in ceph_osdc_handle_map()
3935 osdc->osdmap->epoch < osdc->epoch_barrier) in ceph_osdc_handle_map()
3936 maybe_request_map(osdc); in ceph_osdc_handle_map()
3938 kick_requests(osdc, &need_resend, &need_resend_linger); in ceph_osdc_handle_map()
3940 ceph_osdc_abort_on_full(osdc); in ceph_osdc_handle_map()
3941 ceph_monc_got_map(&osdc->client->monc, CEPH_SUB_OSDMAP, in ceph_osdc_handle_map()
3942 osdc->osdmap->epoch); in ceph_osdc_handle_map()
3943 up_write(&osdc->lock); in ceph_osdc_handle_map()
3944 wake_up_all(&osdc->client->auth_wq); in ceph_osdc_handle_map()
3950 up_write(&osdc->lock); in ceph_osdc_handle_map()
3989 struct ceph_osd_client *osdc = osd->o_osdc; in osd_fault() local
3993 down_write(&osdc->lock); in osd_fault()
4001 maybe_request_map(osdc); in osd_fault()
4004 up_write(&osdc->lock); in osd_fault()
4223 struct ceph_osd_client *osdc = osd->o_osdc; in handle_backoff() local
4227 down_read(&osdc->lock); in handle_backoff()
4230 up_read(&osdc->lock); in handle_backoff()
4259 up_read(&osdc->lock); in handle_backoff()
4265 static void handle_watch_notify(struct ceph_osd_client *osdc, in handle_watch_notify() argument
4298 down_read(&osdc->lock); in handle_watch_notify()
4299 lreq = lookup_linger_osdc(&osdc->linger_requests, cookie); in handle_watch_notify()
4358 up_read(&osdc->lock); in handle_watch_notify()
4368 int ceph_osdc_start_request(struct ceph_osd_client *osdc, in ceph_osdc_start_request() argument
4372 down_read(&osdc->lock); in ceph_osdc_start_request()
4374 up_read(&osdc->lock); in ceph_osdc_start_request()
4386 struct ceph_osd_client *osdc = req->r_osdc; in ceph_osdc_cancel_request() local
4388 down_write(&osdc->lock); in ceph_osdc_cancel_request()
4391 up_write(&osdc->lock); in ceph_osdc_cancel_request()
4419 int ceph_osdc_wait_request(struct ceph_osd_client *osdc, in ceph_osdc_wait_request() argument
4429 void ceph_osdc_sync(struct ceph_osd_client *osdc) in ceph_osdc_sync() argument
4432 u64 last_tid = atomic64_read(&osdc->last_tid); in ceph_osdc_sync()
4435 down_read(&osdc->lock); in ceph_osdc_sync()
4436 for (n = rb_first(&osdc->osds); n; n = rb_next(n)) { in ceph_osdc_sync()
4452 up_read(&osdc->lock); in ceph_osdc_sync()
4463 up_read(&osdc->lock); in ceph_osdc_sync()
4473 req = ceph_osdc_alloc_request(lreq->osdc, NULL, 1, false, GFP_NOIO); in alloc_linger_request()
4492 ceph_osdc_watch(struct ceph_osd_client *osdc, in ceph_osdc_watch() argument
4502 lreq = linger_alloc(osdc); in ceph_osdc_watch()
4529 down_write(&osdc->lock); in ceph_osdc_watch()
4536 up_write(&osdc->lock); in ceph_osdc_watch()
4559 int ceph_osdc_unwatch(struct ceph_osd_client *osdc, in ceph_osdc_unwatch() argument
4562 struct ceph_options *opts = osdc->client->options; in ceph_osdc_unwatch()
4566 req = ceph_osdc_alloc_request(osdc, NULL, 1, false, GFP_NOIO); in ceph_osdc_unwatch()
4581 ceph_osdc_start_request(osdc, req, false); in ceph_osdc_unwatch()
4625 int ceph_osdc_notify_ack(struct ceph_osd_client *osdc, in ceph_osdc_notify_ack() argument
4636 req = ceph_osdc_alloc_request(osdc, NULL, 1, false, GFP_NOIO); in ceph_osdc_notify_ack()
4653 ceph_osdc_start_request(osdc, req, false); in ceph_osdc_notify_ack()
4654 ret = ceph_osdc_wait_request(osdc, req); in ceph_osdc_notify_ack()
4700 int ceph_osdc_notify(struct ceph_osd_client *osdc, in ceph_osdc_notify() argument
4719 lreq = linger_alloc(osdc); in ceph_osdc_notify()
4743 down_write(&osdc->lock); in ceph_osdc_notify()
4749 up_write(&osdc->lock); in ceph_osdc_notify()
4757 up_write(&osdc->lock); in ceph_osdc_notify()
4777 int ceph_osdc_watch_check(struct ceph_osd_client *osdc, in ceph_osdc_watch_check() argument
4783 down_read(&osdc->lock); in ceph_osdc_watch_check()
4802 up_read(&osdc->lock); in ceph_osdc_watch_check()
4866 int ceph_osdc_list_watchers(struct ceph_osd_client *osdc, in ceph_osdc_list_watchers() argument
4876 req = ceph_osdc_alloc_request(osdc, NULL, 1, false, GFP_NOIO); in ceph_osdc_list_watchers()
4899 ceph_osdc_start_request(osdc, req, false); in ceph_osdc_list_watchers()
4900 ret = ceph_osdc_wait_request(osdc, req); in ceph_osdc_list_watchers()
4918 void ceph_osdc_flush_notifies(struct ceph_osd_client *osdc) in ceph_osdc_flush_notifies() argument
4920 dout("%s osdc %p\n", __func__, osdc); in ceph_osdc_flush_notifies()
4921 flush_workqueue(osdc->notify_wq); in ceph_osdc_flush_notifies()
4925 void ceph_osdc_maybe_request_map(struct ceph_osd_client *osdc) in ceph_osdc_maybe_request_map() argument
4927 down_read(&osdc->lock); in ceph_osdc_maybe_request_map()
4928 maybe_request_map(osdc); in ceph_osdc_maybe_request_map()
4929 up_read(&osdc->lock); in ceph_osdc_maybe_request_map()
4939 int ceph_osdc_call(struct ceph_osd_client *osdc, in ceph_osdc_call() argument
4953 req = ceph_osdc_alloc_request(osdc, NULL, 1, false, GFP_NOIO); in ceph_osdc_call()
4976 ceph_osdc_start_request(osdc, req, false); in ceph_osdc_call()
4977 ret = ceph_osdc_wait_request(osdc, req); in ceph_osdc_call()
4993 int ceph_osdc_init(struct ceph_osd_client *osdc, struct ceph_client *client) in ceph_osdc_init() argument
4998 osdc->client = client; in ceph_osdc_init()
4999 init_rwsem(&osdc->lock); in ceph_osdc_init()
5000 osdc->osds = RB_ROOT; in ceph_osdc_init()
5001 INIT_LIST_HEAD(&osdc->osd_lru); in ceph_osdc_init()
5002 spin_lock_init(&osdc->osd_lru_lock); in ceph_osdc_init()
5003 osd_init(&osdc->homeless_osd); in ceph_osdc_init()
5004 osdc->homeless_osd.o_osdc = osdc; in ceph_osdc_init()
5005 osdc->homeless_osd.o_osd = CEPH_HOMELESS_OSD; in ceph_osdc_init()
5006 osdc->last_linger_id = CEPH_LINGER_ID_START; in ceph_osdc_init()
5007 osdc->linger_requests = RB_ROOT; in ceph_osdc_init()
5008 osdc->map_checks = RB_ROOT; in ceph_osdc_init()
5009 osdc->linger_map_checks = RB_ROOT; in ceph_osdc_init()
5010 INIT_DELAYED_WORK(&osdc->timeout_work, handle_timeout); in ceph_osdc_init()
5011 INIT_DELAYED_WORK(&osdc->osds_timeout_work, handle_osds_timeout); in ceph_osdc_init()
5014 osdc->osdmap = ceph_osdmap_alloc(); in ceph_osdc_init()
5015 if (!osdc->osdmap) in ceph_osdc_init()
5018 osdc->req_mempool = mempool_create_slab_pool(10, in ceph_osdc_init()
5020 if (!osdc->req_mempool) in ceph_osdc_init()
5023 err = ceph_msgpool_init(&osdc->msgpool_op, CEPH_MSG_OSD_OP, in ceph_osdc_init()
5027 err = ceph_msgpool_init(&osdc->msgpool_op_reply, CEPH_MSG_OSD_OPREPLY, in ceph_osdc_init()
5033 osdc->notify_wq = create_singlethread_workqueue("ceph-watch-notify"); in ceph_osdc_init()
5034 if (!osdc->notify_wq) in ceph_osdc_init()
5037 osdc->completion_wq = create_singlethread_workqueue("ceph-completion"); in ceph_osdc_init()
5038 if (!osdc->completion_wq) in ceph_osdc_init()
5041 schedule_delayed_work(&osdc->timeout_work, in ceph_osdc_init()
5042 osdc->client->options->osd_keepalive_timeout); in ceph_osdc_init()
5043 schedule_delayed_work(&osdc->osds_timeout_work, in ceph_osdc_init()
5044 round_jiffies_relative(osdc->client->options->osd_idle_ttl)); in ceph_osdc_init()
5049 destroy_workqueue(osdc->notify_wq); in ceph_osdc_init()
5051 ceph_msgpool_destroy(&osdc->msgpool_op_reply); in ceph_osdc_init()
5053 ceph_msgpool_destroy(&osdc->msgpool_op); in ceph_osdc_init()
5055 mempool_destroy(osdc->req_mempool); in ceph_osdc_init()
5057 ceph_osdmap_destroy(osdc->osdmap); in ceph_osdc_init()
5062 void ceph_osdc_stop(struct ceph_osd_client *osdc) in ceph_osdc_stop() argument
5064 destroy_workqueue(osdc->completion_wq); in ceph_osdc_stop()
5065 destroy_workqueue(osdc->notify_wq); in ceph_osdc_stop()
5066 cancel_delayed_work_sync(&osdc->timeout_work); in ceph_osdc_stop()
5067 cancel_delayed_work_sync(&osdc->osds_timeout_work); in ceph_osdc_stop()
5069 down_write(&osdc->lock); in ceph_osdc_stop()
5070 while (!RB_EMPTY_ROOT(&osdc->osds)) { in ceph_osdc_stop()
5071 struct ceph_osd *osd = rb_entry(rb_first(&osdc->osds), in ceph_osdc_stop()
5075 up_write(&osdc->lock); in ceph_osdc_stop()
5076 WARN_ON(refcount_read(&osdc->homeless_osd.o_ref) != 1); in ceph_osdc_stop()
5077 osd_cleanup(&osdc->homeless_osd); in ceph_osdc_stop()
5079 WARN_ON(!list_empty(&osdc->osd_lru)); in ceph_osdc_stop()
5080 WARN_ON(!RB_EMPTY_ROOT(&osdc->linger_requests)); in ceph_osdc_stop()
5081 WARN_ON(!RB_EMPTY_ROOT(&osdc->map_checks)); in ceph_osdc_stop()
5082 WARN_ON(!RB_EMPTY_ROOT(&osdc->linger_map_checks)); in ceph_osdc_stop()
5083 WARN_ON(atomic_read(&osdc->num_requests)); in ceph_osdc_stop()
5084 WARN_ON(atomic_read(&osdc->num_homeless)); in ceph_osdc_stop()
5086 ceph_osdmap_destroy(osdc->osdmap); in ceph_osdc_stop()
5087 mempool_destroy(osdc->req_mempool); in ceph_osdc_stop()
5088 ceph_msgpool_destroy(&osdc->msgpool_op); in ceph_osdc_stop()
5089 ceph_msgpool_destroy(&osdc->msgpool_op_reply); in ceph_osdc_stop()
5096 int ceph_osdc_readpages(struct ceph_osd_client *osdc, in ceph_osdc_readpages() argument
5107 req = ceph_osdc_new_request(osdc, layout, vino, off, plen, 0, 1, in ceph_osdc_readpages()
5121 rc = ceph_osdc_start_request(osdc, req, false); in ceph_osdc_readpages()
5123 rc = ceph_osdc_wait_request(osdc, req); in ceph_osdc_readpages()
5134 int ceph_osdc_writepages(struct ceph_osd_client *osdc, struct ceph_vino vino, in ceph_osdc_writepages() argument
5146 req = ceph_osdc_new_request(osdc, layout, vino, off, &len, 0, 1, in ceph_osdc_writepages()
5159 rc = ceph_osdc_start_request(osdc, req, true); in ceph_osdc_writepages()
5161 rc = ceph_osdc_wait_request(osdc, req); in ceph_osdc_writepages()
5196 struct ceph_osd_client *osdc = osd->o_osdc; in dispatch() local
5201 ceph_osdc_handle_map(osdc, msg); in dispatch()
5210 handle_watch_notify(osdc, msg); in dispatch()
5231 struct ceph_osd_client *osdc = osd->o_osdc; in get_reply() local
5238 down_read(&osdc->lock); in get_reply()
5284 up_read(&osdc->lock); in get_reply()
5372 struct ceph_osd_client *osdc = o->o_osdc; in get_authorizer() local
5373 struct ceph_auth_client *ac = osdc->client->monc.auth; in get_authorizer()
5400 struct ceph_osd_client *osdc = o->o_osdc; in add_authorizer_challenge() local
5401 struct ceph_auth_client *ac = osdc->client->monc.auth; in add_authorizer_challenge()
5410 struct ceph_osd_client *osdc = o->o_osdc; in verify_authorizer_reply() local
5411 struct ceph_auth_client *ac = osdc->client->monc.auth; in verify_authorizer_reply()
5419 struct ceph_osd_client *osdc = o->o_osdc; in invalidate_authorizer() local
5420 struct ceph_auth_client *ac = osdc->client->monc.auth; in invalidate_authorizer()
5423 return ceph_monc_validate_auth(&osdc->client->monc); in invalidate_authorizer()