mirror of
https://github.com/ceph/ceph
synced 2024-12-18 01:16:55 +00:00
*** empty log message ***
git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@462 29311d96-e01e-0410-9327-a35deaab8ce9
This commit is contained in:
parent
5711b3a2b7
commit
176a49c609
@ -202,6 +202,9 @@ class CInode : LRUObject {
|
||||
// waiters
|
||||
multimap<int,Context*> waiting;
|
||||
|
||||
// issued client capabilities
|
||||
map<int, Capability> caps;
|
||||
|
||||
// open file state (me)
|
||||
map<fileh_t, CFile*> fh_map; // locally opened files
|
||||
int nrdonly, nrdwr, nwronly; // file mode counts
|
||||
@ -397,8 +400,18 @@ class CInode : LRUObject {
|
||||
void finish_waiting(int mask, int result = 0);
|
||||
|
||||
|
||||
// -- caps -- (new)
|
||||
bool is_caps_issued() { return !caps.empty(); }
|
||||
void add_cap(int client, Capability& cap) {
|
||||
assert(caps.count(client) == 0);
|
||||
caps[client] = cap;
|
||||
}
|
||||
void remove_cap(int client) {
|
||||
assert(caps.count(client) == 1);
|
||||
caps.erase(client);
|
||||
}
|
||||
|
||||
// -- open files --
|
||||
// -- open files -- (old)
|
||||
bool is_open_write() { return nwronly; }
|
||||
bool is_open_read() { return nrdonly; }
|
||||
bool is_open() { return is_open_write() || is_open_read(); }
|
||||
|
29
ceph/mds/Capability.h
Normal file
29
ceph/mds/Capability.h
Normal file
@ -0,0 +1,29 @@
|
||||
#ifndef __CAPABILITY_H
|
||||
#define __CAPABILITY_H
|
||||
|
||||
// definite caps
|
||||
#define CAP_FILE_RDCACHE 1
|
||||
#define CAP_FILE_RD 2
|
||||
#define CAP_FILE_WR 4
|
||||
#define CAP_FILE_WRBUFFER 8
|
||||
#define CAP_INODE_STAT 16
|
||||
|
||||
// heuristics
|
||||
#define CAP_FILE_DELAYFLUSH 32
|
||||
|
||||
class Capability {
|
||||
int wanted_caps; // what the client wants
|
||||
int pending_caps; // what we've sent them
|
||||
int confirmed_caps; // what they've confirmed they've received
|
||||
|
||||
Capability(int wants = 0) :
|
||||
wanted_caps(wants),
|
||||
pending_caps(0),
|
||||
confirmed_caps(0) { }
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user