Remove "-o default_permissions" unless needed.

It is only needed when "-o allow_other" is specified.

"-o default_permissions" causes libfuse to check file access
in userspace. This costs CPU cycles and causes additional
stat() calls - libfuse has to walk up the whole path to check
for "x" permissions on directories.

This improves "make benchmark-reverse" performance
by 30% when caching is disabled. It also gives a slight
improvement with caches on.

Before:

  tests/benchmark-reverse.pl /var/tmp
  * rsync 1 (initial copy)... 12179 ms
  * rsync 2 (no changes)... 1840 ms
  cleaning up... done
  tests/benchmark-reverse.pl /var/tmp --nocache
  * rsync 1 (initial copy)... 30696 ms
  * rsync 2 (no changes)... 10552 ms
  cleaning up... done

After:

  tests/benchmark-reverse.pl /var/tmp
  * rsync 1 (initial copy)... 12095 ms
  * rsync 2 (no changes)... 1693 ms
  cleaning up... done
  tests/benchmark-reverse.pl /var/tmp --nocache
  * rsync 1 (initial copy)... 21266 ms
  * rsync 2 (no changes)... 6486 ms
  cleaning up... done
This commit is contained in:
Jakob Unterwurzacher 2015-03-22 16:41:29 +01:00
parent 31568b1de5
commit 82ceb88998

View File

@ -367,13 +367,6 @@ static bool processArgs(int argc, char *argv[],
if (!out->isThreaded) PUSHARG("-s");
if (useDefaultFlags) {
PUSHARG("-o");
PUSHARG("use_ino");
PUSHARG("-o");
PUSHARG("default_permissions");
}
// we should have at least 2 arguments left over - the source directory and
// the mount point.
if (optind + 2 <= argc) {
@ -396,6 +389,26 @@ static bool processArgs(int argc, char *argv[],
}
}
// Add default flags unless --no-default-flags was passed
if (useDefaultFlags) {
// Expose the underlying stable inode number
PUSHARG("-o");
PUSHARG("use_ino");
// "default_permissions" comes with a performance cost. Only enable
// it if makes sense.
for(int i=0; i < out->fuseArgc; i++) {
if ( out->fuseArgv[i] == NULL ) {
continue;
} else if (strcmp(out->fuseArgv[i], "allow_other") == 0) {
PUSHARG("-o");
PUSHARG("default_permissions");
break;
}
}
}
// sanity check
if (out->isDaemon && (!isAbsolutePath(out->mountPoint.c_str()) ||
!isAbsolutePath(out->opts->rootDir.c_str()))) {