CernVM-FS  2.9.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 "atomic.h"
12 #include "bigvector.h"
13 #include "duplex_fuse.h"
14 #include "gtest/gtest_prod.h"
15 #include "shortstring.h"
16 #include "util/single_copy.h"
17 
18 namespace glue {
19 class InodeTracker;
20 class NentryTracker;
21 }
22 
33  FRIEND_TEST(T_FuseInvalidator, StartStop);
34  FRIEND_TEST(T_FuseInvalidator, InvalidateTimeout);
35  FRIEND_TEST(T_FuseInvalidator, InvalidateOps);
36 
37  public:
38  static bool HasFuseNotifyInval();
39 
47  class Handle : SingleCopy {
48  friend class FuseInvalidator;
49 
50  public:
51  explicit Handle(unsigned timeout_s);
52  ~Handle();
53  bool IsDone() const { return atomic_read32(status_) == 1; }
54  void Reset() { atomic_write32(status_, 0); }
55  void WaitFor();
56 
57  private:
58  void SetDone() { atomic_cas32(status_, 0, 1); }
59 
60  unsigned timeout_s_;
62  };
63 
64  FuseInvalidator(glue::InodeTracker *inode_tracker,
65  glue::NentryTracker *nentry_tracker,
66  void **fuse_channel_or_session,
67  bool fuse_notify_invalidation);
69  void Spawn();
70  void InvalidateInodes(Handle *handle);
71 
72  private:
76  static const unsigned kTimeoutSafetyMarginSec; // = 1;
80  static const unsigned kCheckTimeoutFreqMs; // = 100;
85  static const unsigned kCheckTimeoutFreqOps; // = 256
86 
87  static void *MainInvalidator(void *data);
88 
95  bool spawned_;
96  int pipe_ctrl_[2];
104 
106 }; // class FuseInvalidator
107 
108 #endif // CVMFS_FUSE_EVICT_H_
bool IsDone() const
Definition: fuse_evict.h:53
atomic_int32 terminated_
Definition: fuse_evict.h:102
static const unsigned kCheckTimeoutFreqMs
Definition: fuse_evict.h:80
FuseInvalidator(glue::InodeTracker *inode_tracker, glue::NentryTracker *nentry_tracker, void **fuse_channel_or_session, bool fuse_notify_invalidation)
Definition: fuse_evict.cc:68
static bool HasFuseNotifyInval()
Definition: fuse_evict.cc:53
static const unsigned kTimeoutSafetyMarginSec
Definition: fuse_evict.h:76
int32_t atomic_int32
Definition: atomic.h:17
glue::NentryTracker * nentry_tracker_
Definition: fuse_evict.h:90
static const unsigned kCheckTimeoutFreqOps
Definition: fuse_evict.h:85
BigVector< uint64_t > evict_list_
Definition: fuse_evict.h:103
void ** fuse_channel_or_session_
Definition: fuse_evict.h:94
atomic_int32 * status_
Definition: fuse_evict.h:61
Handle(unsigned timeout_s)
Definition: fuse_evict.cc:26
FRIEND_TEST(T_FuseInvalidator, StartStop)
glue::InodeTracker * inode_tracker_
Definition: fuse_evict.h:89
static bool g_fuse_notify_invalidation_
Definition: fuse_evict.h:105
int pipe_ctrl_[2]
Definition: fuse_evict.h:96
void InvalidateInodes(Handle *handle)
Definition: fuse_evict.cc:96
pthread_t thread_invalidator_
Definition: fuse_evict.h:97
static void * MainInvalidator(void *data)
Definition: fuse_evict.cc:104