1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 #ifndef CEPH_CLIENT_SNAPREALM_H
5 #define CEPH_CLIENT_SNAPREALM_H
7 #include "include/types.h"
8 #include "common/snap_types.h"
9 #include "include/xlist.h"
20 snapid_t parent_since;
21 vector<snapid_t> prior_parent_snaps; // snaps prior to parent_since
22 vector<snapid_t> my_snaps;
25 set<SnapRealm*> pchildren;
28 SnapContext cached_snap_context; // my_snaps + parent snaps + past_parent_snaps
29 friend ostream& operator<<(ostream& out, const SnapRealm& r);
32 xlist<Inode*> inodes_with_caps;
34 explicit SnapRealm(inodeno_t i) :
35 ino(i), nref(0), created(0), seq(0),
38 void build_snap_context();
39 void invalidate_cache() {
40 cached_snap_context.clear();
43 const SnapContext& get_snap_context() {
44 if (cached_snap_context.seq == 0)
46 return cached_snap_context;
49 void dump(Formatter *f) const;
52 inline ostream& operator<<(ostream& out, const SnapRealm& r) {
53 return out << "snaprealm(" << r.ino << " nref=" << r.nref << " c=" << r.created << " seq=" << r.seq
54 << " parent=" << r.parent
55 << " my_snaps=" << r.my_snaps
56 << " cached_snapc=" << r.cached_snap_context