CernVM-FS  2.12.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
fuse_evict.h
Go to the documentation of this file.
1 
5 #ifndef CVMFS_FUSE_EVICT_H_
6 #define CVMFS_FUSE_EVICT_H_
7 
8 #include <pthread.h>
9 #include <stdint.h>
10 
11 #include "bigvector.h"
12 #include "duplex_fuse.h"
13 #include "gtest/gtest_prod.h"
14 #include "shortstring.h"
15 #include "util/atomic.h"
16 #include "util/single_copy.h"
17 
18 namespace glue {
19 class InodeTracker;
20 class DentryTracker;
21 }
22 
23 class MountPoint;
24 
35  friend class T_FuseInvalidator; // for T_FuseInvalidator.SetUp()
36  FRIEND_TEST(T_FuseInvalidator, StartStop);
37  FRIEND_TEST(T_FuseInvalidator, InvalidateTimeout);
38  FRIEND_TEST(T_FuseInvalidator, InvalidateOps);
39 
40  public:
41  static bool HasFuseNotifyInval();
42 
50  class Handle : SingleCopy {
51  friend class FuseInvalidator;
52 
53  public:
54  explicit Handle(unsigned timeout_s);
55  ~Handle();
56  bool IsDone() const { return atomic_read32(status_) == 1; }
57  void Reset() { atomic_write32(status_, 0); }
58  void WaitFor();
59 
60  private:
61  void SetDone() { atomic_cas32(status_, 0, 1); }
62 
63  unsigned timeout_s_;
65  };
66 
67  FuseInvalidator(MountPoint *mountpoint,
68  void **fuse_channel_or_session,
69  bool fuse_notify_invalidation);
71  void Spawn();
72  void InvalidateInodes(Handle *handle);
73 
74  void InvalidateDentry(uint64_t parent_ino, const NameString &name);
75 
76  private:
81  FuseInvalidator(glue::InodeTracker *inode_tracker,
82  glue::DentryTracker *dentry_tracker,
83  void **fuse_channel_or_session,
84  bool fuse_notify_invalidation);
88  static const unsigned kTimeoutSafetyMarginSec; // = 1;
92  static const unsigned kCheckTimeoutFreqMs; // = 100;
97  static const unsigned kCheckTimeoutFreqOps; // = 256
98 
99  static void *MainInvalidator(void *data);
100 
102 
109  bool spawned_;
110  int pipe_ctrl_[2];
118 
120 }; // class FuseInvalidator
121 
122 #endif // CVMFS_FUSE_EVICT_H_
bool IsDone() const
Definition: fuse_evict.h:56
atomic_int32 terminated_
Definition: fuse_evict.h:116
glue::DentryTracker * dentry_tracker_
Definition: fuse_evict.h:104
friend class T_FuseInvalidator
Definition: fuse_evict.h:35
static const unsigned kCheckTimeoutFreqMs
Definition: fuse_evict.h:92
static bool HasFuseNotifyInval()
Definition: fuse_evict.cc:54
static const unsigned kTimeoutSafetyMarginSec
Definition: fuse_evict.h:88
int32_t atomic_int32
Definition: atomic.h:17
static const unsigned kCheckTimeoutFreqOps
Definition: fuse_evict.h:97
BigVector< uint64_t > evict_list_
Definition: fuse_evict.h:117
void ** fuse_channel_or_session_
Definition: fuse_evict.h:108
atomic_int32 * status_
Definition: fuse_evict.h:64
Handle(unsigned timeout_s)
Definition: fuse_evict.cc:27
FRIEND_TEST(T_FuseInvalidator, StartStop)
MountPoint * mount_point_
Definition: fuse_evict.h:101
void InvalidateDentry(uint64_t parent_ino, const NameString &name)
Definition: fuse_evict.cc:121
glue::InodeTracker * inode_tracker_
Definition: fuse_evict.h:103
static bool g_fuse_notify_invalidation_
Definition: fuse_evict.h:119
int pipe_ctrl_[2]
Definition: fuse_evict.h:110
void InvalidateInodes(Handle *handle)
Definition: fuse_evict.cc:114
pthread_t thread_invalidator_
Definition: fuse_evict.h:111
static void * MainInvalidator(void *data)
Definition: fuse_evict.cc:132
FuseInvalidator(MountPoint *mountpoint, void **fuse_channel_or_session, bool fuse_notify_invalidation)
Definition: fuse_evict.cc:69