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
1383 struct ceph_osd_linger_request *lreq = in close_osd() local
1388 dout(" reassigning lreq %p linger_id %llu\n", lreq, in close_osd()
1389 lreq->linger_id); in close_osd()
1390 unlink_linger(osd, lreq); in close_osd()
1391 link_linger(&osdc->homeless_osd, lreq); in close_osd()
2784 struct ceph_osd_linger_request *lreq = in linger_release() local
2787 dout("%s lreq %p reg_req %p ping_req %p\n", __func__, lreq, in linger_release()
2788 lreq->reg_req, lreq->ping_req); in linger_release()
2789 WARN_ON(!RB_EMPTY_NODE(&lreq->node)); in linger_release()
2790 WARN_ON(!RB_EMPTY_NODE(&lreq->osdc_node)); in linger_release()
2791 WARN_ON(!RB_EMPTY_NODE(&lreq->mc_node)); in linger_release()
2792 WARN_ON(!list_empty(&lreq->scan_item)); in linger_release()
2793 WARN_ON(!list_empty(&lreq->pending_lworks)); in linger_release()
2794 WARN_ON(lreq->osd); in linger_release()
2796 if (lreq->request_pl) in linger_release()
2797 ceph_pagelist_release(lreq->request_pl); in linger_release()
2798 if (lreq->notify_id_pages) in linger_release()
2799 ceph_release_page_vector(lreq->notify_id_pages, 1); in linger_release()
2801 ceph_osdc_put_request(lreq->reg_req); in linger_release()
2802 ceph_osdc_put_request(lreq->ping_req); in linger_release()
2803 target_destroy(&lreq->t); in linger_release()
2804 kfree(lreq); in linger_release()
2807 static void linger_put(struct ceph_osd_linger_request *lreq) in linger_put() argument
2809 if (lreq) in linger_put()
2810 kref_put(&lreq->kref, linger_release); in linger_put()
2814 linger_get(struct ceph_osd_linger_request *lreq) in linger_get() argument
2816 kref_get(&lreq->kref); in linger_get()
2817 return lreq; in linger_get()
2823 struct ceph_osd_linger_request *lreq; in linger_alloc() local
2825 lreq = kzalloc(sizeof(*lreq), GFP_NOIO); in linger_alloc()
2826 if (!lreq) in linger_alloc()
2829 kref_init(&lreq->kref); in linger_alloc()
2830 mutex_init(&lreq->lock); in linger_alloc()
2831 RB_CLEAR_NODE(&lreq->node); in linger_alloc()
2832 RB_CLEAR_NODE(&lreq->osdc_node); in linger_alloc()
2833 RB_CLEAR_NODE(&lreq->mc_node); in linger_alloc()
2834 INIT_LIST_HEAD(&lreq->scan_item); in linger_alloc()
2835 INIT_LIST_HEAD(&lreq->pending_lworks); in linger_alloc()
2836 init_completion(&lreq->reg_commit_wait); in linger_alloc()
2837 init_completion(&lreq->notify_finish_wait); in linger_alloc()
2839 lreq->osdc = osdc; in linger_alloc()
2840 target_init(&lreq->t); in linger_alloc()
2842 dout("%s lreq %p\n", __func__, lreq); in linger_alloc()
2843 return lreq; in linger_alloc()
2856 struct ceph_osd_linger_request *lreq) in DEFINE_RB_INSDEL_FUNCS()
2859 WARN_ON(!lreq->linger_id || lreq->osd); in DEFINE_RB_INSDEL_FUNCS()
2861 osd->o_osd, lreq, lreq->linger_id); in DEFINE_RB_INSDEL_FUNCS()
2869 insert_linger(&osd->o_linger_requests, lreq); in DEFINE_RB_INSDEL_FUNCS()
2870 lreq->osd = osd; in DEFINE_RB_INSDEL_FUNCS()
2874 struct ceph_osd_linger_request *lreq) in unlink_linger() argument
2877 WARN_ON(lreq->osd != osd); in unlink_linger()
2879 osd->o_osd, lreq, lreq->linger_id); in unlink_linger()
2881 lreq->osd = NULL; in unlink_linger()
2882 erase_linger(&osd->o_linger_requests, lreq); in unlink_linger()
2891 static bool __linger_registered(struct ceph_osd_linger_request *lreq) in __linger_registered() argument
2893 verify_osdc_locked(lreq->osdc); in __linger_registered()
2895 return !RB_EMPTY_NODE(&lreq->osdc_node); in __linger_registered()
2898 static bool linger_registered(struct ceph_osd_linger_request *lreq) in linger_registered() argument
2900 struct ceph_osd_client *osdc = lreq->osdc; in linger_registered()
2904 registered = __linger_registered(lreq); in linger_registered()
2910 static void linger_register(struct ceph_osd_linger_request *lreq) in linger_register() argument
2912 struct ceph_osd_client *osdc = lreq->osdc; in linger_register()
2915 WARN_ON(lreq->linger_id); in linger_register()
2917 linger_get(lreq); in linger_register()
2918 lreq->linger_id = ++osdc->last_linger_id; in linger_register()
2919 insert_linger_osdc(&osdc->linger_requests, lreq); in linger_register()
2922 static void linger_unregister(struct ceph_osd_linger_request *lreq) in linger_unregister() argument
2924 struct ceph_osd_client *osdc = lreq->osdc; in linger_unregister()
2928 erase_linger_osdc(&osdc->linger_requests, lreq); in linger_unregister()
2929 linger_put(lreq); in linger_unregister()
2934 struct ceph_osd_linger_request *lreq = req->r_priv; in cancel_linger_request() local
2938 linger_put(lreq); in cancel_linger_request()
2943 struct ceph_osd_linger_request *lreq; member
2962 static struct linger_work *lwork_alloc(struct ceph_osd_linger_request *lreq, in lwork_alloc() argument
2973 lwork->lreq = linger_get(lreq); in lwork_alloc()
2980 struct ceph_osd_linger_request *lreq = lwork->lreq; in lwork_free() local
2982 mutex_lock(&lreq->lock); in lwork_free()
2984 mutex_unlock(&lreq->lock); in lwork_free()
2986 linger_put(lreq); in lwork_free()
2992 struct ceph_osd_linger_request *lreq = lwork->lreq; in lwork_queue() local
2993 struct ceph_osd_client *osdc = lreq->osdc; in lwork_queue()
2995 verify_lreq_locked(lreq); in lwork_queue()
2999 list_add_tail(&lwork->pending_item, &lreq->pending_lworks); in lwork_queue()
3006 struct ceph_osd_linger_request *lreq = lwork->lreq; in do_watch_notify() local
3008 if (!linger_registered(lreq)) { in do_watch_notify()
3009 dout("%s lreq %p not registered\n", __func__, lreq); in do_watch_notify()
3013 WARN_ON(!lreq->is_watch); in do_watch_notify()
3015 __func__, lreq, lwork->notify.notify_id, lwork->notify.notifier_id, in do_watch_notify()
3017 lreq->wcb(lreq->data, lwork->notify.notify_id, lreq->linger_id, in do_watch_notify()
3029 struct ceph_osd_linger_request *lreq = lwork->lreq; in do_watch_error() local
3031 if (!linger_registered(lreq)) { in do_watch_error()
3032 dout("%s lreq %p not registered\n", __func__, lreq); in do_watch_error()
3036 dout("%s lreq %p err %d\n", __func__, lreq, lwork->error.err); in do_watch_error()
3037 lreq->errcb(lreq->data, lreq->linger_id, lwork->error.err); in do_watch_error()
3043 static void queue_watch_error(struct ceph_osd_linger_request *lreq) in queue_watch_error() argument
3047 lwork = lwork_alloc(lreq, do_watch_error); in queue_watch_error()
3053 lwork->error.err = lreq->last_error; in queue_watch_error()
3057 static void linger_reg_commit_complete(struct ceph_osd_linger_request *lreq, in linger_reg_commit_complete() argument
3060 if (!completion_done(&lreq->reg_commit_wait)) { in linger_reg_commit_complete()
3061 lreq->reg_commit_error = (result <= 0 ? result : 0); in linger_reg_commit_complete()
3062 complete_all(&lreq->reg_commit_wait); in linger_reg_commit_complete()
3068 struct ceph_osd_linger_request *lreq = req->r_priv; in linger_commit_cb() local
3070 mutex_lock(&lreq->lock); in linger_commit_cb()
3071 if (req != lreq->reg_req) { in linger_commit_cb()
3073 __func__, lreq, lreq->linger_id, req, lreq->reg_req); in linger_commit_cb()
3077 dout("%s lreq %p linger_id %llu result %d\n", __func__, lreq, in linger_commit_cb()
3078 lreq->linger_id, req->r_result); in linger_commit_cb()
3079 linger_reg_commit_complete(lreq, req->r_result); in linger_commit_cb()
3080 lreq->committed = true; in linger_commit_cb()
3082 if (!lreq->is_watch) { in linger_commit_cb()
3092 lreq->notify_id = ceph_decode_64(&p); in linger_commit_cb()
3093 dout("lreq %p notify_id %llu\n", lreq, in linger_commit_cb()
3094 lreq->notify_id); in linger_commit_cb()
3096 dout("lreq %p no notify_id\n", lreq); in linger_commit_cb()
3101 mutex_unlock(&lreq->lock); in linger_commit_cb()
3102 linger_put(lreq); in linger_commit_cb()
3120 struct ceph_osd_linger_request *lreq = req->r_priv; in linger_reconnect_cb() local
3122 mutex_lock(&lreq->lock); in linger_reconnect_cb()
3123 if (req != lreq->reg_req) { in linger_reconnect_cb()
3125 __func__, lreq, lreq->linger_id, req, lreq->reg_req); in linger_reconnect_cb()
3130 lreq, lreq->linger_id, req->r_result, lreq->last_error); in linger_reconnect_cb()
3132 if (!lreq->last_error) { in linger_reconnect_cb()
3133 lreq->last_error = normalize_watch_error(req->r_result); in linger_reconnect_cb()
3134 queue_watch_error(lreq); in linger_reconnect_cb()
3139 mutex_unlock(&lreq->lock); in linger_reconnect_cb()
3140 linger_put(lreq); in linger_reconnect_cb()
3143 static void send_linger(struct ceph_osd_linger_request *lreq) in send_linger() argument
3145 struct ceph_osd_client *osdc = lreq->osdc; in send_linger()
3150 mutex_lock(&lreq->lock); in send_linger()
3151 dout("%s lreq %p linger_id %llu\n", __func__, lreq, lreq->linger_id); in send_linger()
3153 if (lreq->reg_req) { in send_linger()
3154 if (lreq->reg_req->r_osd) in send_linger()
3155 cancel_linger_request(lreq->reg_req); in send_linger()
3156 ceph_osdc_put_request(lreq->reg_req); in send_linger()
3162 target_copy(&req->r_t, &lreq->t); in send_linger()
3163 req->r_mtime = lreq->mtime; in send_linger()
3165 if (lreq->is_watch && lreq->committed) { in send_linger()
3167 lreq->linger_id, ++lreq->register_gen); in send_linger()
3168 dout("lreq %p reconnect register_gen %u\n", lreq, in send_linger()
3172 if (lreq->is_watch) { in send_linger()
3174 lreq->linger_id, 0); in send_linger()
3176 lreq->notify_id = 0; in send_linger()
3178 refcount_inc(&lreq->request_pl->refcnt); in send_linger()
3179 osd_req_op_notify_init(req, 0, lreq->linger_id, in send_linger()
3180 lreq->request_pl); in send_linger()
3183 lreq->notify_id_pages, PAGE_SIZE, 0, false, false); in send_linger()
3185 dout("lreq %p register\n", lreq); in send_linger()
3192 req->r_priv = linger_get(lreq); in send_linger()
3194 lreq->reg_req = req; in send_linger()
3195 mutex_unlock(&lreq->lock); in send_linger()
3202 struct ceph_osd_linger_request *lreq = req->r_priv; in linger_ping_cb() local
3204 mutex_lock(&lreq->lock); in linger_ping_cb()
3205 if (req != lreq->ping_req) { in linger_ping_cb()
3207 __func__, lreq, lreq->linger_id, req, lreq->ping_req); in linger_ping_cb()
3212 __func__, lreq, lreq->linger_id, req->r_result, lreq->ping_sent, in linger_ping_cb()
3213 lreq->last_error); in linger_ping_cb()
3214 if (lreq->register_gen == req->r_ops[0].watch.gen) { in linger_ping_cb()
3216 lreq->watch_valid_thru = lreq->ping_sent; in linger_ping_cb()
3217 } else if (!lreq->last_error) { in linger_ping_cb()
3218 lreq->last_error = normalize_watch_error(req->r_result); in linger_ping_cb()
3219 queue_watch_error(lreq); in linger_ping_cb()
3222 dout("lreq %p register_gen %u ignoring old pong %u\n", lreq, in linger_ping_cb()
3223 lreq->register_gen, req->r_ops[0].watch.gen); in linger_ping_cb()
3227 mutex_unlock(&lreq->lock); in linger_ping_cb()
3228 linger_put(lreq); in linger_ping_cb()
3231 static void send_linger_ping(struct ceph_osd_linger_request *lreq) in send_linger_ping() argument
3233 struct ceph_osd_client *osdc = lreq->osdc; in send_linger_ping()
3242 lreq->ping_sent = jiffies; in send_linger_ping()
3244 __func__, lreq, lreq->linger_id, lreq->ping_sent, in send_linger_ping()
3245 lreq->register_gen); in send_linger_ping()
3247 if (lreq->ping_req) { in send_linger_ping()
3248 if (lreq->ping_req->r_osd) in send_linger_ping()
3249 cancel_linger_request(lreq->ping_req); in send_linger_ping()
3250 ceph_osdc_put_request(lreq->ping_req); in send_linger_ping()
3256 target_copy(&req->r_t, &lreq->t); in send_linger_ping()
3257 osd_req_op_watch_init(req, 0, CEPH_OSD_WATCH_OP_PING, lreq->linger_id, in send_linger_ping()
3258 lreq->register_gen); in send_linger_ping()
3264 req->r_priv = linger_get(lreq); in send_linger_ping()
3266 lreq->ping_req = req; in send_linger_ping()
3271 link_request(lreq->osd, req); in send_linger_ping()
3275 static void linger_submit(struct ceph_osd_linger_request *lreq) in linger_submit() argument
3277 struct ceph_osd_client *osdc = lreq->osdc; in linger_submit()
3281 linger_register(lreq); in linger_submit()
3283 calc_target(osdc, &lreq->t, false); in linger_submit()
3284 osd = lookup_create_osd(osdc, lreq->t.osd, true); in linger_submit()
3285 link_linger(osd, lreq); in linger_submit()
3287 send_linger(lreq); in linger_submit()
3291 static void cancel_linger_map_check(struct ceph_osd_linger_request *lreq) in cancel_linger_map_check() argument
3293 struct ceph_osd_client *osdc = lreq->osdc; in cancel_linger_map_check()
3299 lreq->linger_id); in cancel_linger_map_check()
3303 WARN_ON(lookup_lreq != lreq); in cancel_linger_map_check()
3304 erase_linger_mc(&osdc->linger_map_checks, lreq); in cancel_linger_map_check()
3305 linger_put(lreq); in cancel_linger_map_check()
3311 static void __linger_cancel(struct ceph_osd_linger_request *lreq) in __linger_cancel() argument
3313 if (lreq->ping_req && lreq->ping_req->r_osd) in __linger_cancel()
3314 cancel_linger_request(lreq->ping_req); in __linger_cancel()
3315 if (lreq->reg_req && lreq->reg_req->r_osd) in __linger_cancel()
3316 cancel_linger_request(lreq->reg_req); in __linger_cancel()
3317 cancel_linger_map_check(lreq); in __linger_cancel()
3318 unlink_linger(lreq->osd, lreq); in __linger_cancel()
3319 linger_unregister(lreq); in __linger_cancel()
3322 static void linger_cancel(struct ceph_osd_linger_request *lreq) in linger_cancel() argument
3324 struct ceph_osd_client *osdc = lreq->osdc; in linger_cancel()
3327 if (__linger_registered(lreq)) in linger_cancel()
3328 __linger_cancel(lreq); in linger_cancel()
3332 static void send_linger_map_check(struct ceph_osd_linger_request *lreq);
3334 static void check_linger_pool_dne(struct ceph_osd_linger_request *lreq) in check_linger_pool_dne() argument
3336 struct ceph_osd_client *osdc = lreq->osdc; in check_linger_pool_dne()
3342 if (lreq->register_gen) { in check_linger_pool_dne()
3343 lreq->map_dne_bound = map->epoch; in check_linger_pool_dne()
3345 lreq, lreq->linger_id); in check_linger_pool_dne()
3348 __func__, lreq, lreq->linger_id, lreq->map_dne_bound, in check_linger_pool_dne()
3352 if (lreq->map_dne_bound) { in check_linger_pool_dne()
3353 if (map->epoch >= lreq->map_dne_bound) { in check_linger_pool_dne()
3356 lreq->linger_id); in check_linger_pool_dne()
3357 linger_reg_commit_complete(lreq, -ENOENT); in check_linger_pool_dne()
3358 __linger_cancel(lreq); in check_linger_pool_dne()
3361 send_linger_map_check(lreq); in check_linger_pool_dne()
3368 struct ceph_osd_linger_request *lreq; in linger_map_check_cb() local
3374 lreq = lookup_linger_mc(&osdc->linger_map_checks, linger_id); in linger_map_check_cb()
3375 if (!lreq) { in linger_map_check_cb()
3381 __func__, lreq, lreq->linger_id, lreq->map_dne_bound, in linger_map_check_cb()
3383 if (!lreq->map_dne_bound) in linger_map_check_cb()
3384 lreq->map_dne_bound = greq->u.newest; in linger_map_check_cb()
3385 erase_linger_mc(&osdc->linger_map_checks, lreq); in linger_map_check_cb()
3386 check_linger_pool_dne(lreq); in linger_map_check_cb()
3388 linger_put(lreq); in linger_map_check_cb()
3393 static void send_linger_map_check(struct ceph_osd_linger_request *lreq) in send_linger_map_check() argument
3395 struct ceph_osd_client *osdc = lreq->osdc; in send_linger_map_check()
3402 lreq->linger_id); in send_linger_map_check()
3404 WARN_ON(lookup_lreq != lreq); in send_linger_map_check()
3408 linger_get(lreq); in send_linger_map_check()
3409 insert_linger_mc(&osdc->linger_map_checks, lreq); in send_linger_map_check()
3411 linger_map_check_cb, lreq->linger_id); in send_linger_map_check()
3415 static int linger_reg_commit_wait(struct ceph_osd_linger_request *lreq) in linger_reg_commit_wait() argument
3419 dout("%s lreq %p linger_id %llu\n", __func__, lreq, lreq->linger_id); in linger_reg_commit_wait()
3420 ret = wait_for_completion_killable(&lreq->reg_commit_wait); in linger_reg_commit_wait()
3421 return ret ?: lreq->reg_commit_error; in linger_reg_commit_wait()
3424 static int linger_notify_finish_wait(struct ceph_osd_linger_request *lreq, in linger_notify_finish_wait() argument
3429 dout("%s lreq %p linger_id %llu\n", __func__, lreq, lreq->linger_id); in linger_notify_finish_wait()
3430 left = wait_for_completion_killable_timeout(&lreq->notify_finish_wait, in linger_notify_finish_wait()
3435 left = lreq->notify_finish_error; /* completed */ in linger_notify_finish_wait()
3487 struct ceph_osd_linger_request *lreq = in handle_timeout() local
3491 lreq, lreq->linger_id, osd->o_osd); in handle_timeout()
3494 mutex_lock(&lreq->lock); in handle_timeout()
3495 if (lreq->is_watch && lreq->committed && !lreq->last_error) in handle_timeout()
3496 send_linger_ping(lreq); in handle_timeout()
3497 mutex_unlock(&lreq->lock); in handle_timeout()
3922 recalc_linger_target(struct ceph_osd_linger_request *lreq) in recalc_linger_target() argument
3924 struct ceph_osd_client *osdc = lreq->osdc; in recalc_linger_target()
3927 ct_res = calc_target(osdc, &lreq->t, true); in recalc_linger_target()
3931 osd = lookup_create_osd(osdc, lreq->t.osd, true); in recalc_linger_target()
3932 if (osd != lreq->osd) { in recalc_linger_target()
3933 unlink_linger(lreq->osd, lreq); in recalc_linger_target()
3934 link_linger(osd, lreq); in recalc_linger_target()
3956 struct ceph_osd_linger_request *lreq = in scan_requests() local
3962 dout("%s lreq %p linger_id %llu\n", __func__, lreq, in scan_requests()
3963 lreq->linger_id); in scan_requests()
3964 ct_res = recalc_linger_target(lreq); in scan_requests()
3969 pool_cleared_full(osdc, lreq->t.base_oloc.pool)); in scan_requests()
3975 cancel_linger_map_check(lreq); in scan_requests()
3981 if (list_empty(&lreq->scan_item)) in scan_requests()
3982 list_add_tail(&lreq->scan_item, need_resend_linger); in scan_requests()
3985 list_del_init(&lreq->scan_item); in scan_requests()
3986 check_linger_pool_dne(lreq); in scan_requests()
4098 struct ceph_osd_linger_request *lreq, *nlreq; in kick_requests() local
4136 list_for_each_entry_safe(lreq, nlreq, need_resend_linger, scan_item) { in kick_requests()
4137 if (!osd_homeless(lreq->osd)) in kick_requests()
4138 send_linger(lreq); in kick_requests()
4140 list_del_init(&lreq->scan_item); in kick_requests()
4284 struct ceph_osd_linger_request *lreq = in kick_osd_requests() local
4287 send_linger(lreq); in kick_osd_requests()
4578 struct ceph_osd_linger_request *lreq; in handle_watch_notify() local
4607 lreq = lookup_linger_osdc(&osdc->linger_requests, cookie); in handle_watch_notify()
4608 if (!lreq) { in handle_watch_notify()
4614 mutex_lock(&lreq->lock); in handle_watch_notify()
4616 opcode, cookie, lreq, lreq->is_watch); in handle_watch_notify()
4618 if (!lreq->last_error) { in handle_watch_notify()
4619 lreq->last_error = -ENOTCONN; in handle_watch_notify()
4620 queue_watch_error(lreq); in handle_watch_notify()
4622 } else if (!lreq->is_watch) { in handle_watch_notify()
4624 if (lreq->notify_id && lreq->notify_id != notify_id) { in handle_watch_notify()
4625 dout("lreq %p notify_id %llu != %llu, ignoring\n", lreq, in handle_watch_notify()
4626 lreq->notify_id, notify_id); in handle_watch_notify()
4627 } else if (!completion_done(&lreq->notify_finish_wait)) { in handle_watch_notify()
4632 if (lreq->preply_pages) { in handle_watch_notify()
4635 *lreq->preply_pages = data->pages; in handle_watch_notify()
4636 *lreq->preply_len = data->length; in handle_watch_notify()
4640 lreq->notify_finish_error = return_code; in handle_watch_notify()
4641 complete_all(&lreq->notify_finish_wait); in handle_watch_notify()
4645 lwork = lwork_alloc(lreq, do_watch_notify); in handle_watch_notify()
4660 mutex_unlock(&lreq->lock); in handle_watch_notify()
4785 struct ceph_osd_linger_request *lreq; in ceph_osdc_watch() local
4788 lreq = linger_alloc(osdc); in ceph_osdc_watch()
4789 if (!lreq) in ceph_osdc_watch()
4792 lreq->is_watch = true; in ceph_osdc_watch()
4793 lreq->wcb = wcb; in ceph_osdc_watch()
4794 lreq->errcb = errcb; in ceph_osdc_watch()
4795 lreq->data = data; in ceph_osdc_watch()
4796 lreq->watch_valid_thru = jiffies; in ceph_osdc_watch()
4798 ceph_oid_copy(&lreq->t.base_oid, oid); in ceph_osdc_watch()
4799 ceph_oloc_copy(&lreq->t.base_oloc, oloc); in ceph_osdc_watch()
4800 lreq->t.flags = CEPH_OSD_FLAG_WRITE; in ceph_osdc_watch()
4801 ktime_get_real_ts64(&lreq->mtime); in ceph_osdc_watch()
4803 linger_submit(lreq); in ceph_osdc_watch()
4804 ret = linger_reg_commit_wait(lreq); in ceph_osdc_watch()
4806 linger_cancel(lreq); in ceph_osdc_watch()
4810 return lreq; in ceph_osdc_watch()
4813 linger_put(lreq); in ceph_osdc_watch()
4826 struct ceph_osd_linger_request *lreq) in ceph_osdc_unwatch() argument
4836 ceph_oid_copy(&req->r_base_oid, &lreq->t.base_oid); in ceph_osdc_unwatch()
4837 ceph_oloc_copy(&req->r_base_oloc, &lreq->t.base_oloc); in ceph_osdc_unwatch()
4841 lreq->linger_id, 0); in ceph_osdc_unwatch()
4848 linger_cancel(lreq); in ceph_osdc_unwatch()
4849 linger_put(lreq); in ceph_osdc_unwatch()
4944 struct ceph_osd_linger_request *lreq; in ceph_osdc_notify() local
4953 lreq = linger_alloc(osdc); in ceph_osdc_notify()
4954 if (!lreq) in ceph_osdc_notify()
4957 lreq->request_pl = ceph_pagelist_alloc(GFP_NOIO); in ceph_osdc_notify()
4958 if (!lreq->request_pl) { in ceph_osdc_notify()
4963 ret = ceph_pagelist_encode_32(lreq->request_pl, 1); /* prot_ver */ in ceph_osdc_notify()
4964 ret |= ceph_pagelist_encode_32(lreq->request_pl, timeout); in ceph_osdc_notify()
4965 ret |= ceph_pagelist_encode_32(lreq->request_pl, payload_len); in ceph_osdc_notify()
4966 ret |= ceph_pagelist_append(lreq->request_pl, payload, payload_len); in ceph_osdc_notify()
4973 lreq->notify_id_pages = ceph_alloc_page_vector(1, GFP_NOIO); in ceph_osdc_notify()
4974 if (IS_ERR(lreq->notify_id_pages)) { in ceph_osdc_notify()
4975 ret = PTR_ERR(lreq->notify_id_pages); in ceph_osdc_notify()
4976 lreq->notify_id_pages = NULL; in ceph_osdc_notify()
4980 lreq->preply_pages = preply_pages; in ceph_osdc_notify()
4981 lreq->preply_len = preply_len; in ceph_osdc_notify()
4983 ceph_oid_copy(&lreq->t.base_oid, oid); in ceph_osdc_notify()
4984 ceph_oloc_copy(&lreq->t.base_oloc, oloc); in ceph_osdc_notify()
4985 lreq->t.flags = CEPH_OSD_FLAG_READ; in ceph_osdc_notify()
4987 linger_submit(lreq); in ceph_osdc_notify()
4988 ret = linger_reg_commit_wait(lreq); in ceph_osdc_notify()
4990 ret = linger_notify_finish_wait(lreq, in ceph_osdc_notify()
4993 dout("lreq %p failed to initiate notify %d\n", lreq, ret); in ceph_osdc_notify()
4995 linger_cancel(lreq); in ceph_osdc_notify()
4997 linger_put(lreq); in ceph_osdc_notify()
5008 struct ceph_osd_linger_request *lreq) in ceph_osdc_watch_check() argument
5014 mutex_lock(&lreq->lock); in ceph_osdc_watch_check()
5015 stamp = lreq->watch_valid_thru; in ceph_osdc_watch_check()
5016 if (!list_empty(&lreq->pending_lworks)) { in ceph_osdc_watch_check()
5018 list_first_entry(&lreq->pending_lworks, in ceph_osdc_watch_check()
5027 lreq, lreq->linger_id, age, lreq->last_error); in ceph_osdc_watch_check()
5029 ret = lreq->last_error ?: 1 + jiffies_to_msecs(age); in ceph_osdc_watch_check()
5031 mutex_unlock(&lreq->lock); in ceph_osdc_watch_check()