]> git.proxmox.com Git - ceph.git/blame - ceph/src/client/Fh.h
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / client / Fh.h
CommitLineData
7c673cae
FG
1#ifndef CEPH_CLIENT_FH_H
2#define CEPH_CLIENT_FH_H
3
4#include "common/Readahead.h"
5#include "include/types.h"
6#include "InodeRef.h"
7#include "UserPerm.h"
8
9class Cond;
10class ceph_lock_state_t;
11class Inode;
12
13// file handle for any open file state
14
15struct Fh {
16 InodeRef inode;
17 int _ref;
18 loff_t pos;
19 int mds; // have to talk to mds we opened with (for now)
20 int mode; // the mode i opened the file with
21
22 int flags;
23 bool pos_locked; // pos is currently in use
24 list<Cond*> pos_waiters; // waiters for pos
25
26 UserPerm actor_perms; // perms I opened the file with
27
28 Readahead readahead;
29
30 // file lock
31 ceph_lock_state_t *fcntl_locks;
32 ceph_lock_state_t *flock_locks;
33
34 // IO error encountered by any writeback on this Inode while
35 // this Fh existed (i.e. an fsync on another Fh will still show
36 // up as an async_err here because it could have been the same
37 // bytes we wrote via this Fh).
38 int async_err = {0};
39
40 int take_async_err()
41 {
42 int e = async_err;
43 async_err = 0;
44 return e;
45 }
46
47 Fh(Inode *in);
48 ~Fh();
49 void get() { ++_ref; }
50 int put() { return --_ref; }
51};
52
53
54#endif