Skip to content

Commit

Permalink
mount: Upgrade to new directory cache
Browse files Browse the repository at this point in the history
This commit replaces old directory cache with new one
based on class DirEntryCache.

Change-Id: I71dd4bb6ecc5a35622c0159aba17973f4aef5ffb
  • Loading branch information
DarkHaze committed Apr 21, 2017
1 parent b0ce24c commit f68e389
Show file tree
Hide file tree
Showing 17 changed files with 144 additions and 494 deletions.
5 changes: 5 additions & 0 deletions src/master/filesystem_operations.cc
Expand Up @@ -1682,6 +1682,11 @@ uint8_t fs_readdir(const FsContext &context, uint32_t inode, uint64_t first_entr
return status;
}

uint32_t ts = eventloop_time();
ChecksumUpdater cu(ts);

fs_update_atime(dir, ts);

fsnodes_getdir(context.rootinode(),
context.uid(), context.gid(), context.auid(), context.agid(), context.sesflags(),
static_cast<FSNodeDirectory*>(dir),
Expand Down
2 changes: 1 addition & 1 deletion src/mount/CMakeLists.txt
Expand Up @@ -3,7 +3,7 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR})
collect_sources(MOUNT)

add_library(mount ${MOUNT_SOURCES})
target_link_libraries(mount mfscommon ${ADDITIONAL_LIBS})
target_link_libraries(mount mfscommon ${ADDITIONAL_LIBS} ${Boost_THREAD_LIBRARY})
if(MINGW)
target_link_libraries(mount ${MINGW_MSVCRT})
endif()
Expand Down
262 changes: 0 additions & 262 deletions src/mount/dirattrcache.cc

This file was deleted.

47 changes: 0 additions & 47 deletions src/mount/dirattrcache.h

This file was deleted.

6 changes: 6 additions & 0 deletions src/mount/fuse/main.cc
Expand Up @@ -341,6 +341,7 @@ int mainloop(struct fuse_args *args,const char* mp,int mt,int fg) {
gMountOptions.debug,
gMountOptions.keepcache,
gMountOptions.direntrycacheto,
gMountOptions.direntrycachesize,
gMountOptions.entrycacheto,
gMountOptions.attrcacheto,
gMountOptions.mkdircopysgid,
Expand Down Expand Up @@ -685,6 +686,11 @@ int main(int argc, char *argv[]) try {
gMountOptions.aclcachesize);
gMountOptions.aclcachesize = 1000 * 1000;
}
if (gMountOptions.direntrycachesize > 10000000) {
fprintf(stderr,"directory entry cache size too big (%u) - decreased to 10000000\n",
gMountOptions.direntrycachesize);
gMountOptions.direntrycachesize = 10000000;
}

make_fsname(&args);

Expand Down
16 changes: 9 additions & 7 deletions src/mount/fuse/mfs_fuse.cc
Expand Up @@ -304,7 +304,7 @@ void mfs_opendir(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi) {
try {
LizardClient::opendir(get_context(req), ino, fuse_file_info_wrapper(fi));
if (fuse_reply_open(req, fi) == -ENOENT) {
LizardClient::remove_dir_info(fuse_file_info_wrapper(fi));
assert(fi->fh == 0);
}
} catch (LizardClient::RequestException& e) {
fuse_reply_err(req, e.errNo);
Expand Down Expand Up @@ -504,12 +504,14 @@ void mfs_removexattr (fuse_req_t req, fuse_ino_t ino, const char *name) {
}

void mfs_init(int debug_mode_, int keep_cache_, double direntry_cache_timeout_,
double entry_cache_timeout_, double attr_cache_timeout_, int mkdir_copy_sgid_,
SugidClearMode sugid_clear_mode_, bool acl_enabled_, double acl_cache_timeout_,
unsigned acl_cache_size_, bool use_rwlock_) {
LizardClient::init(debug_mode_, keep_cache_, direntry_cache_timeout_, entry_cache_timeout_,
attr_cache_timeout_, mkdir_copy_sgid_, sugid_clear_mode_, acl_enabled_, use_rwlock_,
acl_cache_timeout_, acl_cache_size_);
unsigned direntry_cache_size_, double entry_cache_timeout_,
double attr_cache_timeout_, int mkdir_copy_sgid_, SugidClearMode sugid_clear_mode_,
bool acl_enabled_, double acl_cache_timeout_, unsigned acl_cache_size_,
bool use_rwlock_) {
LizardClient::init(debug_mode_, keep_cache_, direntry_cache_timeout_, direntry_cache_size_,
entry_cache_timeout_, attr_cache_timeout_, mkdir_copy_sgid_,
sugid_clear_mode_, acl_enabled_, use_rwlock_, acl_cache_timeout_,
acl_cache_size_);
}

#if FUSE_VERSION >= 26
Expand Down
7 changes: 4 additions & 3 deletions src/mount/fuse/mfs_fuse.h
Expand Up @@ -61,9 +61,10 @@ void mfs_getxattr (fuse_req_t req, fuse_ino_t ino, const char *name, size_t size
void mfs_listxattr (fuse_req_t req, fuse_ino_t ino, size_t size);
void mfs_removexattr (fuse_req_t req, fuse_ino_t ino, const char *name);
void mfs_init(int debug_mode_, int keep_cache_, double direntry_cache_timeout_,
double entry_cache_timeout_, double attr_cache_timeout_, int mkdir_copy_sgid_,
SugidClearMode sugid_clear_mode_, bool acl_enabled_, double acl_cache_timeout_,
unsigned acl_cache_size_, bool use_rwlock_ = true);
unsigned direntry_cache_size_, double entry_cache_timeout_,
double attr_cache_timeout_, int mkdir_copy_sgid_, SugidClearMode sugid_clear_mode_,
bool acl_enabled_, double acl_cache_timeout_, unsigned acl_cache_size_,
bool use_rwlock_ = true);
#if FUSE_VERSION >= 26
void lzfs_getlk(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi, struct flock *lock);
void lzfs_setlk(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi, struct flock *lock, int sleep) ;
Expand Down

0 comments on commit f68e389

Please sign in to comment.