diff --git a/ceph/mds/CInode.h b/ceph/mds/CInode.h index fe9500117a4..b2fe4d3f065 100644 --- a/ceph/mds/CInode.h +++ b/ceph/mds/CInode.h @@ -202,6 +202,9 @@ class CInode : LRUObject { // waiters multimap waiting; + // issued client capabilities + map caps; + // open file state (me) map 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(); } diff --git a/ceph/mds/Capability.h b/ceph/mds/Capability.h new file mode 100644 index 00000000000..a05aa25abfd --- /dev/null +++ b/ceph/mds/Capability.h @@ -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