ceph/src/librbd/WatchCtx.cc
Josh Durgin d3b5ee75b2 librbd: split into multiple files
This was long overdue. There's still a bunch of stuff in internal.cc
that should be moved elsewhere, but this is a good start.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2012-07-30 11:19:50 -07:00

37 lines
870 B
C++

// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
#include "common/ceph_context.h"
#include "common/dout.h"
#include "common/perf_counters.h"
#include "librbd/ImageCtx.h"
#include "librbd/internal.h"
#include "librbd/WatchCtx.h"
#define dout_subsys ceph_subsys_rbd
#undef dout_prefix
#define dout_prefix *_dout << "librbd::WatchCtx: "
namespace librbd {
void WatchCtx::invalidate()
{
Mutex::Locker l(lock);
valid = false;
}
void WatchCtx::notify(uint8_t opcode, uint64_t ver, bufferlist& bl)
{
Mutex::Locker l(lock);
ldout(ictx->cct, 1) << " got notification opcode=" << (int)opcode
<< " ver=" << ver << " cookie=" << cookie << dendl;
if (valid) {
Mutex::Locker lictx(ictx->refresh_lock);
++ictx->refresh_seq;
ictx->perfcounter->inc(l_librbd_notify);
}
}
}