Merge pull request #756 from orozery/optimize_defaults

Optimize defaults
This commit is contained in:
Takeshi Nakatani 2018-05-23 22:05:00 +09:00 committed by GitHub
commit da95afba8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 2 deletions

View File

@ -27,7 +27,7 @@ Installation
On Ubuntu 14.04: On Ubuntu 14.04:
``` ```
sudo apt-get install automake autotools-dev fuse g++ git libcurl4-gnutls-dev libfuse-dev libssl-dev libxml2-dev make pkg-config sudo apt-get install automake autotools-dev fuse g++ git libcurl4-openssl-dev libfuse-dev libssl-dev libxml2-dev make pkg-config
``` ```
On CentOS 7: On CentOS 7:

View File

@ -142,7 +142,7 @@ pthread_mutex_t StatCache::stat_cache_lock;
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Constructor/Destructor // Constructor/Destructor
//------------------------------------------------------------------- //-------------------------------------------------------------------
StatCache::StatCache() : IsExpireTime(false), IsExpireIntervalType(false), ExpireTime(0), CacheSize(1000), IsCacheNoObject(false) StatCache::StatCache() : IsExpireTime(false), IsExpireIntervalType(false), ExpireTime(0), CacheSize(100000), IsCacheNoObject(false)
{ {
if(this == StatCache::getStatCacheData()){ if(this == StatCache::getStatCacheData()){
stat_cache.clear(); stat_cache.clear();

View File

@ -120,6 +120,7 @@ static bool nocopyapi = false;
static bool norenameapi = false; static bool norenameapi = false;
static bool nonempty = false; static bool nonempty = false;
static bool allow_other = false; static bool allow_other = false;
static bool fuse_read_mode_set = false;
static bool load_iamrole = false; static bool load_iamrole = false;
static uid_t s3fs_uid = 0; static uid_t s3fs_uid = 0;
static gid_t s3fs_gid = 0; static gid_t s3fs_gid = 0;
@ -4355,6 +4356,10 @@ static int my_fuse_opt_proc(void* data, const char* arg, int key, struct fuse_ar
allow_other = true; allow_other = true;
return 1; // continue for fuse option return 1; // continue for fuse option
} }
if(0 == strcmp(arg, "sync_read") || 0 == strcmp(arg, "async_read")){
fuse_read_mode_set = true;
return 1; // continue for fuse option
}
if(0 == STR2NCMP(arg, "mp_umask=")){ if(0 == STR2NCMP(arg, "mp_umask=")){
mp_umask = strtol(strchr(arg, '=') + sizeof(char), NULL, 0); mp_umask = strtol(strchr(arg, '=') + sizeof(char), NULL, 0);
mp_umask &= (S_IRWXU | S_IRWXG | S_IRWXO); mp_umask &= (S_IRWXU | S_IRWXG | S_IRWXO);
@ -4925,6 +4930,15 @@ int main(int argc, char* argv[])
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
// s3fs read is sync (fdent_lock is locked while reading)
// FUSE is async read by default
// switch FUSE to sync read to avoid hitting FUSE's max_background limit
// as well as to make sure that big read requests that are splitted by the kernel
// are always read in-order
if (!fuse_read_mode_set && 0 != fuse_opt_add_arg(&custom_args, "-osync_read")){
exit(EXIT_FAILURE);
}
// [NOTE] // [NOTE]
// exclusive option check here. // exclusive option check here.
// //