From 8b90cd6ba19c311f72b347ba90eba47e55a56aac Mon Sep 17 00:00:00 2001 From: Andrew Gaul Date: Tue, 28 Jun 2022 07:56:06 +0900 Subject: [PATCH] Enable notsup_compat_dir by default (#1970) Few applications create the dir_$folder$ objects and users can enable compat_dir if required. This commit reduces readdir latency by 33%. Also remove notsup_compat_dir from tests since these directories are never created. Fixes #927. References #1643. --- doc/man/s3fs.1.in | 6 ++---- src/s3fs.cpp | 8 +++++++- src/s3fs_help.cpp | 15 ++++++--------- test/small-integration-test.sh | 1 - 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/doc/man/s3fs.1.in b/doc/man/s3fs.1.in index 4b3127f..4dcd355 100644 --- a/doc/man/s3fs.1.in +++ b/doc/man/s3fs.1.in @@ -331,15 +331,13 @@ This name will be added to logging messages and user agent headers sent by s3fs. s3fs complements lack of information about file/directory mode if a file or a directory object does not have x-amz-meta-mode header. As default, s3fs does not complements stat information for a object, then the object will not be able to be allowed to list/modify. .TP -\fB\-o\fR notsup_compat_dir (disable support of alternative directory names) +\fB\-o\fR compat_dir (enable support of alternative directory names) .RS -s3fs supports the three different naming schemas "dir/", "dir" and "dir_$folder$" to map directory names to S3 objects and vice versa. As a fourth variant, directories can be determined indirectly if there is a file object with a path (e.g. "/dir/file") but without the parent directory. +s3fs supports two different naming schemas "dir/" and "dir" to map directory names to S3 objects and vice versa by default. As a third variant, directories can be determined indirectly if there is a file object with a path (e.g. "/dir/file") but without the parent directory. This option enables a fourth variant, "dir_$folder$", created by older applications. .TP S3fs uses only the first schema "dir/" to create S3 objects for directories. .TP The support for these different naming schemas causes an increased communication effort. -.TP -If all applications exclusively use the "dir/" naming scheme and the bucket does not contain any objects with a different naming scheme, this option can be used to disable support for alternative naming schemes. This reduces access time and can save costs. .RE .TP \fB\-o\fR use_wtf8 - support arbitrary file system encoding. diff --git a/src/s3fs.cpp b/src/s3fs.cpp index d94cb80..6b49444 100644 --- a/src/s3fs.cpp +++ b/src/s3fs.cpp @@ -90,7 +90,7 @@ static off_t multipart_threshold = 25 * 1024 * 1024; static int64_t singlepart_copy_limit = 512 * 1024 * 1024; static bool is_specified_endpoint = false; static int s3fs_init_deferred_exit_status = 0; -static bool support_compat_dir = true;// default supports compatibility directory type +static bool support_compat_dir = false;// default does not support compatibility directory type static int max_keys_list_object = 1000;// default is 1000 static off_t max_dirty_data = 5LL * 1024LL * 1024LL * 1024LL; static bool use_wtf8 = false; @@ -4164,9 +4164,15 @@ static int my_fuse_opt_proc(void* data, const char* arg, int key, struct fuse_ar return 0; } if(0 == strcmp(arg, "notsup_compat_dir")){ + S3FS_PRN_WARN("notsup_compat_dir is enabled by default and a future version will remove this option."); + support_compat_dir = false; return 0; } + if(0 == strcmp(arg, "compat_dir")){ + support_compat_dir = true; + return 0; + } if(0 == strcmp(arg, "enable_content_md5")){ S3fsCurl::SetContentMd5(true); return 0; diff --git a/src/s3fs_help.cpp b/src/s3fs_help.cpp index 0ba725b..a674364 100644 --- a/src/s3fs_help.cpp +++ b/src/s3fs_help.cpp @@ -412,23 +412,20 @@ static const char help_string[] = " for a object, then the object will not be able to be allowed to\n" " list/modify.\n" "\n" - " notsup_compat_dir (disable support of alternative directory names)\n" - " s3fs supports the three different naming schemas \"dir/\",\n" - " \"dir\" and \"dir_$folder$\" to map directory names to S3\n" - " objects and vice versa. As a fourth variant, directories can be\n" + " compat_dir (enable support of alternative directory names)\n" + " s3fs supports two different naming schemas \"dir/\" and\n" + " \"dir\" to map directory names to S3 objects and\n" + " vice versa by default. As a third variant, directories can be\n" " determined indirectly if there is a file object with a path (e.g.\n" " \"/dir/file\") but without the parent directory.\n" + " This option enables a fourth variant, \"dir_$folder$\", created by\n" + " older applications.\n" " \n" " S3fs uses only the first schema \"dir/\" to create S3 objects for\n" " directories." " \n" " The support for these different naming schemas causes an increased\n" " communication effort.\n" - " \n" - " If all applications exclusively use the \"dir/\" naming scheme and\n" - " the bucket does not contain any objects with a different naming \n" - " scheme, this option can be used to disable support for alternative\n" - " naming schemes. This reduces access time and can save costs.\nq" "\n" " use_wtf8 - support arbitrary file system encoding.\n" " S3 requires all object names to be valid UTF-8. But some\n" diff --git a/test/small-integration-test.sh b/test/small-integration-test.sh index bd664fe..7547187 100755 --- a/test/small-integration-test.sh +++ b/test/small-integration-test.sh @@ -48,7 +48,6 @@ if [ -n "${ALL_TESTS}" ]; then "max_stat_cache_size=100" nocopyapi nomultipart - notsup_compat_dir sigv2 sigv4 "singlepart_copy_limit=10" # limit size to exercise multipart code paths