WatchNotifyInfo *wc = new WatchNotifyInfo(this, oid);
wc->watch_ctx = ctx;
wc->watch_ctx2 = ctx2;
- wc->linger_op = objecter->linger_register(oid, oloc, 0);
- client->register_watch_notify_callback(wc, cookie);
+ wc->linger_op = objecter->linger_register(oid, oloc, 0, cookie);
+ client->register_watch_notify_callback(wc, *cookie);
prepare_assert_ops(&wr);
wr.watch(*cookie, CEPH_OSD_WATCH_OP_WATCH);
bufferlist bl;
// Acquire cookie
uint64_t cookie;
- wc->linger_op = objecter->linger_register(oid, oloc, 0);
- client->register_watch_notify_callback(wc, &cookie);
+ wc->linger_op = objecter->linger_register(oid, oloc, 0, &cookie);
+ client->register_watch_notify_callback(wc, cookie);
uint32_t prot_ver = 1;
uint32_t timeout = notify_timeout;
if (timeout_ms)
timer(cct, lock),
refcnt(1),
log_last_version(0), log_cb(NULL), log_cb_arg(NULL),
- finisher(cct),
- max_watch_notify_cookie(0)
+ finisher(cct)
{
}
void librados::RadosClient::register_watch_notify_callback(
WatchNotifyInfo *wc,
- uint64_t *cookie)
+ uint64_t cookie)
{
assert(lock.is_locked_by_me());
- wc->cookie = *cookie = ++max_watch_notify_cookie;
+ wc->cookie = cookie;
ldout(cct,10) << __func__ << " cookie " << wc->cookie << dendl;
watch_notify_info[wc->cookie] = wc;
}
int pool_delete_async(const char *name, PoolAsyncCompletionImpl *c);
// watch/notify
- uint64_t max_watch_notify_cookie;
map<uint64_t, librados::WatchNotifyInfo *> watch_notify_info;
void register_watch_notify_callback(librados::WatchNotifyInfo *wc,
- uint64_t *cookie);
+ uint64_t cookie);
int unregister_watch_notify_callback(uint64_t cookie, object_t *poid);
int watch_check(uint64_t cookie);
void handle_watch_notify(MWatchNotify *m);
Objecter::LingerOp *Objecter::linger_register(const object_t& oid,
const object_locator_t& oloc,
- int flags)
+ int flags,
+ uint64_t *cookie)
{
LingerOp *info = new LingerOp;
info->target.base_oid = oid;
// Acquire linger ID
info->linger_id = ++max_linger_id;
+ *cookie = info->linger_id;
ldout(cct, 10) << __func__ << " info " << info
<< " linger_id " << info->linger_id << dendl;
linger_ops[info->linger_id] = info;
// caller owns a ref
LingerOp *linger_register(const object_t& oid, const object_locator_t& oloc,
- int flags);
+ int flags, uint64_t *pcookie);
ceph_tid_t linger_watch(LingerOp *info,
ObjectOperation& op,
const SnapContext& snapc, utime_t mtime,