blob: aad6343f8179fc9e62bd3cee8babcd3f8cc4c9c2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
#ifndef CEPH_CLIENT_DENTRY_H
#define CEPH_CLIENT_DENTRY_H
#include "include/lru.h"
#include "include/xlist.h"
#include "mds/mdstypes.h"
class Dir;
struct Inode;
class Dentry : public LRUObject {
public:
string name; // sort of lame
//const char *name;
Dir *dir;
Inode *inode;
int ref; // 1 if there's a dir beneath me.
uint64_t offset;
mds_rank_t lease_mds;
utime_t lease_ttl;
uint64_t lease_gen;
ceph_seq_t lease_seq;
int cap_shared_gen;
xlist<Dentry*>::item item_dentry_list;
/*
* ref==1 -> cached, unused
* ref >1 -> pinned in lru
*/
void get() {
assert(ref > 0);
if (++ref == 2)
lru_pin();
//cout << "dentry.get on " << this << " " << name << " now " << ref << std::endl;
}
void put() {
assert(ref > 0);
if (--ref == 1)
lru_unpin();
//cout << "dentry.put on " << this << " " << name << " now " << ref << std::endl;
if (ref == 0)
delete this;
}
void dump(Formatter *f) const;
Dentry() :
dir(0), inode(0), ref(1), offset(0),
lease_mds(-1), lease_gen(0), lease_seq(0), cap_shared_gen(0),
item_dentry_list(this) { }
private:
~Dentry() {
assert(ref == 0);
}
};
#endif
|