Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/llfio.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com>2017-07-29 21:42:20 +0300
committerNiall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com>2017-07-29 21:42:20 +0300
commit2f570b29eb21ec017579ba64963e614f8f8004ae (patch)
tree3c53865b78300b65e93e01e534ba0220dd0cdc0c
parent4aa75b021b4e4b11e8fe39ff5c80b62e4e5ab438 (diff)
Added deadline to unlink and relink.
Added timeout to ctest invocation.
-rw-r--r--.travis.yml2
-rw-r--r--appveyor.yml.disabled2
-rw-r--r--include/afio/revision.hpp6
-rw-r--r--include/afio/v2.0/detail/impl/posix/file_handle.ipp33
-rw-r--r--include/afio/v2.0/detail/impl/windows/file_handle.ipp4
-rw-r--r--include/afio/v2.0/file_handle.hpp7
-rw-r--r--release_notes.md45
7 files changed, 73 insertions, 26 deletions
diff --git a/.travis.yml b/.travis.yml
index 28b9bed0..8b3590e1 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -73,7 +73,7 @@ script:
if [ "$__" = "cmake tests" ]; then
if [ "$CXX" = "g++" ]; then export CXX=g++-7; export NAME=TravisLinuxWorkerGCC; fi;
if [ "$CXX" = "clang++" ]; then export CXX=clang++-4.0; export NAME=TravisLinuxWorkerClang; fi;
- ctest -S .ci.cmake -V;
+ ctest -S .ci.cmake -V --timeout 300;
fi
-
if [ "$__" = "Documentation" ]; then
diff --git a/appveyor.yml.disabled b/appveyor.yml.disabled
index 663601ac..44715d21 100644
--- a/appveyor.yml.disabled
+++ b/appveyor.yml.disabled
@@ -24,7 +24,7 @@ before_build:
- git checkout master
- git submodule update --init --recursive
build_script:
- - ctest -S .ci.cmake -V
+ - ctest -S .ci.cmake -V --timeout 300
after_build:
before_test:
diff --git a/include/afio/revision.hpp b/include/afio/revision.hpp
index 025c4675..2991aa97 100644
--- a/include/afio/revision.hpp
+++ b/include/afio/revision.hpp
@@ -1,4 +1,4 @@
// Note the second line of this file must ALWAYS be the git SHA, third line ALWAYS the git SHA update time
-#define AFIO_PREVIOUS_COMMIT_REF 1ffa5c4177993491927e1963e08d7210168e4787
-#define AFIO_PREVIOUS_COMMIT_DATE "2017-07-29 02:41:07 +00:00"
-#define AFIO_PREVIOUS_COMMIT_UNIQUE 1ffa5c41
+#define AFIO_PREVIOUS_COMMIT_REF 4aa75b021b4e4b11e8fe39ff5c80b62e4e5ab438
+#define AFIO_PREVIOUS_COMMIT_DATE "2017-07-29 14:15:06 +00:00"
+#define AFIO_PREVIOUS_COMMIT_UNIQUE 4aa75b02
diff --git a/include/afio/v2.0/detail/impl/posix/file_handle.ipp b/include/afio/v2.0/detail/impl/posix/file_handle.ipp
index 64e4069e..4208ec58 100644
--- a/include/afio/v2.0/detail/impl/posix/file_handle.ipp
+++ b/include/afio/v2.0/detail/impl/posix/file_handle.ipp
@@ -106,11 +106,20 @@ result<void> file_handle::_fetch_inode() noexcept
return success();
}
-inline result<path_handle> containing_directory(filesystem::path &filename, const file_handle &h) noexcept
+inline result<path_handle> containing_directory(filesystem::path &filename, const file_handle &h, deadline d) noexcept
{
#ifdef AFIO_DISABLE_RACE_FREE_PATH_FUNCTIONS
return std::errc::function_not_supported;
#endif
+ std::chrono::steady_clock::time_point began_steady;
+ std::chrono::system_clock::time_point end_utc;
+ if(d)
+ {
+ if(d.steady)
+ began_steady = std::chrono::steady_clock::now();
+ else
+ end_utc = d.to_time_point();
+ }
try
{
for(;;)
@@ -136,6 +145,20 @@ inline result<path_handle> containing_directory(filesystem::path &filename, cons
// If the same, we know for a fact that this is the correct containing dir for now at least
if(nh.st_dev() == h.st_dev() && nh.st_ino() == h.st_ino())
return success(std::move(currentdirh));
+ // Check timeout
+ if(d)
+ {
+ if(d.steady)
+ {
+ if(std::chrono::steady_clock::now() >= (began_steady + std::chrono::nanoseconds(d.nsecs)))
+ return std::errc::timed_out;
+ }
+ else
+ {
+ if(std::chrono::system_clock::now() >= end_utc)
+ return std::errc::timed_out;
+ }
+ }
}
}
catch(...)
@@ -287,7 +310,7 @@ result<file_handle> file_handle::clone() const noexcept
return ret;
}
-result<void> file_handle::relink(const path_handle &base, path_view_type path) noexcept
+result<void> file_handle::relink(const path_handle &base, path_view_type path, deadline d) noexcept
{
AFIO_LOG_FUNCTION_CALL(this);
path_view::c_str zpath(path);
@@ -303,18 +326,18 @@ result<void> file_handle::relink(const path_handle &base, path_view_type path) n
#endif
// Open our containing directory
filesystem::path filename;
- OUTCOME_TRY(dirh, containing_directory(filename, *this));
+ OUTCOME_TRY(dirh, containing_directory(filename, *this, d));
if(-1 == ::renameat(dirh.native_handle().fd, filename.c_str(), base.is_valid() ? base.native_handle().fd : AT_FDCWD, zpath.buffer))
return {errno, std::system_category()};
return success();
}
-result<void> file_handle::unlink() noexcept
+result<void> file_handle::unlink(deadline d) noexcept
{
AFIO_LOG_FUNCTION_CALL(this);
// Open our containing directory
filesystem::path filename;
- OUTCOME_TRY(dirh, containing_directory(filename, *this));
+ OUTCOME_TRY(dirh, containing_directory(filename, *this, d));
if(-1 == ::unlinkat(dirh.native_handle().fd, filename.c_str(), 0))
return {errno, std::system_category()};
return success();
diff --git a/include/afio/v2.0/detail/impl/windows/file_handle.ipp b/include/afio/v2.0/detail/impl/windows/file_handle.ipp
index 26353e40..a1f318ac 100644
--- a/include/afio/v2.0/detail/impl/windows/file_handle.ipp
+++ b/include/afio/v2.0/detail/impl/windows/file_handle.ipp
@@ -335,7 +335,7 @@ result<file_handle> file_handle::clone() const noexcept
return ret;
}
-result<void> file_handle::relink(const path_handle &base, path_view_type path) noexcept
+result<void> file_handle::relink(const path_handle &base, path_view_type path, deadline /*unused*/) noexcept
{
windows_nt_kernel::init();
using namespace windows_nt_kernel;
@@ -367,7 +367,7 @@ result<void> file_handle::relink(const path_handle &base, path_view_type path) n
return success();
}
-result<void> file_handle::unlink() noexcept
+result<void> file_handle::unlink(deadline /*unused*/) noexcept
{
windows_nt_kernel::init();
using namespace windows_nt_kernel;
diff --git a/include/afio/v2.0/file_handle.hpp b/include/afio/v2.0/file_handle.hpp
index c41e9317..a2fa9061 100644
--- a/include/afio/v2.0/file_handle.hpp
+++ b/include/afio/v2.0/file_handle.hpp
@@ -257,8 +257,9 @@ public:
\param base Base for any relative path.
\param newpath The relative or absolute new path to relink to.
+ \param d The deadline by which the relink must succeed, else `std::errc::timed_out` will be returned.
*/
- AFIO_HEADERS_ONLY_VIRTUAL_SPEC result<void> relink(const path_handle &base, path_view_type newpath) noexcept;
+ AFIO_HEADERS_ONLY_VIRTUAL_SPEC result<void> relink(const path_handle &base, path_view_type newpath, deadline d = std::chrono::seconds(30)) noexcept;
/*! Unlinks the current path of this open handle, causing its entry to immediately disappear from the filing system.
On Windows unless `flag::win_disable_unlink_emulation` is set, this behaviour is
@@ -271,8 +272,10 @@ public:
deleted. Note that unless `flag::disable_safety_unlinks` is set, this implementation opens a
`path_handle` to the containing directory first, then checks that the item about to be unlinked
has the same inode as the open file handle. This should prevent most unmalicious accidental loss of data.
+
+ \param d The deadline by which the unlink must succeed, else `std::errc::timed_out` will be returned.
*/
- AFIO_HEADERS_ONLY_VIRTUAL_SPEC result<void> unlink() noexcept;
+ AFIO_HEADERS_ONLY_VIRTUAL_SPEC result<void> unlink(deadline d = std::chrono::seconds(30)) noexcept;
//! The i/o service this handle is attached to, if any
io_service *service() const noexcept { return _service; }
diff --git a/release_notes.md b/release_notes.md
index 5d52cffa..a532e679 100644
--- a/release_notes.md
+++ b/release_notes.md
@@ -1,10 +1,9 @@
Herein lies the beginnings of the proposed AFIO v2 post-peer-review rewrite. Its github
source code repository lives at https://github.com/ned14/boost.afio.
-<b>master branch test status</b> Linux: [![Build Status](https://travis-ci.org/ned14/boost.afio.svg?branch=master)](https://travis-ci.org/ned14/boost.afio) Windows: [![Build status](https://ci.appveyor.com/api/projects/status/ox59o2r276xbmef7/branch/master?svg=true)](https://ci.appveyor.com/project/ned14/boost-afio/branch/master) Coverage: Boost.KernelTest support for coveralls.io still todo <b>CMake dashboard</b>: http://my.cdash.org/index.php?project=AFIO
+<b>master branch test status</b> Linux: <a href="https://travis-ci.org/ned14/afio"><img src="https://travis-ci.org/ned14/afio.svg?branch=master"></a> Windows: <em>disabled due to lack of VS2017.3 on CI</em> <b>CMake dashboard</b>: http://my.cdash.org/index.php?project=AFIO
-\note Note that this code is so early alpha that no substantial test code exists
-yet. Nobody should use this code for anything serious.
+\note Note that this code is of late alpha quality. Be careful when using it!
You need these compilers or better:
- GCC 7.0
@@ -12,42 +11,53 @@ You need these compilers or better:
- VS2017 Update 3
-## Architecture and design:
+## v2 architecture and design implemented:
| NEW in v2 | Boost peer review feedback | |
| --------- | -------------------------- | --- |
| ✔ | ✔ | Universal native handle/fd abstraction instead of `void *`.
| ✔ | ✔ | Perfectly/Ideally low memory (de)allocation per op (usually none).
| ✔ | ✔ | noexcept API throughout returning error_code for failure instead of throwing exceptions.
-| ✔ | ✔ | AFIO v1 handle type split into hierarchy of types:<ol><li>handle - provides open, close, get path, clone, set/unset append only, change caching, characteristics<li>io_handle - adds synchronous scatter-gather i/o, byte range locking<li>file_handle - adds open/create file, get and set maximum extent<li>async_file_handle - adds asynchronous scatter-gather i/o</ol>
+| ✔ | ✔ | AFIO v1 handle type split into hierarchy of types:<ol><li>handle - provides open, close, get path, clone, set/unset append only, change caching, characteristics<li>path_handle - a race free anchor to a subset of the filesystem<li>io_handle - adds synchronous scatter-gather i/o, byte range locking<li>file_handle - adds open/create file, get and set maximum extent<li>async_file_handle - adds asynchronous scatter-gather i/o</ol>
| ✔ | ✔ | Cancelable i/o (made possible thanks to dropping XP support).
| ✔ | ✔ | All shared_ptr usage removed as all use of multiple threads removed.
-| ✔ | ✔ | Use of std::vector to transport scatter-gather sequences replaced with C++ 2x `span<>` borrowed views.
+| ✔ | ✔ | Use of std::vector to transport scatter-gather sequences replaced with C++ 20 `span<>` borrowed views.
| ✔ | ✔ | Completion callbacks are now some arbitrary type `U&&` instead of a future continuation. Type erasure for its storage is bound into the one single memory allocation for everything needed to execute the op, and so therefore overhead is optimal.
| ✔ | ✔ | Filing system algorithms made generic and broken out into public `afio::algorithms` template library (the AFIO FTL).
| ✔ | ✔ | Abstraction of native handle management via bitfield specified "characteristics".
| ✔ | | Storage profiles, a YAML database of behaviours of hardware, OS and filing system combinations.
| ✔ | | Absolute and interval deadline timed i/o throughout (made possible thanks to dropping XP support).
| ✔ | | Dependency on ASIO/Networking TS removed completely.
-| ✔ | | Three choices of algorithm implementing a shared filing system mutex.
+| ✔ | | Four choices of algorithm implementing a shared filing system mutex.
| ✔ | | Uses CMake, CTest, CDash and CPack with automatic usage of C++ Modules or precompiled headers where available.
| ✔ | | Far more comprehensive memory map and virtual memory facilities.
-| P | | New multithreaded kernel based testing infrastructure based on LLVM which can permute/fuzz/<b>edge</b> coverage/mock each test kernel with choices of asan/lsan/msan/ubsan/none sanitisation. This new test infrastructure should make possible (one day) <b>formal proof</b> that AFIO's implementation is mathematically correct.
+| ✔ | | Much more granular, micro level unit testing of individual functions.
+| ✔ | | Much more granular, micro level internal logging of every code path taken.
+| ✔ | | Path views used throughout, thus avoiding string copying and allocation in `std::filesystem::path`.
+| ✔ | | Paths are equally interpreted as UTF-8 on all platforms.
+Todo:
-## Features implemented:
+| P | | clang AST assisted SWIG bindings for other languages.
+| P | | Statistical tracking of operation latencies.
+
+
+
+## Planned features implemented:
| NEW in v2 | Windows | POSIX | |
| --------- | --------| ----- | --- |
| ✔ | ✔ | ✔ | Native handle cloning.
| ✔ (up from four) | ✔ | ✔ | Maximum possible (seven) forms of kernel caching.
| | ✔ | ✔ | Absolute path open.
-| | | | Relative path open ("fat paths").
+| | ✔ | ✔ | Relative "anchored" path open enabling race free file system.
| ✔ | ✔ | | Win32 path support (260 path limit).
-| | | | NT kernel path support (32,768 path limit).
+| | ✔ | | NT kernel path support (32,768 path limit).
| ✔ | ✔ | ✔ | Synchronous universal scatter-gather i/o.
| ✔ (POSIX AIO support) | ✔ | ✔ | Asynchronous universal scatter-gather i/o.
-| ✔ | ✔ | ✔ | i/o cancellation.
+| | | | BSD and OS X kqueues optimised `io_service`
+| ✔ | | | Linux KAIO support for native async `O_DIRECT` i/o
+| ✔ | ✔ | ✔ | i/o deadlines and cancellation.
| | ✔ | ✔ | Retrieving and setting the current maximum extent (size) of an open file.
| | ✔ | ✔ | statfs_t ported over from AFIO v1.
| | ✔ | ✔ | utils namespace ported over from AFIO v1.
@@ -57,4 +67,15 @@ You need these compilers or better:
| ✔ | ✔ | ✔ | `shared_fs_mutex` shared/exclusive entities locking based on atomic append
| | ✔ | ✔ | Memory mapped files and virtual memory management (`section_handle` and `map_handle`)
| ✔ | ✔ | ✔ | `shared_fs_mutex` shared/exclusive entities locking based on memory maps
+| ✔ | ✔ | ✔ | Universal portable UTF-8 path views.
+
+Todo:
+| | | | "Hole punching" and hole enumeration ported over from AFIO v1.
+| | | | Directory handles and very fast directory enumeration ported over from AFIO v1.
+| ✔ | | | Extended attributes support.
+| | | | Reliable directory hierarchy deletion algorithm.
+| | | | Reliable directory hierarchy copy algorithm.
+| ✔ | | | Reliable directory hierarchy update (two and three way) algorithm.
+| ✔ | | | Algorithm to replace all duplicate content with hard links.
+| ✔ | | | Algorithm to figure out all paths for a hard linked inode.