mirror of
https://github.com/ceph/ceph
synced 2025-02-07 10:53:30 +00:00
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>
37 lines
870 B
C++
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);
|
|
}
|
|
}
|
|
}
|