diff options
author | Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com> | 2018-05-31 11:10:01 +0300 |
---|---|---|
committer | Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com> | 2018-05-31 11:10:01 +0300 |
commit | adce05d59baf2f063244a02efe26f6c7ad9865a2 (patch) | |
tree | 8dc71a1a543700ea86d6d0a4f77a6f1111a096e5 | |
parent | ec7484bf4dc37cf23f89b1d84ba5305a6fd856ff (diff) |
Fix file_handle::barrier() not working, at all, on Windows.
-rw-r--r-- | include/afio/revision.hpp | 6 | ||||
-rw-r--r-- | include/afio/v2.0/detail/impl/windows/file_handle.ipp | 10 | ||||
-rw-r--r-- | include/afio/v2.0/detail/impl/windows/import.hpp | 2 | ||||
m--------- | include/afio/v2.0/outcome | 0 | ||||
m--------- | include/afio/v2.0/quickcpplib | 0 | ||||
-rw-r--r-- | programs/benchmark-iostreams/main.cpp | 17 | ||||
m--------- | test/kerneltest | 0 |
7 files changed, 23 insertions, 12 deletions
diff --git a/include/afio/revision.hpp b/include/afio/revision.hpp index 3ac36e29..475a47b1 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 b1dc5922f0f56782e50aa2af2655c0235d67ecd0 -#define AFIO_PREVIOUS_COMMIT_DATE "2018-05-28 18:22:45 +00:00" -#define AFIO_PREVIOUS_COMMIT_UNIQUE b1dc5922 +#define AFIO_PREVIOUS_COMMIT_REF ec7484bf4dc37cf23f89b1d84ba5305a6fd856ff +#define AFIO_PREVIOUS_COMMIT_DATE "2018-05-29 17:47:33 +00:00" +#define AFIO_PREVIOUS_COMMIT_UNIQUE ec7484bf 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 a4c913ae..e3d7fb27 100644 --- a/include/afio/v2.0/detail/impl/windows/file_handle.ipp +++ b/include/afio/v2.0/detail/impl/windows/file_handle.ipp @@ -314,15 +314,15 @@ file_handle::io_result<file_handle::const_buffers_type> file_handle::barrier(fil auto *isb = reinterpret_cast<IO_STATUS_BLOCK *>(&ol); *isb = make_iostatus(); ULONG flags = 0; - if(!wait_for_device) + if(!wait_for_device && !and_metadata) { - flags |= 2 /*FLUSH_FLAGS_NO_SYNC*/; + flags = 1 /*FLUSH_FLAGS_FILE_DATA_ONLY*/; } - if(!and_metadata) + else if(!wait_for_device) { - flags |= 1 /*FLUSH_FLAGS_FILE_DATA_ONLY*/; + flags = 2 /*FLUSH_FLAGS_NO_SYNC*/; } - NTSTATUS ntstat = NtFlushBuffersFileEx(_v.h, flags, isb); + NTSTATUS ntstat = NtFlushBuffersFileEx(_v.h, flags, nullptr, 0, isb); if(STATUS_PENDING == ntstat) { ntstat = ntwait(_v.h, ol, d); diff --git a/include/afio/v2.0/detail/impl/windows/import.hpp b/include/afio/v2.0/detail/impl/windows/import.hpp index aae66348..dbdaaa91 100644 --- a/include/afio/v2.0/detail/impl/windows/import.hpp +++ b/include/afio/v2.0/detail/impl/windows/import.hpp @@ -298,7 +298,7 @@ namespace windows_nt_kernel using NtUnmapViewOfSection_t = NTSTATUS(NTAPI *)(_In_ HANDLE ProcessHandle, _In_opt_ PVOID BaseAddress); - using NtFlushBuffersFileEx_t = NTSTATUS(NTAPI *)(_In_ HANDLE FileHandle, _In_ ULONG Flags, _Out_ PIO_STATUS_BLOCK IoStatusBlock); + using NtFlushBuffersFileEx_t = NTSTATUS(NTAPI *)(_In_ HANDLE FileHandle, _In_ ULONG Flags, _In_reads_bytes_(ParametersSize) PVOID Parameters, _In_ ULONG ParametersSize, _Out_ PIO_STATUS_BLOCK IoStatusBlock); using NtSetSystemInformation_t = NTSTATUS(NTAPI *)(_In_ INT SystemInformationClass, _In_ PVOID SystemInformation, _In_ ULONG SystemInformationLength); diff --git a/include/afio/v2.0/outcome b/include/afio/v2.0/outcome -Subproject 4f12238c22e16052949413704d30a4eae6aecd5 +Subproject 9d0236d082e1e39603a6ffae23a1d9dd93cf328 diff --git a/include/afio/v2.0/quickcpplib b/include/afio/v2.0/quickcpplib -Subproject 71e7d496a726771aa92cb3ec5539f917d342d6e +Subproject aaafa3ebe6330a4709bf58891ee02d4b521d4b6 diff --git a/programs/benchmark-iostreams/main.cpp b/programs/benchmark-iostreams/main.cpp index 9d192a98..50d5ed92 100644 --- a/programs/benchmark-iostreams/main.cpp +++ b/programs/benchmark-iostreams/main.cpp @@ -26,7 +26,11 @@ Distributed under the Boost Software License, Version 1.0. #define REGIONSIZE (100 * 1024 * 1024) #include "../../include/afio/afio.hpp" +#if __has_include("quickcpplib/include/algorithm/small_prng.hpp") +#include "quickcpplib/include/algorithm/small_prng.hpp" +#else #include "../../include/afio/v2.0/quickcpplib/include/algorithm/small_prng.hpp" +#endif #include <chrono> #include <fstream> @@ -142,11 +146,16 @@ template <class F> inline void run_test(const char *csv, off_t max_extent, F &&f int main() { - nanoclock(); { - std::ofstream testfile("testfile"); + auto th = afio::file({}, "testfile", afio::file_handle::mode::write, afio::file_handle::creation::if_needed).value(); std::vector<char> buffer(REGIONSIZE, 'a'); - testfile.write(buffer.data(), buffer.size()); + th.write(0, {{(afio::byte *) buffer.data(), buffer.size()}}).value(); + th.barrier({}, true, true).value(); + } + { + auto begin = nanoclock(); + while(nanoclock() - begin < 1000000000ULL) + ; } #if 0 { @@ -184,11 +193,13 @@ int main() testfile.read(buffer, len); }); } +#endif { std::cout << "Testing latency of afio::file_handle ..." << std::endl; auto th = afio::file({}, "testfile").value(); run_test("file_handle.csv", REGIONSIZE, [&](unsigned offset, char *buffer, size_t len) { th.read(offset, {{(afio::byte *) buffer, len}}).value(); }); } +#if 1 { std::cout << "Testing latency of afio::mapped_file_handle ..." << std::endl; auto th = afio::mapped_file({}, "testfile").value(); diff --git a/test/kerneltest b/test/kerneltest -Subproject 4a2e63e68412abf89b0685c2f5f9fae25deb685 +Subproject 807e2b14ede94551f1c9fc7eb3e079a27197dd9 |