Commit Graph

43 Commits

Author SHA1 Message Date
Andrew Gaul 4845831f93
Convert some const to constexpr (#2342)
This guarantees that the function or value will resolve at compile-time.
2023-11-14 22:15:17 +09:00
Andrew Gaul 361e10d09c
Add scope_guard for ad-hoc resource management (#2313)
References #2261.  Suggested by:
https://stackoverflow.com/questions/10270328/the-simplest-and-neatest-c11-scopeguard
2023-09-26 07:52:55 +09:00
Andrew Gaul 61df7bf42c
Use std::unique_ptr for fclose (#2318)
References #2261.
2023-09-25 23:55:11 +09:00
Andrew Gaul b29f8d0f2b
Use C++ enum class for most enums (#2241)
This promotes type-safety.
2023-07-30 22:53:17 +09:00
Takeshi Nakatani 4b2f3fecb5 Set mtime/ctime/atime of all objects as nanosecond 2022-07-28 13:47:03 +09:00
Takeshi Nakatani 404c284440 Fixed race condition in dirname and basename call 2022-07-24 18:14:58 +09:00
Andrew Gaul cd5a69b9eb
Handle UTIME_NOW and UTIME_OMIT special values (#1868)
FUSE 3 will require this behavior.  References #1159.
2022-01-29 11:35:37 +09:00
Takeshi Nakatani b589ebec23 Output version and command parameters at startup 2021-03-06 19:11:57 +09:00
Takeshi Nakatani b5ffd419d8 Source file division and set 4 spaces and cleanup 2020-08-26 17:43:50 +09:00
Andrew Gaul 958ad83a4b Correct vim modeline to 2-space indentation 2020-08-19 21:03:46 +09:00
Andrew Gaul 8de6cb3504 Lock fdent_data_lock before accessing pagelist
Found via ThreadSanitizer.  References #1353.  References #1362.
2020-08-16 17:44:03 +09:00
Takeshi Nakatani 2bb745cdd7 Fixed a bug about move file over limit of ensure space 2020-08-16 17:42:20 +09:00
Andrew Gaul 8945e98d8b Support Google Cloud Storage headers
This allows s3fs to interpret objects created by gsutil.
2020-05-03 18:33:13 +09:00
Takeshi Nakatani 7fbda230f5 Added mime option for strict checking of mime types file 2020-03-30 14:41:18 +00:00
Andrew Gaul d8cf26bd50 Remove unused field
Found via clang.
2019-08-01 16:42:38 -07:00
Andrew Gaul fb937635f5 Eagerly initialize sysconf variables
Previously s3fs had races updating these shared variables.  Found via
ThreadSanitizer.
2019-07-17 09:08:13 -07:00
Andrew Gaul a83d5baa90 Remove recursive locking
Recursive locking is frowned upon and is incompatible with
PTHREAD_MUTEX_ERRORCHECK.  Also clean up pthread_mutex_lock error
checking.
2019-07-10 12:39:00 -07:00
Andrew Gaul b8ff6a647e Add simple XML parsing wrapper
Also simplify check_region_error.
2019-07-05 17:39:09 -07:00
Andrew Gaul b8c9fcfd70 Avoid pass-by-value when not necessary
This requires unnecessary memcpy.  Found via clang-tidy.
2019-01-17 18:22:11 -08:00
Andrew Gaul 2c43b1e12b Store and retrieve file change time
This introduces a new header with the change time; existing objects
will report modification time.  Fixes #771.
2019-01-14 10:05:11 -08:00
Takeshi Nakatani 9d10a5aa70 Changed copyright year format for debian pkg 2017-05-07 11:24:17 +00:00
Takeshi Nakatani 28efff5986 Merge pull request #554 from orozery/cache_cleanup
cleanup cache directory when running out of disk space
2017-04-16 19:13:11 +09:00
Takeshi Nakatani fef3fbc225 Added check_cache_dir_exist option(refixed #347) - #538 2017-04-02 08:10:16 +00:00
Or Ozeri 95578cad43 cleanup cache directory when running out of disk space 2017-04-02 10:22:12 +03:00
Andrew Gaul d375bca0d0 Correct typos 2016-11-19 15:57:41 -08:00
Takeshi Nakatani e8a8019a71 Add mirror file logic for removing cache file 2016-07-03 03:37:08 +00:00
Takeshi Nakatani ce66430fac Added chacking cache dir perms at starting. 2015-08-23 03:57:34 +00:00
Andrew Gaul 3f59b8da01 Rewrite AutoLock
Previously AutoLock::Lock allowed subsequent callers to proceed
without the lock.  Further is_locked was not always protected by
auto_mutex.  Finally AutoLock eagerly released auto_mutex when
recursively unlocking.  s3fs does not need recursive locks so we
rewrite and simplify AutoLock.  Partially surfaced by Coverity.
2015-08-14 20:00:56 -07:00
Andrew Gaul b6fa2deb9f Annotate constructors as explicit
This prevents implicit conversions.
2015-08-05 23:41:53 -07:00
Takeshi Nakatani 7a7c7572ea Cleaned up codes for next packaging. 2014-09-07 15:08:27 +00:00
Takeshi Nakatani c1a6d76fc3 Fixed a bug issue #40 2014-06-28 17:36:35 +00:00
ggtakec@gmail.com 40b9f0a408 Changes codes
1) Changed buffer size for file size
   Changes a internal buffer size from size_t to offt_t.
   It is a bug for 32 bit OS enviroment.



git-svn-id: http://s3fs.googlecode.com/svn/trunk@496 df820570-a93a-0410-bd06-b72b767a4274
2013-11-17 08:50:41 +00:00
ggtakec@gmail.com 882f13020e Fixed bugs(overflow)
1) Overflow
   About over 4GB file, when st_size which is member stat structure,
   the value is overflow.
   Fixed this bug and fixed like this bug in all sources. 

2) Changed retrying request
   If s3fs gets 500 HTTP status for multipart request, s3fs retry
   to send same request.





git-svn-id: http://s3fs.googlecode.com/svn/trunk@495 df820570-a93a-0410-bd06-b72b767a4274
2013-11-13 16:26:50 +00:00
ggtakec@gmail.com 99db6d13af Changes codes
1) Supported IAM role
   Supports IAM role by option, that is instead of AccessKeyID/
   SecretAccessKey.
   Adds new option "iam_role" which is specified as IAM role
   name.(like s3fs-c)



git-svn-id: http://s3fs.googlecode.com/svn/trunk@490 df820570-a93a-0410-bd06-b72b767a4274
2013-10-06 13:45:32 +00:00
ggtakec@gmail.com 3274f58948 Changes codes for performance(part 3)
* Summay
   This revision includes big change about temporary file and local cache file. 
   By this big change, s3fs works with good performance when s3fs opens/
   closes/syncs/reads object.
   I made a big change about the handling about temporary file and local cache
   file to do this implementation.

* Detail
1) About temporary file(local file)
   s3fs uses a temporary file on local file system when s3fs does download/
   upload/open/seek object on S3.
   After this revision, s3fs calls ftruncate() function when s3fs makes the 
   temporary file.
   In this way s3fs can set a file size of precisely length without downloading.
   (Notice - ftruncate function is for XSI-compliant systems, so that possibly
    you have a problem on non-XSI-compliant systems.)

   By this change, s3fs can download a part of a object by requesting with 
   "Range" http header. It seems like downloading by each block unit.
   The default block(part) size is 50MB, it is caused the result which is default 
   parallel requests count(5) by default multipart upload size(10MB).
   If you need to change this block size, you can change by new option 
   "fd_page_size". This option can take from 1MB(1024 * 1024) to any bytes.

   So that, you have to take care about that fdcache.cpp(and fdcache.h) were 
   changed a lot.

2) About local cache
   Local cache files which are in directory specified by "use_cache" option do 
   not have always all of object data.
   This cause is that s3fs uses ftruncate function and reads(writes) each block 
   unit of a temporary file.
   s3fs manages each block unit's status which are "downloaded area" or "not".
   For this status, s3fs makes new temporary file in cache directory which is 
   specified by "use_cache" option. This status files is in a directory which is 
   named "<use_cache sirectory>/.<bucket_name>/".

   When s3fs opens this status file, s3fs locks this file for exclusive control by 
   calling flock function. You need to take care about this, the status files can 
   not be laid on network drive(like NFS).

   This revision changes about file open mode, s3fs always opens a local cache 
   file and each status file with writable mode.
   Last, this revision adds new option "del_cache", this option means that s3fs 
   deletes all local cache file when s3fs starts and exits.

3) Uploading
   When s3fs writes data to file descriptor through FUSE request, old s3fs 
   revision downloads all of the object. But new revision does not download all, 
   it downloads only small percial area(some block units) including writing data 
   area.
   And when s3fs closes or flushes the file descriptor, s3fs downloads other area 
   which is not downloaded from server. After that,  s3fs uploads all of data.
   Already r456 revision has parallel upload function, then this revision with 
   r456 and r457 are very big change for performance.

4) Downloading
   By changing a temporary file and a local cache file, when s3fs downloads a 
   object, it downloads only the required range(some block units). 
   And s3fs downloads units by parallel GET request, it is same as a case of 
   uploading. (Maximum parallel request count and each download size are 
   specified same parameters for uploading.)

   In the new revision, when s3fs opens file, s3fs returns file descriptor soon.
   Because s3fs only opens(makes) the file descriptor with no downloading 
   data. And when s3fs reads a data, s3fs downloads only some block unit 
   including specified area.
   This result is good for performance.

5) Changes option name
   The option "parallel_upload" which added at r456 is changed to new option 
   name as "parallel_count". This reason is this option value is not only used by 
   uploading object, but a uploading object also uses this option. (For a while, 
   you can use old option name "parallel_upload" for compatibility.)



git-svn-id: http://s3fs.googlecode.com/svn/trunk@458 df820570-a93a-0410-bd06-b72b767a4274
2013-07-23 16:01:48 +00:00
ggtakec@gmail.com 1c93dd30c1 Changes codes
1) For uploading performance(part 2)
   Changed a codes about uploading large object(multipart uploading).
   This revision does not make temporary file when s3fs uploads large object by multipart uploading.
   Before this revision, s3fs made temporary file(/tmp/s3fs.XXXXX) for multipart, but it was not good for performance.
   So that, new codes do not use those files, and s3fs reads directly large object from s3fs's cache file.

2) Some value to symbol
   Changed some value to symbol(define).



git-svn-id: http://s3fs.googlecode.com/svn/trunk@457 df820570-a93a-0410-bd06-b72b767a4274
2013-07-12 00:33:36 +00:00
ggtakec@gmail.com 1095b7bc52 Changes codes
1) For uploading performance(part 1)
   Changed a code for large object uploading.
   New codes makes s3fs send parallel requests when s3fs uploads large 
   object(20MB) by multipart post.

   And added new "parallel_upload" option, which limits parallel request 
   count which s3fs requests at once.
   This option's default value is "5", and you can change this value. But it
   is necessary to set this value depending on a CPU and a network band.
   s3fs became to work good performance by this option, please try to set 
   your value for this option.

2) Changes debugging messages
    Changed debugging message in s3fs.cpp.



git-svn-id: http://s3fs.googlecode.com/svn/trunk@456 df820570-a93a-0410-bd06-b72b767a4274
2013-07-10 06:24:06 +00:00
ggtakec@gmail.com 45950044f7 Changes codes
1) Changes codes for performance and request's costs
    s3fs gets object's  attributes by using HEAD request.
    Directory objects is following 4 type:
      a) name type is "dir", with meta information
      b) name type is "dir", without meta information(but has files in itself)
      c) name type is "dir/", with(out) meta information
      d) name type is "dir_$folder$", with(out) meta information
    The codes is changed to order checking directory object.
    So that, s3fs decreases requests for checking objects.

    Before version has a bug, that is s3fs can not be recognizable type-b) 
    definitely when s3fs check the object directly.(but s3fs can, when s3fs 
    check the object by listing)
    This change fixes this bug.

2) Adds "multireq_max" option
    Added "multireq_max" option is maximum number of parallel request 
    for listing objects.
    This changes is possible to solve CURLE_COULDNT_CONNECT.
    If this option can not solve it, this option will be useful for tuning 
    performance by each.




git-svn-id: http://s3fs.googlecode.com/svn/trunk@449 df820570-a93a-0410-bd06-b72b767a4274
2013-06-19 14:53:58 +00:00
ggtakec@gmail.com 715b837a2b Fixed Issue 31 and Cleanup codes
1) s3sync'ed files not supported(Issue 31)
    Supports HTTP headers which made by s3sync.
    Supported new HTTP headers are x-amz-meta-owner, 
    x-amz-meta-permissions and x-amz-meta-group.
    s3fs read and understand these headers, but s3fs 
    gives priority to s3fs's headers over these headers.

2) Cleanups codes
    Cleanups some codes about issue 31.




git-svn-id: http://s3fs.googlecode.com/svn/trunk@422 df820570-a93a-0410-bd06-b72b767a4274
2013-05-09 08:35:17 +00:00
ggtakec@gmail.com b973eaae44 Changed codes for issue: 27(+)
1) Feature Request: Compatability with other S3FS clients(Issue: 27)
    Rechanges source code.

2) For other S3 clients
    Supports the directory which is no objects.
    If there is a object which has "/" charactor(ex. "<bucket>/dir/file"), the directory("dir") object is no object.
    Exsample, you can upload the object which name is "s3://bucket/dir/file" by the s3cmd.
    Then the "dir" is not object in bucket("dir").
    This s3fs codes understands this case.



git-svn-id: http://s3fs.googlecode.com/svn/trunk@414 df820570-a93a-0410-bd06-b72b767a4274
2013-04-29 14:31:10 +00:00
ggtakec@gmail.com 36447a23eb Fixed issue: 27
1) Feature Request: Compatability with other S3FS clients(Issue: 27)
    Supported the directory object which made by s3fox. Its name has "_$folder$" suffixes.
    On s3fs, that directory object is listed normal directory name without "_$folder$".
    You need careful when you change object attributes(rename, chmod, chown, touch), because the s3fs remakes the directory object after that object(which has "_$folder$" suffix)
    After changing the object attributes, the object name does not have "_$folder$" suffix.
    It means the object is remade by s3fs.

2) Other
    Fixes bugs which are found when this issue is fixed.



git-svn-id: http://s3fs.googlecode.com/svn/trunk@413 df820570-a93a-0410-bd06-b72b767a4274
2013-04-20 19:17:28 +00:00
ggtakec@gmail.com 8bd1483374 Summary of Changes(1.65 -> 1.66)
==========================
List of Changes
==========================
1) Fixes bugs
    Fixes Issue 321: "no write permission for non-root user".
    (http://code.google.com/p/s3fs/issues/detail?id=321)
    Fixes a bug which s3fs does not set uid/gid headers when making symlink.

2) Cleanup  code.
    Adds a common function which  converts the Last-Modified header to utime.
    Deletes the useless cord and arranged it.

3) xmlns
    Changes that s3fs can decide using the xmlns url automatically.
    Then the noxmlns option is not needed anymore, but it is left.

4) Changes cache for performance
    Changes stat cache, it accumulates stat information and some headers.
    By adding some headers into cache, s3fs does not need to call curl_get_headers function.
    After changing, one cache entry increases in about 500 bytes from about 144 byte.
    
    Adds one condition to get out of the cache, that condition is by looking object's ETag.
    It works good for noticing changes about obojects.




git-svn-id: http://s3fs.googlecode.com/svn/trunk@400 df820570-a93a-0410-bd06-b72b767a4274
2013-04-06 17:39:22 +00:00
ggtakec@gmail.com 953aedd7ad Cleaned up source codes
No changes for logic, only changes layout of functions and valiables between a file to a file.
    Adds s3fs_util.cpp/s3fs_util.h/common.h



git-svn-id: http://s3fs.googlecode.com/svn/trunk@396 df820570-a93a-0410-bd06-b72b767a4274
2013-03-30 13:37:14 +00:00