Lines Matching refs:lreq
52 struct ceph_osd_linger_request *lreq);
54 struct ceph_osd_linger_request *lreq);
85 static inline void verify_lreq_locked(struct ceph_osd_linger_request *lreq) in verify_lreq_locked() argument
87 WARN_ON(!mutex_is_locked(&lreq->lock)); in verify_lreq_locked()
93 static inline void verify_lreq_locked(struct ceph_osd_linger_request *lreq) { } in verify_lreq_locked() argument
1307 struct ceph_osd_linger_request *lreq = in close_osd() local
1312 dout(" reassigning lreq %p linger_id %llu\n", lreq, in close_osd()
1313 lreq->linger_id); in close_osd()
1314 unlink_linger(osd, lreq); in close_osd()
1315 link_linger(&osdc->homeless_osd, lreq); in close_osd()
2701 struct ceph_osd_linger_request *lreq = in linger_release() local
2704 dout("%s lreq %p reg_req %p ping_req %p\n", __func__, lreq, in linger_release()
2705 lreq->reg_req, lreq->ping_req); in linger_release()
2706 WARN_ON(!RB_EMPTY_NODE(&lreq->node)); in linger_release()
2707 WARN_ON(!RB_EMPTY_NODE(&lreq->osdc_node)); in linger_release()
2708 WARN_ON(!RB_EMPTY_NODE(&lreq->mc_node)); in linger_release()
2709 WARN_ON(!list_empty(&lreq->scan_item)); in linger_release()
2710 WARN_ON(!list_empty(&lreq->pending_lworks)); in linger_release()
2711 WARN_ON(lreq->osd); in linger_release()
2713 if (lreq->request_pl) in linger_release()
2714 ceph_pagelist_release(lreq->request_pl); in linger_release()
2715 if (lreq->notify_id_pages) in linger_release()
2716 ceph_release_page_vector(lreq->notify_id_pages, 1); in linger_release()
2718 ceph_osdc_put_request(lreq->reg_req); in linger_release()
2719 ceph_osdc_put_request(lreq->ping_req); in linger_release()
2720 target_destroy(&lreq->t); in linger_release()
2721 kfree(lreq); in linger_release()
2724 static void linger_put(struct ceph_osd_linger_request *lreq) in linger_put() argument
2726 if (lreq) in linger_put()
2727 kref_put(&lreq->kref, linger_release); in linger_put()
2731 linger_get(struct ceph_osd_linger_request *lreq) in linger_get() argument
2733 kref_get(&lreq->kref); in linger_get()
2734 return lreq; in linger_get()
2740 struct ceph_osd_linger_request *lreq; in linger_alloc() local
2742 lreq = kzalloc(sizeof(*lreq), GFP_NOIO); in linger_alloc()
2743 if (!lreq) in linger_alloc()
2746 kref_init(&lreq->kref); in linger_alloc()
2747 mutex_init(&lreq->lock); in linger_alloc()
2748 RB_CLEAR_NODE(&lreq->node); in linger_alloc()
2749 RB_CLEAR_NODE(&lreq->osdc_node); in linger_alloc()
2750 RB_CLEAR_NODE(&lreq->mc_node); in linger_alloc()
2751 INIT_LIST_HEAD(&lreq->scan_item); in linger_alloc()
2752 INIT_LIST_HEAD(&lreq->pending_lworks); in linger_alloc()
2753 init_completion(&lreq->reg_commit_wait); in linger_alloc()
2754 init_completion(&lreq->notify_finish_wait); in linger_alloc()
2756 lreq->osdc = osdc; in linger_alloc()
2757 target_init(&lreq->t); in linger_alloc()
2759 dout("%s lreq %p\n", __func__, lreq); in linger_alloc()
2760 return lreq; in linger_alloc()
2773 struct ceph_osd_linger_request *lreq) in DEFINE_RB_INSDEL_FUNCS()
2776 WARN_ON(!lreq->linger_id || lreq->osd); in DEFINE_RB_INSDEL_FUNCS()
2778 osd->o_osd, lreq, lreq->linger_id); in DEFINE_RB_INSDEL_FUNCS()
2786 insert_linger(&osd->o_linger_requests, lreq); in DEFINE_RB_INSDEL_FUNCS()
2787 lreq->osd = osd; in DEFINE_RB_INSDEL_FUNCS()
2791 struct ceph_osd_linger_request *lreq) in unlink_linger() argument
2794 WARN_ON(lreq->osd != osd); in unlink_linger()
2796 osd->o_osd, lreq, lreq->linger_id); in unlink_linger()
2798 lreq->osd = NULL; in unlink_linger()
2799 erase_linger(&osd->o_linger_requests, lreq); in unlink_linger()
2808 static bool __linger_registered(struct ceph_osd_linger_request *lreq) in __linger_registered() argument
2810 verify_osdc_locked(lreq->osdc); in __linger_registered()
2812 return !RB_EMPTY_NODE(&lreq->osdc_node); in __linger_registered()
2815 static bool linger_registered(struct ceph_osd_linger_request *lreq) in linger_registered() argument
2817 struct ceph_osd_client *osdc = lreq->osdc; in linger_registered()
2821 registered = __linger_registered(lreq); in linger_registered()
2827 static void linger_register(struct ceph_osd_linger_request *lreq) in linger_register() argument
2829 struct ceph_osd_client *osdc = lreq->osdc; in linger_register()
2832 WARN_ON(lreq->linger_id); in linger_register()
2834 linger_get(lreq); in linger_register()
2835 lreq->linger_id = ++osdc->last_linger_id; in linger_register()
2836 insert_linger_osdc(&osdc->linger_requests, lreq); in linger_register()
2839 static void linger_unregister(struct ceph_osd_linger_request *lreq) in linger_unregister() argument
2841 struct ceph_osd_client *osdc = lreq->osdc; in linger_unregister()
2845 erase_linger_osdc(&osdc->linger_requests, lreq); in linger_unregister()
2846 linger_put(lreq); in linger_unregister()
2851 struct ceph_osd_linger_request *lreq = req->r_priv; in cancel_linger_request() local
2855 linger_put(lreq); in cancel_linger_request()
2860 struct ceph_osd_linger_request *lreq; member
2879 static struct linger_work *lwork_alloc(struct ceph_osd_linger_request *lreq, in lwork_alloc() argument
2890 lwork->lreq = linger_get(lreq); in lwork_alloc()
2897 struct ceph_osd_linger_request *lreq = lwork->lreq; in lwork_free() local
2899 mutex_lock(&lreq->lock); in lwork_free()
2901 mutex_unlock(&lreq->lock); in lwork_free()
2903 linger_put(lreq); in lwork_free()
2909 struct ceph_osd_linger_request *lreq = lwork->lreq; in lwork_queue() local
2910 struct ceph_osd_client *osdc = lreq->osdc; in lwork_queue()
2912 verify_lreq_locked(lreq); in lwork_queue()
2916 list_add_tail(&lwork->pending_item, &lreq->pending_lworks); in lwork_queue()
2923 struct ceph_osd_linger_request *lreq = lwork->lreq; in do_watch_notify() local
2925 if (!linger_registered(lreq)) { in do_watch_notify()
2926 dout("%s lreq %p not registered\n", __func__, lreq); in do_watch_notify()
2930 WARN_ON(!lreq->is_watch); in do_watch_notify()
2932 __func__, lreq, lwork->notify.notify_id, lwork->notify.notifier_id, in do_watch_notify()
2934 lreq->wcb(lreq->data, lwork->notify.notify_id, lreq->linger_id, in do_watch_notify()
2946 struct ceph_osd_linger_request *lreq = lwork->lreq; in do_watch_error() local
2948 if (!linger_registered(lreq)) { in do_watch_error()
2949 dout("%s lreq %p not registered\n", __func__, lreq); in do_watch_error()
2953 dout("%s lreq %p err %d\n", __func__, lreq, lwork->error.err); in do_watch_error()
2954 lreq->errcb(lreq->data, lreq->linger_id, lwork->error.err); in do_watch_error()
2960 static void queue_watch_error(struct ceph_osd_linger_request *lreq) in queue_watch_error() argument
2964 lwork = lwork_alloc(lreq, do_watch_error); in queue_watch_error()
2970 lwork->error.err = lreq->last_error; in queue_watch_error()
2974 static void linger_reg_commit_complete(struct ceph_osd_linger_request *lreq, in linger_reg_commit_complete() argument
2977 if (!completion_done(&lreq->reg_commit_wait)) { in linger_reg_commit_complete()
2978 lreq->reg_commit_error = (result <= 0 ? result : 0); in linger_reg_commit_complete()
2979 complete_all(&lreq->reg_commit_wait); in linger_reg_commit_complete()
2985 struct ceph_osd_linger_request *lreq = req->r_priv; in linger_commit_cb() local
2987 mutex_lock(&lreq->lock); in linger_commit_cb()
2988 if (req != lreq->reg_req) { in linger_commit_cb()
2990 __func__, lreq, lreq->linger_id, req, lreq->reg_req); in linger_commit_cb()
2994 dout("%s lreq %p linger_id %llu result %d\n", __func__, lreq, in linger_commit_cb()
2995 lreq->linger_id, req->r_result); in linger_commit_cb()
2996 linger_reg_commit_complete(lreq, req->r_result); in linger_commit_cb()
2997 lreq->committed = true; in linger_commit_cb()
2999 if (!lreq->is_watch) { in linger_commit_cb()
3009 lreq->notify_id = ceph_decode_64(&p); in linger_commit_cb()
3010 dout("lreq %p notify_id %llu\n", lreq, in linger_commit_cb()
3011 lreq->notify_id); in linger_commit_cb()
3013 dout("lreq %p no notify_id\n", lreq); in linger_commit_cb()
3018 mutex_unlock(&lreq->lock); in linger_commit_cb()
3019 linger_put(lreq); in linger_commit_cb()
3037 struct ceph_osd_linger_request *lreq = req->r_priv; in linger_reconnect_cb() local
3039 mutex_lock(&lreq->lock); in linger_reconnect_cb()
3040 if (req != lreq->reg_req) { in linger_reconnect_cb()
3042 __func__, lreq, lreq->linger_id, req, lreq->reg_req); in linger_reconnect_cb()
3047 lreq, lreq->linger_id, req->r_result, lreq->last_error); in linger_reconnect_cb()
3049 if (!lreq->last_error) { in linger_reconnect_cb()
3050 lreq->last_error = normalize_watch_error(req->r_result); in linger_reconnect_cb()
3051 queue_watch_error(lreq); in linger_reconnect_cb()
3056 mutex_unlock(&lreq->lock); in linger_reconnect_cb()
3057 linger_put(lreq); in linger_reconnect_cb()
3060 static void send_linger(struct ceph_osd_linger_request *lreq) in send_linger() argument
3062 struct ceph_osd_client *osdc = lreq->osdc; in send_linger()
3067 mutex_lock(&lreq->lock); in send_linger()
3068 dout("%s lreq %p linger_id %llu\n", __func__, lreq, lreq->linger_id); in send_linger()
3070 if (lreq->reg_req) { in send_linger()
3071 if (lreq->reg_req->r_osd) in send_linger()
3072 cancel_linger_request(lreq->reg_req); in send_linger()
3073 ceph_osdc_put_request(lreq->reg_req); in send_linger()
3079 target_copy(&req->r_t, &lreq->t); in send_linger()
3080 req->r_mtime = lreq->mtime; in send_linger()
3082 if (lreq->is_watch && lreq->committed) { in send_linger()
3084 lreq->linger_id, ++lreq->register_gen); in send_linger()
3085 dout("lreq %p reconnect register_gen %u\n", lreq, in send_linger()
3089 if (lreq->is_watch) { in send_linger()
3091 lreq->linger_id, 0); in send_linger()
3093 lreq->notify_id = 0; in send_linger()
3095 refcount_inc(&lreq->request_pl->refcnt); in send_linger()
3096 osd_req_op_notify_init(req, 0, lreq->linger_id, in send_linger()
3097 lreq->request_pl); in send_linger()
3100 lreq->notify_id_pages, PAGE_SIZE, 0, false, false); in send_linger()
3102 dout("lreq %p register\n", lreq); in send_linger()
3109 req->r_priv = linger_get(lreq); in send_linger()
3111 lreq->reg_req = req; in send_linger()
3112 mutex_unlock(&lreq->lock); in send_linger()
3119 struct ceph_osd_linger_request *lreq = req->r_priv; in linger_ping_cb() local
3121 mutex_lock(&lreq->lock); in linger_ping_cb()
3122 if (req != lreq->ping_req) { in linger_ping_cb()
3124 __func__, lreq, lreq->linger_id, req, lreq->ping_req); in linger_ping_cb()
3129 __func__, lreq, lreq->linger_id, req->r_result, lreq->ping_sent, in linger_ping_cb()
3130 lreq->last_error); in linger_ping_cb()
3131 if (lreq->register_gen == req->r_ops[0].watch.gen) { in linger_ping_cb()
3133 lreq->watch_valid_thru = lreq->ping_sent; in linger_ping_cb()
3134 } else if (!lreq->last_error) { in linger_ping_cb()
3135 lreq->last_error = normalize_watch_error(req->r_result); in linger_ping_cb()
3136 queue_watch_error(lreq); in linger_ping_cb()
3139 dout("lreq %p register_gen %u ignoring old pong %u\n", lreq, in linger_ping_cb()
3140 lreq->register_gen, req->r_ops[0].watch.gen); in linger_ping_cb()
3144 mutex_unlock(&lreq->lock); in linger_ping_cb()
3145 linger_put(lreq); in linger_ping_cb()
3148 static void send_linger_ping(struct ceph_osd_linger_request *lreq) in send_linger_ping() argument
3150 struct ceph_osd_client *osdc = lreq->osdc; in send_linger_ping()
3159 lreq->ping_sent = jiffies; in send_linger_ping()
3161 __func__, lreq, lreq->linger_id, lreq->ping_sent, in send_linger_ping()
3162 lreq->register_gen); in send_linger_ping()
3164 if (lreq->ping_req) { in send_linger_ping()
3165 if (lreq->ping_req->r_osd) in send_linger_ping()
3166 cancel_linger_request(lreq->ping_req); in send_linger_ping()
3167 ceph_osdc_put_request(lreq->ping_req); in send_linger_ping()
3173 target_copy(&req->r_t, &lreq->t); in send_linger_ping()
3174 osd_req_op_watch_init(req, 0, CEPH_OSD_WATCH_OP_PING, lreq->linger_id, in send_linger_ping()
3175 lreq->register_gen); in send_linger_ping()
3181 req->r_priv = linger_get(lreq); in send_linger_ping()
3183 lreq->ping_req = req; in send_linger_ping()
3188 link_request(lreq->osd, req); in send_linger_ping()
3192 static void linger_submit(struct ceph_osd_linger_request *lreq) in linger_submit() argument
3194 struct ceph_osd_client *osdc = lreq->osdc; in linger_submit()
3198 linger_register(lreq); in linger_submit()
3200 calc_target(osdc, &lreq->t, false); in linger_submit()
3201 osd = lookup_create_osd(osdc, lreq->t.osd, true); in linger_submit()
3202 link_linger(osd, lreq); in linger_submit()
3204 send_linger(lreq); in linger_submit()
3208 static void cancel_linger_map_check(struct ceph_osd_linger_request *lreq) in cancel_linger_map_check() argument
3210 struct ceph_osd_client *osdc = lreq->osdc; in cancel_linger_map_check()
3216 lreq->linger_id); in cancel_linger_map_check()
3220 WARN_ON(lookup_lreq != lreq); in cancel_linger_map_check()
3221 erase_linger_mc(&osdc->linger_map_checks, lreq); in cancel_linger_map_check()
3222 linger_put(lreq); in cancel_linger_map_check()
3228 static void __linger_cancel(struct ceph_osd_linger_request *lreq) in __linger_cancel() argument
3230 if (lreq->ping_req && lreq->ping_req->r_osd) in __linger_cancel()
3231 cancel_linger_request(lreq->ping_req); in __linger_cancel()
3232 if (lreq->reg_req && lreq->reg_req->r_osd) in __linger_cancel()
3233 cancel_linger_request(lreq->reg_req); in __linger_cancel()
3234 cancel_linger_map_check(lreq); in __linger_cancel()
3235 unlink_linger(lreq->osd, lreq); in __linger_cancel()
3236 linger_unregister(lreq); in __linger_cancel()
3239 static void linger_cancel(struct ceph_osd_linger_request *lreq) in linger_cancel() argument
3241 struct ceph_osd_client *osdc = lreq->osdc; in linger_cancel()
3244 if (__linger_registered(lreq)) in linger_cancel()
3245 __linger_cancel(lreq); in linger_cancel()
3249 static void send_linger_map_check(struct ceph_osd_linger_request *lreq);
3251 static void check_linger_pool_dne(struct ceph_osd_linger_request *lreq) in check_linger_pool_dne() argument
3253 struct ceph_osd_client *osdc = lreq->osdc; in check_linger_pool_dne()
3259 if (lreq->register_gen) { in check_linger_pool_dne()
3260 lreq->map_dne_bound = map->epoch; in check_linger_pool_dne()
3262 lreq, lreq->linger_id); in check_linger_pool_dne()
3265 __func__, lreq, lreq->linger_id, lreq->map_dne_bound, in check_linger_pool_dne()
3269 if (lreq->map_dne_bound) { in check_linger_pool_dne()
3270 if (map->epoch >= lreq->map_dne_bound) { in check_linger_pool_dne()
3273 lreq->linger_id); in check_linger_pool_dne()
3274 linger_reg_commit_complete(lreq, -ENOENT); in check_linger_pool_dne()
3275 __linger_cancel(lreq); in check_linger_pool_dne()
3278 send_linger_map_check(lreq); in check_linger_pool_dne()
3285 struct ceph_osd_linger_request *lreq; in linger_map_check_cb() local
3291 lreq = lookup_linger_mc(&osdc->linger_map_checks, linger_id); in linger_map_check_cb()
3292 if (!lreq) { in linger_map_check_cb()
3298 __func__, lreq, lreq->linger_id, lreq->map_dne_bound, in linger_map_check_cb()
3300 if (!lreq->map_dne_bound) in linger_map_check_cb()
3301 lreq->map_dne_bound = greq->u.newest; in linger_map_check_cb()
3302 erase_linger_mc(&osdc->linger_map_checks, lreq); in linger_map_check_cb()
3303 check_linger_pool_dne(lreq); in linger_map_check_cb()
3305 linger_put(lreq); in linger_map_check_cb()
3310 static void send_linger_map_check(struct ceph_osd_linger_request *lreq) in send_linger_map_check() argument
3312 struct ceph_osd_client *osdc = lreq->osdc; in send_linger_map_check()
3319 lreq->linger_id); in send_linger_map_check()
3321 WARN_ON(lookup_lreq != lreq); in send_linger_map_check()
3325 linger_get(lreq); in send_linger_map_check()
3326 insert_linger_mc(&osdc->linger_map_checks, lreq); in send_linger_map_check()
3328 linger_map_check_cb, lreq->linger_id); in send_linger_map_check()
3332 static int linger_reg_commit_wait(struct ceph_osd_linger_request *lreq) in linger_reg_commit_wait() argument
3336 dout("%s lreq %p linger_id %llu\n", __func__, lreq, lreq->linger_id); in linger_reg_commit_wait()
3337 ret = wait_for_completion_interruptible(&lreq->reg_commit_wait); in linger_reg_commit_wait()
3338 return ret ?: lreq->reg_commit_error; in linger_reg_commit_wait()
3341 static int linger_notify_finish_wait(struct ceph_osd_linger_request *lreq) in linger_notify_finish_wait() argument
3345 dout("%s lreq %p linger_id %llu\n", __func__, lreq, lreq->linger_id); in linger_notify_finish_wait()
3346 ret = wait_for_completion_interruptible(&lreq->notify_finish_wait); in linger_notify_finish_wait()
3347 return ret ?: lreq->notify_finish_error; in linger_notify_finish_wait()
3397 struct ceph_osd_linger_request *lreq = in handle_timeout() local
3401 lreq, lreq->linger_id, osd->o_osd); in handle_timeout()
3404 mutex_lock(&lreq->lock); in handle_timeout()
3405 if (lreq->is_watch && lreq->committed && !lreq->last_error) in handle_timeout()
3406 send_linger_ping(lreq); in handle_timeout()
3407 mutex_unlock(&lreq->lock); in handle_timeout()
3831 recalc_linger_target(struct ceph_osd_linger_request *lreq) in recalc_linger_target() argument
3833 struct ceph_osd_client *osdc = lreq->osdc; in recalc_linger_target()
3836 ct_res = calc_target(osdc, &lreq->t, true); in recalc_linger_target()
3840 osd = lookup_create_osd(osdc, lreq->t.osd, true); in recalc_linger_target()
3841 if (osd != lreq->osd) { in recalc_linger_target()
3842 unlink_linger(lreq->osd, lreq); in recalc_linger_target()
3843 link_linger(osd, lreq); in recalc_linger_target()
3865 struct ceph_osd_linger_request *lreq = in scan_requests() local
3871 dout("%s lreq %p linger_id %llu\n", __func__, lreq, in scan_requests()
3872 lreq->linger_id); in scan_requests()
3873 ct_res = recalc_linger_target(lreq); in scan_requests()
3878 pool_cleared_full(osdc, lreq->t.base_oloc.pool)); in scan_requests()
3884 cancel_linger_map_check(lreq); in scan_requests()
3890 if (list_empty(&lreq->scan_item)) in scan_requests()
3891 list_add_tail(&lreq->scan_item, need_resend_linger); in scan_requests()
3894 list_del_init(&lreq->scan_item); in scan_requests()
3895 check_linger_pool_dne(lreq); in scan_requests()
4007 struct ceph_osd_linger_request *lreq, *nlreq; in kick_requests() local
4045 list_for_each_entry_safe(lreq, nlreq, need_resend_linger, scan_item) { in kick_requests()
4046 if (!osd_homeless(lreq->osd)) in kick_requests()
4047 send_linger(lreq); in kick_requests()
4049 list_del_init(&lreq->scan_item); in kick_requests()
4193 struct ceph_osd_linger_request *lreq = in kick_osd_requests() local
4196 send_linger(lreq); in kick_osd_requests()
4487 struct ceph_osd_linger_request *lreq; in handle_watch_notify() local
4516 lreq = lookup_linger_osdc(&osdc->linger_requests, cookie); in handle_watch_notify()
4517 if (!lreq) { in handle_watch_notify()
4523 mutex_lock(&lreq->lock); in handle_watch_notify()
4525 opcode, cookie, lreq, lreq->is_watch); in handle_watch_notify()
4527 if (!lreq->last_error) { in handle_watch_notify()
4528 lreq->last_error = -ENOTCONN; in handle_watch_notify()
4529 queue_watch_error(lreq); in handle_watch_notify()
4531 } else if (!lreq->is_watch) { in handle_watch_notify()
4533 if (lreq->notify_id && lreq->notify_id != notify_id) { in handle_watch_notify()
4534 dout("lreq %p notify_id %llu != %llu, ignoring\n", lreq, in handle_watch_notify()
4535 lreq->notify_id, notify_id); in handle_watch_notify()
4536 } else if (!completion_done(&lreq->notify_finish_wait)) { in handle_watch_notify()
4541 if (lreq->preply_pages) { in handle_watch_notify()
4544 *lreq->preply_pages = data->pages; in handle_watch_notify()
4545 *lreq->preply_len = data->length; in handle_watch_notify()
4549 lreq->notify_finish_error = return_code; in handle_watch_notify()
4550 complete_all(&lreq->notify_finish_wait); in handle_watch_notify()
4554 lwork = lwork_alloc(lreq, do_watch_notify); in handle_watch_notify()
4569 mutex_unlock(&lreq->lock); in handle_watch_notify()
4694 struct ceph_osd_linger_request *lreq; in ceph_osdc_watch() local
4697 lreq = linger_alloc(osdc); in ceph_osdc_watch()
4698 if (!lreq) in ceph_osdc_watch()
4701 lreq->is_watch = true; in ceph_osdc_watch()
4702 lreq->wcb = wcb; in ceph_osdc_watch()
4703 lreq->errcb = errcb; in ceph_osdc_watch()
4704 lreq->data = data; in ceph_osdc_watch()
4705 lreq->watch_valid_thru = jiffies; in ceph_osdc_watch()
4707 ceph_oid_copy(&lreq->t.base_oid, oid); in ceph_osdc_watch()
4708 ceph_oloc_copy(&lreq->t.base_oloc, oloc); in ceph_osdc_watch()
4709 lreq->t.flags = CEPH_OSD_FLAG_WRITE; in ceph_osdc_watch()
4710 ktime_get_real_ts64(&lreq->mtime); in ceph_osdc_watch()
4712 linger_submit(lreq); in ceph_osdc_watch()
4713 ret = linger_reg_commit_wait(lreq); in ceph_osdc_watch()
4715 linger_cancel(lreq); in ceph_osdc_watch()
4719 return lreq; in ceph_osdc_watch()
4722 linger_put(lreq); in ceph_osdc_watch()
4735 struct ceph_osd_linger_request *lreq) in ceph_osdc_unwatch() argument
4745 ceph_oid_copy(&req->r_base_oid, &lreq->t.base_oid); in ceph_osdc_unwatch()
4746 ceph_oloc_copy(&req->r_base_oloc, &lreq->t.base_oloc); in ceph_osdc_unwatch()
4750 lreq->linger_id, 0); in ceph_osdc_unwatch()
4757 linger_cancel(lreq); in ceph_osdc_unwatch()
4758 linger_put(lreq); in ceph_osdc_unwatch()
4853 struct ceph_osd_linger_request *lreq; in ceph_osdc_notify() local
4862 lreq = linger_alloc(osdc); in ceph_osdc_notify()
4863 if (!lreq) in ceph_osdc_notify()
4866 lreq->request_pl = ceph_pagelist_alloc(GFP_NOIO); in ceph_osdc_notify()
4867 if (!lreq->request_pl) { in ceph_osdc_notify()
4872 ret = ceph_pagelist_encode_32(lreq->request_pl, 1); /* prot_ver */ in ceph_osdc_notify()
4873 ret |= ceph_pagelist_encode_32(lreq->request_pl, timeout); in ceph_osdc_notify()
4874 ret |= ceph_pagelist_encode_32(lreq->request_pl, payload_len); in ceph_osdc_notify()
4875 ret |= ceph_pagelist_append(lreq->request_pl, payload, payload_len); in ceph_osdc_notify()
4882 lreq->notify_id_pages = ceph_alloc_page_vector(1, GFP_NOIO); in ceph_osdc_notify()
4883 if (IS_ERR(lreq->notify_id_pages)) { in ceph_osdc_notify()
4884 ret = PTR_ERR(lreq->notify_id_pages); in ceph_osdc_notify()
4885 lreq->notify_id_pages = NULL; in ceph_osdc_notify()
4889 lreq->preply_pages = preply_pages; in ceph_osdc_notify()
4890 lreq->preply_len = preply_len; in ceph_osdc_notify()
4892 ceph_oid_copy(&lreq->t.base_oid, oid); in ceph_osdc_notify()
4893 ceph_oloc_copy(&lreq->t.base_oloc, oloc); in ceph_osdc_notify()
4894 lreq->t.flags = CEPH_OSD_FLAG_READ; in ceph_osdc_notify()
4896 linger_submit(lreq); in ceph_osdc_notify()
4897 ret = linger_reg_commit_wait(lreq); in ceph_osdc_notify()
4899 ret = linger_notify_finish_wait(lreq); in ceph_osdc_notify()
4901 dout("lreq %p failed to initiate notify %d\n", lreq, ret); in ceph_osdc_notify()
4903 linger_cancel(lreq); in ceph_osdc_notify()
4905 linger_put(lreq); in ceph_osdc_notify()
4916 struct ceph_osd_linger_request *lreq) in ceph_osdc_watch_check() argument
4922 mutex_lock(&lreq->lock); in ceph_osdc_watch_check()
4923 stamp = lreq->watch_valid_thru; in ceph_osdc_watch_check()
4924 if (!list_empty(&lreq->pending_lworks)) { in ceph_osdc_watch_check()
4926 list_first_entry(&lreq->pending_lworks, in ceph_osdc_watch_check()
4935 lreq, lreq->linger_id, age, lreq->last_error); in ceph_osdc_watch_check()
4937 ret = lreq->last_error ?: 1 + jiffies_to_msecs(age); in ceph_osdc_watch_check()
4939 mutex_unlock(&lreq->lock); in ceph_osdc_watch_check()