~ubuntu-branches/ubuntu/quantal/ceph/quantal

« back to all changes in this revision

Viewing changes to src/mds/snap.h

  • Committer: Bazaar Package Importer
  • Author(s): Clint Byrum, Clint Byrum, Micah Gersten
  • Date: 2011-02-12 22:50:26 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20110212225026-yyyw4tk0msgql3ul
Tags: 0.24.2-0ubuntu1
[ Clint Byrum <clint@ubuntu.com> ]
* New upstream release. (LP: #658670, LP: #684011)
* debian/patches/fix-mkcephfs.patch: dropped (applied upstream)
* Removed .la files from libceph1-dev, libcrush1-dev and 
  librados1-dev (per Debian policy v3.9.1 10.2).
* debian/control: adding pkg-config as a build dependency
* debian/control: depend on libcrypto++-dev instead of libssl-dev
* debian/watch: added watch file

[ Micah Gersten <micahg@ubuntu.com> ]
* debian/control: add Homepage

Show diffs side-by-side

added added

removed removed

Lines of Context:
93
93
  return out << l.ino << "@" << l.first;
94
94
}
95
95
 
96
 
struct SnapRealm {
97
 
  // realm state
 
96
// carry data about a specific version of a SnapRealm
 
97
struct sr_t {
98
98
  snapid_t seq;                     // basically, a version/seq # for changes to _this_ realm.
99
99
  snapid_t created;                 // when this realm was created.
100
100
  snapid_t last_created;            // last snap created in _this_ realm.
103
103
  map<snapid_t, SnapInfo> snaps;
104
104
  map<snapid_t, snaplink_t> past_parents;  // key is "last" (or NOSNAP)
105
105
 
 
106
  sr_t() :
 
107
    seq(0), created(0),
 
108
    last_created(0), last_destroyed(0),
 
109
    current_parent_since(1)
 
110
  {}
 
111
 
 
112
 
106
113
  void encode(bufferlist& bl) const {
107
114
    __u8 struct_v = 1;
108
115
    ::encode(struct_v, bl);
125
132
    ::decode(snaps, p);
126
133
    ::decode(past_parents, p);
127
134
  }
 
135
};
 
136
WRITE_CLASS_ENCODER(sr_t);
 
137
 
 
138
struct SnapRealm {
 
139
  // realm state
 
140
 
 
141
  sr_t srnode;
 
142
  void encode(bufferlist& bl) const {
 
143
    __u8 struct_v = 2;
 
144
    ::encode(struct_v, bl);
 
145
    ::encode(srnode, bl);
 
146
  }
 
147
  void decode(bufferlist::iterator& p) {
 
148
    __u8 struct_v;
 
149
    ::decode(struct_v, p);
 
150
    if (struct_v >= 2)
 
151
      ::decode(srnode, p);
 
152
    else {
 
153
      ::decode(srnode.seq, p);
 
154
      ::decode(srnode.created, p);
 
155
      ::decode(srnode.last_created, p);
 
156
      ::decode(srnode.last_destroyed, p);
 
157
      ::decode(srnode.current_parent_since, p);
 
158
      ::decode(srnode.snaps, p);
 
159
      ::decode(srnode.past_parents, p);
 
160
    }
 
161
  }
128
162
 
129
163
  // in-memory state
130
164
  MDCache *mdcache;
148
182
  map<client_t, xlist<Capability*> > client_caps;   // to identify clients who need snap notifications
149
183
 
150
184
  SnapRealm(MDCache *c, CInode *in) : 
151
 
    seq(0), created(0),
152
 
    last_created(0), last_destroyed(0),
153
 
    current_parent_since(1),
 
185
    srnode(),
154
186
    mdcache(c), inode(in),
155
187
    open(false), parent(0),
156
188
    inodes_with_caps(0) 
157
189
  { }
158
190
 
159
191
  bool exists(const string &name) {
160
 
    for (map<snapid_t,SnapInfo>::iterator p = snaps.begin();
161
 
         p != snaps.end();
 
192
    for (map<snapid_t,SnapInfo>::iterator p = srnode.snaps.begin();
 
193
         p != srnode.snaps.end();
162
194
         p++)
163
195
      if (p->second.name == name)
164
196
        return true;
176
208
  void add_open_past_parent(SnapRealm *parent);
177
209
  void close_parents();
178
210
 
179
 
  void project_past_parent(SnapRealm *newparent, bufferlist& snapbl);
180
 
  void add_past_parent(SnapRealm *oldparent);
181
211
  void prune_past_parents();
182
 
  bool has_past_parents() { return !past_parents.empty(); }
 
212
  bool has_past_parents() { return !srnode.past_parents.empty(); }
183
213
 
184
214
  void build_snap_set(set<snapid_t>& s, 
185
215
                      snapid_t& max_seq, snapid_t& max_last_created, snapid_t& max_last_destroyed,
218
248
    return cached_seq;
219
249
  }
220
250
 
 
251
  snapid_t get_snap_following(snapid_t follows) {
 
252
    check_cache();
 
253
    set<snapid_t> s = get_snaps();
 
254
    set<snapid_t>::iterator p = s.upper_bound(follows);
 
255
    if (p != s.end())
 
256
      return *p;
 
257
    return CEPH_NOSNAP;
 
258
  }
 
259
 
221
260
  void adjust_parent();
222
261
 
223
262
  void split_at(SnapRealm *child);
231
270
    if (client_caps[client].empty())
232
271
      client_caps.erase(client);
233
272
  }
 
273
 
234
274
};
235
275
WRITE_CLASS_ENCODER(SnapRealm)
236
276