CernVM-FS  2.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FuseInvalidator Class Reference

#include <fuse_evict.h>

Inheritance diagram for FuseInvalidator:
Collaboration diagram for FuseInvalidator:

Classes

class  Handle
 

Public Member Functions

 FuseInvalidator (glue::InodeTracker *inode_tracker, glue::NentryTracker *nentry_tracker, void **fuse_channel_or_session, bool fuse_notify_invalidation)
 
 ~FuseInvalidator ()
 
void Spawn ()
 
void InvalidateInodes (Handle *handle)
 

Static Public Member Functions

static bool HasFuseNotifyInval ()
 

Private Member Functions

 FRIEND_TEST (T_FuseInvalidator, StartStop)
 
 FRIEND_TEST (T_FuseInvalidator, InvalidateTimeout)
 
 FRIEND_TEST (T_FuseInvalidator, InvalidateOps)
 
- Private Member Functions inherited from SingleCopy
 SingleCopy ()
 

Static Private Member Functions

static void * MainInvalidator (void *data)
 

Private Attributes

glue::InodeTrackerinode_tracker_
 
glue::NentryTrackernentry_tracker_
 
void ** fuse_channel_or_session_
 
bool spawned_
 
int pipe_ctrl_ [2]
 
pthread_t thread_invalidator_
 
atomic_int32 terminated_
 
BigVector< uint64_t > evict_list_
 

Static Private Attributes

static const unsigned kTimeoutSafetyMarginSec = 1
 
static const unsigned kCheckTimeoutFreqMs = 100
 
static const unsigned kCheckTimeoutFreqOps = 256
 
static bool g_fuse_notify_invalidation_ = true
 

Detailed Description

This class can poke all known dentries out of the kernel caches. This allows for faster remount/reload of the fuse module because caches don't need to drain out by timeout. If the fuse library doesn't provide fuse_lowlevel_notify_inval_entry, it falls back to waiting for drainout.

Evicting entries from the cache must be done from a separate thread to avoid a deadlock in the fuse callbacks (see Fuse documenatation).

Definition at line 32 of file fuse_evict.h.

Constructor & Destructor Documentation

FuseInvalidator::FuseInvalidator ( glue::InodeTracker inode_tracker,
glue::NentryTracker nentry_tracker,
void **  fuse_channel_or_session,
bool  fuse_notify_invalidation 
)

Definition at line 68 of file fuse_evict.cc.

Here is the call graph for this function:

FuseInvalidator::~FuseInvalidator ( )

Definition at line 85 of file fuse_evict.cc.

Here is the call graph for this function:

Member Function Documentation

FuseInvalidator::FRIEND_TEST ( T_FuseInvalidator  ,
StartStop   
)
private
FuseInvalidator::FRIEND_TEST ( T_FuseInvalidator  ,
InvalidateTimeout   
)
private
FuseInvalidator::FRIEND_TEST ( T_FuseInvalidator  ,
InvalidateOps   
)
private
bool FuseInvalidator::HasFuseNotifyInval ( )
static

Technically, also libfuse 2.8 has support. Libfuse 2.8 comes with EL6, which had bugs reported related to the fuse_notify_inval_...() functions. Since just waiting for the timeout works perfectly fine, there is no reason to optimize for forced cache eviction too aggressively.

TODO(jblomer): could we have libfuse 2.9 or higher with a very old kernel that doesn't support active invalidation? How old does the kernel need to be? Probably that situation is never triggered in practice.

Definition at line 53 of file fuse_evict.cc.

Referenced by MainInvalidator(), and MaintenanceMode().

Here is the caller graph for this function:

void FuseInvalidator::InvalidateInodes ( Handle handle)

Definition at line 96 of file fuse_evict.cc.

Here is the call graph for this function:

void * FuseInvalidator::MainInvalidator ( void *  data)
staticprivate

Definition at line 104 of file fuse_evict.cc.

Referenced by Spawn().

Here is the call graph for this function:

Here is the caller graph for this function:

void FuseInvalidator::Spawn ( )

Definition at line 219 of file fuse_evict.cc.

Referenced by FuseRemounter::Spawn().

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

BigVector<uint64_t> FuseInvalidator::evict_list_
private

Definition at line 103 of file fuse_evict.h.

Referenced by MainInvalidator().

void** FuseInvalidator::fuse_channel_or_session_
private

libfuse2 uses struct fuse_chan, libfuse3 uses struct fuse_session

Definition at line 94 of file fuse_evict.h.

Referenced by MainInvalidator().

bool FuseInvalidator::g_fuse_notify_invalidation_ = true
staticprivate

Definition at line 105 of file fuse_evict.h.

Referenced by FuseInvalidator(), and HasFuseNotifyInval().

glue::InodeTracker* FuseInvalidator::inode_tracker_
private

Definition at line 89 of file fuse_evict.h.

Referenced by MainInvalidator().

const unsigned FuseInvalidator::kCheckTimeoutFreqMs = 100
staticprivate

If caches are drained out by timeout, set a polling interval.

Definition at line 80 of file fuse_evict.h.

Referenced by MainInvalidator(), and FuseInvalidator::Handle::WaitFor().

const unsigned FuseInvalidator::kCheckTimeoutFreqOps = 256
staticprivate

If caches are actively drained out, check every so many operations if the caches are anyway drained out by timeout.

Definition at line 85 of file fuse_evict.h.

Referenced by MainInvalidator().

const unsigned FuseInvalidator::kTimeoutSafetyMarginSec = 1
staticprivate

Add one second to the caller-provided timeout to be on the safe side.

Definition at line 76 of file fuse_evict.h.

glue::NentryTracker* FuseInvalidator::nentry_tracker_
private

Definition at line 90 of file fuse_evict.h.

Referenced by MainInvalidator().

int FuseInvalidator::pipe_ctrl_[2]
private

Definition at line 96 of file fuse_evict.h.

Referenced by FuseInvalidator(), InvalidateInodes(), MainInvalidator(), and ~FuseInvalidator().

bool FuseInvalidator::spawned_
private

Definition at line 95 of file fuse_evict.h.

Referenced by Spawn(), and ~FuseInvalidator().

atomic_int32 FuseInvalidator::terminated_
private

An invalidation run can take some time. Allow for early cancelation if thread should be shut down.

Definition at line 102 of file fuse_evict.h.

Referenced by FuseInvalidator(), MainInvalidator(), and ~FuseInvalidator().

pthread_t FuseInvalidator::thread_invalidator_
private

Definition at line 97 of file fuse_evict.h.

Referenced by FuseInvalidator(), Spawn(), and ~FuseInvalidator().


The documentation for this class was generated from the following files: