5 #define __STDC_FORMAT_MACROS
30 : timeout_s_((timeout_s == 0) ? 0 : (timeout_s + kTimeoutSafetyMarginSec))
73 void **fuse_channel_or_session,
74 bool fuse_notify_invalidation)
89 void **fuse_channel_or_session,
90 bool fuse_notify_invalidation)
92 , inode_tracker_(inode_tracker)
93 , dentry_tracker_(dentry_tracker)
94 , fuse_channel_or_session_(fuse_channel_or_session)
117 inval_inodes_command->
handle = handle;
118 channel_.PushBack(inval_inodes_command);
125 vector<Command *> *items =
channel_.StartEnqueueing();
126 for (
size_t i = 0; i < items->size(); ++i) {
128 if (!inval_dentry_command)
130 if (inval_dentry_command->
parent_ino != parent_ino)
132 if (inval_dentry_command->
name != name)
138 inval_dentry_command =
140 inval_dentry_command->
parent_ino = parent_ino;
141 inval_dentry_command->
name = name;
142 items->push_back(inval_dentry_command);
150 bool reported_missing_inval_support =
false;
154 if (dynamic_cast<QuitCommand *>(command)) {
162 if (inval_dentry_command) {
164 if (!reported_missing_inval_support) {
166 "missing fuse support for dentry invalidation "
170 reported_missing_inval_support =
true;
172 inval_dentry_command->~InvalDentryCommand();
173 free(inval_dentry_command);
179 #if CVMFS_USE_LIBFUSE == 2
180 fuse_lowlevel_notify_inval_entry(*reinterpret_cast<struct fuse_chan**>(
186 fuse_lowlevel_notify_inval_entry(*reinterpret_cast<struct fuse_session**>(
192 inval_dentry_command->~InvalDentryCommand();
193 free(inval_dentry_command);
199 assert(inval_inodes_command);
204 inval_inodes_command->~InvalInodesCommand();
205 free(inval_inodes_command);
215 if (atomic_read32(&invalidator->
terminated_) == 1) {
217 "cancel cache eviction due to termination");
241 inode = FUSE_ROOT_ID;
246 #if CVMFS_USE_LIBFUSE == 2
247 dbg_retval = fuse_lowlevel_notify_inval_inode(
248 *reinterpret_cast<struct fuse_chan**>(
251 dbg_retval = fuse_lowlevel_notify_inval_inode(
252 *reinterpret_cast<struct fuse_session**>(
256 "evicting inode %" PRIu64
" with retval: %d",
264 "cancel cache eviction after %u entries due to timeout", i);
267 if (atomic_read32(&invalidator->
terminated_) == 1) {
269 "cancel cache eviction due to termination");
280 uint64_t entry_parent;
284 #if CVMFS_USE_LIBFUSE == 2
285 int (*notify_func)(
struct fuse_chan*, fuse_ino_t,
const char*, size_t);
286 notify_func = &fuse_lowlevel_notify_inval_entry;
288 int (*notify_func)(
struct fuse_session*, fuse_ino_t,
const char*, size_t);
289 notify_func = &fuse_lowlevel_notify_inval_entry;
290 #if FUSE_VERSION >= FUSE_MAKE_VERSION(3, 16)
296 notify_func = &fuse_lowlevel_notify_expire_entry;
301 while (dentries_copy->
NextEntry(&dentry_cursor, &entry_parent, &entry_name))
304 entry_parent, entry_name.
c_str());
306 #if CVMFS_USE_LIBFUSE == 2
307 struct fuse_chan* channel_or_session =
308 *
reinterpret_cast<struct fuse_chan**
>(
311 struct fuse_session* channel_or_session =
312 *
reinterpret_cast<struct fuse_session**
>(
316 notify_func(channel_or_session, entry_parent, entry_name.
GetChars(),
320 if (atomic_read32(&invalidator->
terminated_) == 1) {
322 "cancel cache eviction due to termination");
328 delete dentries_copy;
Item At(const size_t index) const
glue::DentryTracker * dentry_tracker_
Channel< Command > channel_
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)
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_
std::string ToString() const
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
static void * MainInvalidator(void *data)
FuseInvalidator(MountPoint *mountpoint, void **fuse_channel_or_session, bool fuse_notify_invalidation)
CVMFS_EXPORT void LogCvmfs(const LogSource source, const int mask, const char *format,...)