5 #define __STDC_FORMAT_MACROS
30 : timeout_s_((timeout_s == 0) ? 0 : (timeout_s + kTimeoutSafetyMarginSec)) {
70 void **fuse_channel_or_session,
71 bool fuse_notify_invalidation)
84 void **fuse_channel_or_session,
85 bool fuse_notify_invalidation)
87 , inode_tracker_(inode_tracker)
88 , dentry_tracker_(dentry_tracker)
89 , fuse_channel_or_session_(fuse_channel_or_session)
111 inval_inodes_command->
handle = handle;
112 channel_.PushBack(inval_inodes_command);
118 vector<Command *> *items =
channel_.StartEnqueueing();
119 for (
size_t i = 0; i < items->size(); ++i) {
121 if (!inval_dentry_command)
123 if (inval_dentry_command->
parent_ino != parent_ino)
125 if (inval_dentry_command->
name != name)
133 inval_dentry_command->
parent_ino = parent_ino;
134 inval_dentry_command->
name = name;
135 items->push_back(inval_dentry_command);
143 bool reported_missing_inval_support =
false;
147 if (dynamic_cast<QuitCommand *>(command)) {
155 if (inval_dentry_command) {
157 if (!reported_missing_inval_support) {
159 "missing fuse support for dentry invalidation "
163 reported_missing_inval_support =
true;
165 inval_dentry_command->~InvalDentryCommand();
166 free(inval_dentry_command);
172 #if CVMFS_USE_LIBFUSE == 2
173 fuse_lowlevel_notify_inval_entry(
174 *reinterpret_cast<struct fuse_chan **>(
180 fuse_lowlevel_notify_inval_entry(
181 *reinterpret_cast<struct fuse_session **>(
187 inval_dentry_command->~InvalDentryCommand();
188 free(inval_dentry_command);
194 assert(inval_inodes_command);
199 inval_inodes_command->~InvalInodesCommand();
200 free(inval_inodes_command);
209 if (atomic_read32(&invalidator->
terminated_) == 1) {
211 "cancel cache eviction due to termination");
234 inode = FUSE_ROOT_ID;
239 #if CVMFS_USE_LIBFUSE == 2
240 dbg_retval = fuse_lowlevel_notify_inval_inode(
241 *reinterpret_cast<struct fuse_chan **>(
245 dbg_retval = fuse_lowlevel_notify_inval_inode(
246 *reinterpret_cast<struct fuse_session **>(
251 "evicting inode %" PRIu64
" with retval: %d", inode, dbg_retval);
258 "cancel cache eviction after %u entries due to timeout", i);
261 if (atomic_read32(&invalidator->
terminated_) == 1) {
263 "cancel cache eviction due to termination");
274 uint64_t entry_parent;
278 #if CVMFS_USE_LIBFUSE == 2
279 int (*notify_func)(
struct fuse_chan *, fuse_ino_t,
const char *, size_t);
280 notify_func = &fuse_lowlevel_notify_inval_entry;
282 int (*notify_func)(
struct fuse_session *, fuse_ino_t,
const char *, size_t);
283 notify_func = &fuse_lowlevel_notify_inval_entry;
284 #if FUSE_VERSION >= FUSE_MAKE_VERSION(3, 16)
290 notify_func = &fuse_lowlevel_notify_expire_entry;
296 dentries_copy->
NextEntry(&dentry_cursor, &entry_parent, &entry_name)) {
300 #if CVMFS_USE_LIBFUSE == 2
302 *channel_or_session = *
reinterpret_cast<struct fuse_chan **
>(
306 *channel_or_session = *
reinterpret_cast<struct fuse_session **
>(
310 notify_func(channel_or_session, entry_parent, entry_name.
GetChars(),
314 if (atomic_read32(&invalidator->
terminated_) == 1) {
316 "cancel cache eviction due to termination");
322 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,...)