summaryrefslogtreecommitdiffstats
path: root/src/client/Fh.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
commit483eb2f56657e8e7f419ab1a4fab8dce9ade8609 (patch)
treee5d88d25d870d5dedacb6bbdbe2a966086a0a5cf /src/client/Fh.h
parentInitial commit. (diff)
downloadceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.tar.xz
ceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.zip
Adding upstream version 14.2.21.upstream/14.2.21upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/client/Fh.h')
-rw-r--r--src/client/Fh.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/client/Fh.h b/src/client/Fh.h
new file mode 100644
index 00000000..6bc4d1a3
--- /dev/null
+++ b/src/client/Fh.h
@@ -0,0 +1,56 @@
+#ifndef CEPH_CLIENT_FH_H
+#define CEPH_CLIENT_FH_H
+
+#include "common/Readahead.h"
+#include "include/types.h"
+#include "InodeRef.h"
+#include "UserPerm.h"
+#include "mds/flock.h"
+
+class Cond;
+class Inode;
+
+// file handle for any open file state
+
+struct Fh {
+ InodeRef inode;
+ int _ref;
+ loff_t pos;
+ int mds; // have to talk to mds we opened with (for now)
+ int mode; // the mode i opened the file with
+
+ int flags;
+ bool pos_locked; // pos is currently in use
+ list<Cond*> pos_waiters; // waiters for pos
+
+ UserPerm actor_perms; // perms I opened the file with
+
+ Readahead readahead;
+
+ // file lock
+ std::unique_ptr<ceph_lock_state_t> fcntl_locks;
+ std::unique_ptr<ceph_lock_state_t> flock_locks;
+
+ // IO error encountered by any writeback on this Inode while
+ // this Fh existed (i.e. an fsync on another Fh will still show
+ // up as an async_err here because it could have been the same
+ // bytes we wrote via this Fh).
+ int async_err = {0};
+
+ int take_async_err()
+ {
+ int e = async_err;
+ async_err = 0;
+ return e;
+ }
+
+ Fh() = delete;
+ Fh(InodeRef in, int flags, int cmode, const UserPerm &perms);
+ ~Fh();
+
+ void get() { ++_ref; }
+ int put() { return --_ref; }
+};
+
+
+#endif