5 #define __STDC_FORMAT_MACROS
7 #include "cvmfs_config.h"
28 : timeout_s_((timeout_s == 0) ? 0 : (timeout_s + kTimeoutSafetyMarginSec))
71 void **fuse_channel_or_session,
72 bool fuse_notify_invalidation)
88 void **fuse_channel_or_session,
89 bool fuse_notify_invalidation)
91 , inode_tracker_(inode_tracker)
92 , dentry_tracker_(dentry_tracker)
93 , fuse_channel_or_session_(fuse_channel_or_session)
136 bool reported_missing_inval_support =
false;
149 char *name =
static_cast<char *
>(smalloc(len + 1));
153 if (!reported_missing_inval_support) {
155 "missing fuse support for dentry invalidation (%d/%s)",
157 reported_missing_inval_support =
true;
164 #if CVMFS_USE_LIBFUSE == 2
165 fuse_lowlevel_notify_inval_entry(*reinterpret_cast<struct fuse_chan**>(
168 fuse_lowlevel_notify_inval_entry(*reinterpret_cast<struct fuse_session**>(
188 if (atomic_read32(&invalidator->
terminated_) == 1) {
190 "cancel cache eviction due to termination");
214 inode = FUSE_ROOT_ID;
219 #if CVMFS_USE_LIBFUSE == 2
220 dbg_retval = fuse_lowlevel_notify_inval_inode(
221 *reinterpret_cast<struct fuse_chan**>(
224 dbg_retval = fuse_lowlevel_notify_inval_inode(
225 *reinterpret_cast<struct fuse_session**>(
229 "evicting inode %" PRIu64
" with retval: %d",
237 "cancel cache eviction after %u entries due to timeout", i);
240 if (atomic_read32(&invalidator->
terminated_) == 1) {
242 "cancel cache eviction due to termination");
253 uint64_t entry_parent;
257 #if CVMFS_USE_LIBFUSE == 2
258 int (*notify_func)(
struct fuse_chan*, fuse_ino_t,
const char*, size_t);
259 notify_func = &fuse_lowlevel_notify_inval_entry;
261 int (*notify_func)(
struct fuse_session*, fuse_ino_t,
const char*, size_t);
262 notify_func = &fuse_lowlevel_notify_inval_entry;
263 #if FUSE_VERSION >= FUSE_MAKE_VERSION(3, 16)
269 notify_func = &fuse_lowlevel_notify_expire_entry;
274 while (dentries_copy->
NextEntry(&dentry_cursor, &entry_parent, &entry_name))
277 entry_parent, entry_name.
c_str());
279 #if CVMFS_USE_LIBFUSE == 2
280 struct fuse_chan* channel_or_session =
281 *
reinterpret_cast<struct fuse_chan**
>(
284 struct fuse_session* channel_or_session =
285 *
reinterpret_cast<struct fuse_session**
>(
289 notify_func(channel_or_session, entry_parent, entry_name.
GetChars(),
293 if (atomic_read32(&invalidator->
terminated_) == 1) {
295 "cancel cache eviction due to termination");
301 delete dentries_copy;
#define LogCvmfs(source, mask,...)
Item At(const size_t index) const
glue::DentryTracker * dentry_tracker_
assert((mem||(size==0))&&"Out Of Memory")
MountPoint * mount_point_
static const unsigned kCheckTimeoutFreqMs
bool NextEntry(Cursor *cursor, uint64_t *inode_parent, NameString *name)
void EndEnumerate(Cursor *cursor)
void MakePipe(int pipe_fd[2])
static bool HasFuseNotifyInval()
static const unsigned kTimeoutSafetyMarginSec
void EndEnumerate(Cursor *cursor)
static const unsigned kCheckTimeoutFreqOps
BigVector< uint64_t > evict_list_
void ** fuse_channel_or_session_
bool NextInode(Cursor *cursor, uint64_t *inode)
Handle(unsigned timeout_s)
MountPoint * mount_point_
void InvalidateDentry(uint64_t parent_ino, const NameString &name)
void PushBack(const Item &item)
glue::InodeTracker * inode_tracker_
static bool g_fuse_notify_invalidation_
void InvalidateInodes(Handle *handle)
pthread_t thread_invalidator_
void SafeSleepMs(const unsigned ms)
unsigned GetLength() const
const char * c_str() const
const char * GetChars() const
void WritePipe(int fd, const void *buf, size_t nbyte)
void ReadPipe(int fd, void *buf, size_t nbyte)
void ClosePipe(int pipe_fd[2])
static void * MainInvalidator(void *data)
FuseInvalidator(MountPoint *mountpoint, void **fuse_channel_or_session, bool fuse_notify_invalidation)