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>2018-11-12 12:46:37 +0300
committerNiall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com>2018-11-12 12:46:37 +0300
commita5e0bb3b263de680ce1b05504042f81714e8ac15 (patch)
tree03c8196d8c54a26b73a81b75af4919a5824e2c01 /include/llfio
parentb49ca5707e2a3a08b560764078e4d526f7f44c42 (diff)
Rename cached_parent_handle_adapter into handle_adapter/cached_parent.
fast_random_file_handle wasn't exported from DLLs, and was missing function overrides. Made io_handle::extent_guard available to subclasses.
Diffstat (limited to 'include/llfio')
-rw-r--r--include/llfio/revision.hpp6
-rw-r--r--include/llfio/v2.0/algorithm/handle_adapter/cached_parent.hpp (renamed from include/llfio/v2.0/algorithm/cached_parent_handle_adapter.hpp)4
-rw-r--r--include/llfio/v2.0/detail/impl/cached_parent_handle_adapter.ipp2
-rw-r--r--include/llfio/v2.0/fast_random_file_handle.hpp45
-rw-r--r--include/llfio/v2.0/file_handle.hpp1
-rw-r--r--include/llfio/v2.0/handle.hpp15
-rw-r--r--include/llfio/v2.0/io_handle.hpp2
-rw-r--r--include/llfio/v2.0/llfio.hpp2
m---------include/llfio/v2.0/outcome0
9 files changed, 65 insertions, 12 deletions
diff --git a/include/llfio/revision.hpp b/include/llfio/revision.hpp
index 39db2231..67a38949 100644
--- a/include/llfio/revision.hpp
+++ b/include/llfio/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 LLFIO_PREVIOUS_COMMIT_REF a9bc36dd95c814bdcbd4eb02f45f1199839f12c8
-#define LLFIO_PREVIOUS_COMMIT_DATE "2018-10-25 20:53:36 +00:00"
-#define LLFIO_PREVIOUS_COMMIT_UNIQUE a9bc36dd
+#define LLFIO_PREVIOUS_COMMIT_REF b49ca5707e2a3a08b560764078e4d526f7f44c42
+#define LLFIO_PREVIOUS_COMMIT_DATE "2018-11-09 09:20:58 +00:00"
+#define LLFIO_PREVIOUS_COMMIT_UNIQUE b49ca570
diff --git a/include/llfio/v2.0/algorithm/cached_parent_handle_adapter.hpp b/include/llfio/v2.0/algorithm/handle_adapter/cached_parent.hpp
index 308d8451..bbc2c7ab 100644
--- a/include/llfio/v2.0/algorithm/cached_parent_handle_adapter.hpp
+++ b/include/llfio/v2.0/algorithm/handle_adapter/cached_parent.hpp
@@ -25,7 +25,7 @@ Distributed under the Boost Software License, Version 1.0.
#ifndef LLFIO_CACHED_PARENT_HANDLE_ADAPTER_HPP
#define LLFIO_CACHED_PARENT_HANDLE_ADAPTER_HPP
-#include "../directory_handle.hpp"
+#include "../../directory_handle.hpp"
#ifdef _MSC_VER
#pragma warning(push)
@@ -209,7 +209,7 @@ LLFIO_V2_NAMESPACE_END
#if LLFIO_HEADERS_ONLY == 1 && !defined(DOXYGEN_SHOULD_SKIP_THIS)
#define LLFIO_INCLUDED_BY_HEADER 1
-#include "../detail/impl/cached_parent_handle_adapter.ipp"
+#include "../../detail/impl/cached_parent_handle_adapter.ipp"
#undef LLFIO_INCLUDED_BY_HEADER
#endif
diff --git a/include/llfio/v2.0/detail/impl/cached_parent_handle_adapter.ipp b/include/llfio/v2.0/detail/impl/cached_parent_handle_adapter.ipp
index e966a25c..30d84519 100644
--- a/include/llfio/v2.0/detail/impl/cached_parent_handle_adapter.ipp
+++ b/include/llfio/v2.0/detail/impl/cached_parent_handle_adapter.ipp
@@ -22,7 +22,7 @@ Distributed under the Boost Software License, Version 1.0.
http://www.boost.org/LICENSE_1_0.txt)
*/
-#include "../../algorithm/cached_parent_handle_adapter.hpp"
+#include "../../algorithm/handle_adapter/cached_parent.hpp"
#include <mutex>
#include <unordered_map>
diff --git a/include/llfio/v2.0/fast_random_file_handle.hpp b/include/llfio/v2.0/fast_random_file_handle.hpp
index fb51024f..233feeb5 100644
--- a/include/llfio/v2.0/fast_random_file_handle.hpp
+++ b/include/llfio/v2.0/fast_random_file_handle.hpp
@@ -49,11 +49,11 @@ Note that writes to this handle are permitted if it was opened with write permis
but writes have no effect.
The use for a file handle full of random data may not be obvious. The first is
-to obfuscate another file's data using `algorithm::xor_file_handle`. The second is
+to obfuscate another file's data using `algorithm::xor_handle_adapter`. The second is
for mock ups in testing, where this file handle stands in for some other (large) file,
and you are testing throughput or latency in processing code.
-The third is for unit testing randomly corrupted file data. `algorithm::mix_file_handle`
+The third is for unit testing randomly corrupted file data. `algorithm::mix_handle_adapter`
can randomly mix scatter gather buffers from this file handle into another file handle
in order to test how well handling code copes with random data corruption.
@@ -74,7 +74,7 @@ approach `memcpy()` in performance. One would probably need to use AVX-512 howev
as the JSF PRNG makes heavy use of bit rotation, which is slow before AVX-512 as it
must be emulated with copious bit shifting and masking.
*/
-class fast_random_file_handle : public file_handle
+class LLFIO_DECL fast_random_file_handle : public file_handle
{
public:
using dev_t = file_handle::dev_t;
@@ -203,6 +203,7 @@ public:
/*! \brief Resize the current maximum permitted extent of the random file to the given extent.
*/
+ LLFIO_MAKE_FREE_FUNCTION
LLFIO_HEADERS_ONLY_VIRTUAL_SPEC result<extent_type> truncate(extent_type newsize) noexcept override
{
OUTCOME_TRY(_perms_check());
@@ -211,12 +212,17 @@ public:
}
//! \brief Zero a portion of the random file (does nothing).
+ LLFIO_MAKE_FREE_FUNCTION
LLFIO_HEADERS_ONLY_VIRTUAL_SPEC result<extent_type> zero(extent_type /*unused*/, extent_type bytes, deadline /*unused*/ = deadline()) noexcept override
{
OUTCOME_TRY(_perms_check());
return bytes;
}
+ //! \brief Return a single extent of the maximum extent
+ LLFIO_HEADERS_ONLY_VIRTUAL_SPEC result<std::vector<std::pair<extent_type, extent_type>>> extents() const noexcept override { return std::vector<std::pair<extent_type, extent_type>>{{0, _length}}; }
+
+
using file_handle::read;
using file_handle::write;
@@ -232,6 +238,7 @@ public:
\errors None possible.
\mallocs None possible.
*/
+ LLFIO_MAKE_FREE_FUNCTION
LLFIO_HEADERS_ONLY_VIRTUAL_SPEC io_result<buffers_type> read(io_request<buffers_type> reqs, deadline /* unused */ = deadline()) noexcept override;
/*! \brief Fails to write to the random file.
@@ -245,6 +252,7 @@ public:
\errors None possible if handle was opened with write permissions.
\mallocs None possible.
*/
+ LLFIO_MAKE_FREE_FUNCTION
LLFIO_HEADERS_ONLY_VIRTUAL_SPEC io_result<const_buffers_type> write(io_request<const_buffers_type> reqs, deadline /* unused */ = deadline()) noexcept override
{
OUTCOME_TRY(_perms_check());
@@ -255,6 +263,37 @@ public:
}
return std::move(reqs.buffers);
}
+
+ LLFIO_MAKE_FREE_FUNCTION
+ LLFIO_HEADERS_ONLY_VIRTUAL_SPEC io_result<const_buffers_type> barrier(io_request<const_buffers_type> reqs = io_request<const_buffers_type>(), bool /* unused */ = false, bool /* unused */ = false, deadline /* unused */ = deadline()) noexcept override
+ {
+ OUTCOME_TRY(_perms_check());
+ // Return null written
+ for(auto &buffer : reqs.buffers)
+ {
+ buffer = {buffer.data(), 0};
+ }
+ return std::move(reqs.buffers);
+ }
+
+private:
+ struct _extent_guard : public extent_guard
+ {
+ friend class fast_random_file_handle;
+ using extent_guard::extent_guard;
+ };
+
+public:
+ LLFIO_HEADERS_ONLY_VIRTUAL_SPEC result<extent_guard> lock(extent_type offset, extent_type bytes, bool exclusive = true, deadline /* unused */ = deadline()) noexcept override
+ {
+ // Lock nothing
+ return _extent_guard(this, offset, bytes, exclusive);
+ }
+
+ LLFIO_HEADERS_ONLY_VIRTUAL_SPEC void unlock(extent_type /*unused*/, extent_type /*unused*/) noexcept override
+ {
+ // Unlock nothing
+ }
};
//! \brief Constructor for `fast_random_file_handle`
diff --git a/include/llfio/v2.0/file_handle.hpp b/include/llfio/v2.0/file_handle.hpp
index b3e2afcc..084c5e78 100644
--- a/include/llfio/v2.0/file_handle.hpp
+++ b/include/llfio/v2.0/file_handle.hpp
@@ -218,6 +218,7 @@ public:
return io_handle::close();
}
+ LLFIO_MAKE_FREE_FUNCTION
LLFIO_HEADERS_ONLY_VIRTUAL_SPEC io_result<const_buffers_type> barrier(io_request<const_buffers_type> reqs = io_request<const_buffers_type>(), bool wait_for_device = false, bool and_metadata = false, deadline d = deadline()) noexcept override;
/*! Clone this handle (copy constructor is disabled to avoid accidental copying),
diff --git a/include/llfio/v2.0/handle.hpp b/include/llfio/v2.0/handle.hpp
index 430848c7..71095b79 100644
--- a/include/llfio/v2.0/handle.hpp
+++ b/include/llfio/v2.0/handle.hpp
@@ -88,9 +88,9 @@ public:
only_metadata = 2, //!< Cache reads and writes of metadata but avoid caching data (<tt>O_DIRECT</tt>), thus i/o here does not affect other cached data for other handles. Align all i/o to 4Kb boundaries for this to work.
reads = 3, //!< Cache reads only. Writes of data and metadata do not complete until reaching storage (<tt>O_SYNC</tt>). <tt>flag_disable_safety_fsyncs</tt> can be used here.
reads_and_metadata = 5, //!< Cache reads and writes of metadata, but writes of data do not complete until reaching storage (<tt>O_DSYNC</tt>). <tt>flag_disable_safety_fsyncs</tt> can be used here.
- all = 4, //!< Cache reads and writes of data and metadata so they complete immediately, sending writes to storage at some point when the kernel decides (this is the default file system caching on a system).
+ all = 6, //!< Cache reads and writes of data and metadata so they complete immediately, sending writes to storage at some point when the kernel decides (this is the default file system caching on a system).
safety_fsyncs = 7, //!< Cache reads and writes of data and metadata so they complete immediately, but issue safety fsyncs at certain points. See documentation for <tt>flag_disable_safety_fsyncs</tt>.
- temporary = 6 //!< Cache reads and writes of data and metadata so they complete immediately, only sending any updates to storage on last handle close in the system or if memory becomes tight as this file is expected to be temporary (Windows and FreeBSD only).
+ temporary = 8 //!< Cache reads and writes of data and metadata so they complete immediately, only sending any updates to storage on last handle close in the system or if memory becomes tight as this file is expected to be temporary (Windows and FreeBSD only).
// NOTE: IF UPDATING THIS UPDATE THE std::ostream PRINTER BELOW!!!
};
//! Bitwise flags which can be specified
@@ -161,6 +161,13 @@ public:
can specify this flag to prevent that happening.
*/
win_disable_sparse_file_creation = 1U << 25U,
+ /*! Filesystems tend to be embarrassingly parallel for operations performed to different
+ inodes. Where LLFIO performs i/o to multiple inodes at a time, it will use OpenMP or
+ the Parallelism or Concurrency standard library extensions to usually complete the
+ operation in constant rather than linear time. If you don't want this default, you can
+ disable default using this flag.
+ */
+ disable_parallelism = 1U << 26U,
// NOTE: IF UPDATING THIS UPDATE THE std::ostream PRINTER BELOW!!!
@@ -380,6 +387,10 @@ inline std::ostream &operator<<(std::ostream &s, const handle::flag &v)
{
temp.append("win_disable_sparse_file_creation|");
}
+ if(!!(v & handle::flag::disable_parallelism))
+ {
+ temp.append("disable_parallelism|");
+ }
if(!!(v & handle::flag::overlapped))
{
temp.append("overlapped|");
diff --git a/include/llfio/v2.0/io_handle.hpp b/include/llfio/v2.0/io_handle.hpp
index 87bdd0ee..b0d87aa6 100644
--- a/include/llfio/v2.0/io_handle.hpp
+++ b/include/llfio/v2.0/io_handle.hpp
@@ -392,6 +392,8 @@ public:
io_handle *_h{nullptr};
extent_type _offset{0}, _length{0};
bool _exclusive{false};
+
+ protected:
constexpr extent_guard(io_handle *h, extent_type offset, extent_type length, bool exclusive)
: _h(h)
, _offset(offset)
diff --git a/include/llfio/v2.0/llfio.hpp b/include/llfio/v2.0/llfio.hpp
index 6aef10cd..35e0973e 100644
--- a/include/llfio/v2.0/llfio.hpp
+++ b/include/llfio/v2.0/llfio.hpp
@@ -76,7 +76,7 @@ import LLFIO_MODULE_NAME;
#include "fast_random_file_handle.hpp"
#include "symlink_handle.hpp"
-#include "algorithm/cached_parent_handle_adapter.hpp"
+#include "algorithm/handle_adapter/cached_parent.hpp"
#include "algorithm/shared_fs_mutex/atomic_append.hpp"
#include "algorithm/shared_fs_mutex/byte_ranges.hpp"
#include "algorithm/shared_fs_mutex/lock_files.hpp"
diff --git a/include/llfio/v2.0/outcome b/include/llfio/v2.0/outcome
-Subproject 74ec16d010f30b15f2059dac85ff268ab077dd6
+Subproject 9d8e3ff7a7ab2aeae4fcea59bc766043bc6db75