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:
-rw-r--r--example/use_cases.cpp3
-rw-r--r--include/llfio/v2.0/detail/impl/windows/file_handle.ipp4
-rw-r--r--include/llfio/v2.0/detail/impl/windows/handle.ipp2
-rw-r--r--include/llfio/v2.0/detail/impl/windows/import.hpp4
-rw-r--r--include/llfio/v2.0/handle.hpp12
5 files changed, 14 insertions, 11 deletions
diff --git a/example/use_cases.cpp b/example/use_cases.cpp
index 9237f5e1..160bcc9f 100644
--- a/example/use_cases.cpp
+++ b/example/use_cases.cpp
@@ -213,6 +213,9 @@ void malloc1()
// to a page, it will be page faulted into a private page by the kernel.
llfio::byte *p = mh.address();
size_t len = mh.length();
+ // map_handle::address() returns indeterminate bytes, so you need to bless
+ // them into existence before use
+ llfio::bless(p, len);
memset(p, 'a', len);
// Tell the kernel to throw away the contents of any whole pages
diff --git a/include/llfio/v2.0/detail/impl/windows/file_handle.ipp b/include/llfio/v2.0/detail/impl/windows/file_handle.ipp
index 82c855ae..be18b08a 100644
--- a/include/llfio/v2.0/detail/impl/windows/file_handle.ipp
+++ b/include/llfio/v2.0/detail/impl/windows/file_handle.ipp
@@ -163,7 +163,7 @@ result<file_handle> file_handle::file(const path_handle &base, file_handle::path
#endif
}
}
- if(_creation == creation::truncate && ret.value().are_safety_fsyncs_issued())
+ if(_creation == creation::truncate && ret.value().are_safety_barriers_issued())
{
FlushFileBuffers(nativeh.h);
}
@@ -363,7 +363,7 @@ result<file_handle::extent_type> file_handle::truncate(file_handle::extent_type
{
return win32_error();
}
- if(are_safety_fsyncs_issued())
+ if(are_safety_barriers_issued())
{
FlushFileBuffers(_v.h);
}
diff --git a/include/llfio/v2.0/detail/impl/windows/handle.ipp b/include/llfio/v2.0/detail/impl/windows/handle.ipp
index e3d0e851..e1703dcd 100644
--- a/include/llfio/v2.0/detail/impl/windows/handle.ipp
+++ b/include/llfio/v2.0/detail/impl/windows/handle.ipp
@@ -83,7 +83,7 @@ result<void> handle::close() noexcept
abort();
}
#endif
- if(are_safety_fsyncs_issued() && is_writable())
+ if(are_safety_barriers_issued() && is_writable())
{
if(FlushFileBuffers(_v.h) == 0)
{
diff --git a/include/llfio/v2.0/detail/impl/windows/import.hpp b/include/llfio/v2.0/detail/impl/windows/import.hpp
index 6d22daab..4164ddf9 100644
--- a/include/llfio/v2.0/detail/impl/windows/import.hpp
+++ b/include/llfio/v2.0/detail/impl/windows/import.hpp
@@ -1215,7 +1215,7 @@ inline result<DWORD> attributes_from_handle_caching_and_flags(native_handle_type
attribs |= FILE_FLAG_WRITE_THROUGH;
break;
case handle::caching::all:
- case handle::caching::safety_fsyncs:
+ case handle::caching::safety_barriers:
break;
case handle::caching::temporary:
attribs |= FILE_ATTRIBUTE_TEMPORARY;
@@ -1263,7 +1263,7 @@ inline result<DWORD> ntflags_from_handle_caching_and_flags(native_handle_type &n
ntflags |= 0x00000002 /*FILE_WRITE_THROUGH*/;
break;
case handle::caching::all:
- case handle::caching::safety_fsyncs:
+ case handle::caching::safety_barriers:
break;
case handle::caching::temporary:
// should be handled by attributes_from_handle_caching_and_flags
diff --git a/include/llfio/v2.0/handle.hpp b/include/llfio/v2.0/handle.hpp
index 71095b79..d41e3b55 100644
--- a/include/llfio/v2.0/handle.hpp
+++ b/include/llfio/v2.0/handle.hpp
@@ -89,7 +89,7 @@ public:
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 = 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>.
+ safety_barriers = 7, //!< Cache reads and writes of data and metadata so they complete immediately, but issue safety barriers at certain points. See documentation for <tt>flag_disable_safety_barriers</tt>.
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!!!
};
@@ -123,9 +123,9 @@ public:
* caching::none
* caching::reads
* caching::reads_and_metadata
- * caching::safety_fsyncs
+ * caching::safety_barriers
*/
- disable_safety_fsyncs = 1U << 2U,
+ disable_safety_barriers = 1U << 2U,
/*! `file_handle::unlink()` could accidentally delete the wrong file if someone has
renamed the open file handle since the time it was opened. To prevent this occuring,
where the OS doesn't provide race free unlink-by-open-handle we compare the inode of
@@ -316,7 +316,7 @@ public:
//! True if writes are safely on storage on completion
bool are_writes_durable() const noexcept { return _caching == caching::none || _caching == caching::reads || _caching == caching::reads_and_metadata; }
//! True if issuing safety fsyncs is on
- bool are_safety_fsyncs_issued() const noexcept { return !(_flags & flag::disable_safety_fsyncs) && !((static_cast<unsigned>(_caching) & 1U) == 0U); }
+ bool are_safety_barriers_issued() const noexcept { return !(_flags & flag::disable_safety_barriers) && !((static_cast<unsigned>(_caching) & 1U) == 0U); }
//! The flags this handle was opened with
flag flags() const noexcept { return _flags; }
@@ -367,9 +367,9 @@ inline std::ostream &operator<<(std::ostream &s, const handle::flag &v)
{
temp.append("unlink_on_first_close|");
}
- if(!!(v & handle::flag::disable_safety_fsyncs))
+ if(!!(v & handle::flag::disable_safety_barriers))
{
- temp.append("disable_safety_fsyncs|");
+ temp.append("disable_safety_barriers|");
}
if(!!(v & handle::flag::disable_prefetching))
{