diff options
author | Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com> | 2019-11-22 21:09:02 +0300 |
---|---|---|
committer | Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com> | 2019-11-22 21:09:02 +0300 |
commit | 6d5d653535694e55cf8b2c9022c7f68debb7057d (patch) | |
tree | fb25ad77b825c0c02d61feb0bb1bd613e72af698 /include/llfio/v2.0/algorithm | |
parent | 553f85c066250eb3dffa8b3b6990a0353d7a7edf (diff) |
Move lock_kind out of lockable_io_handle. Fix failure to unlock in moved unique_file_lock.
Diffstat (limited to 'include/llfio/v2.0/algorithm')
-rw-r--r-- | include/llfio/v2.0/algorithm/shared_fs_mutex/atomic_append.hpp | 10 | ||||
-rw-r--r-- | include/llfio/v2.0/algorithm/shared_fs_mutex/byte_ranges.hpp | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/include/llfio/v2.0/algorithm/shared_fs_mutex/atomic_append.hpp b/include/llfio/v2.0/algorithm/shared_fs_mutex/atomic_append.hpp index f6a9ff8f..1d05a970 100644 --- a/include/llfio/v2.0/algorithm/shared_fs_mutex/atomic_append.hpp +++ b/include/llfio/v2.0/algorithm/shared_fs_mutex/atomic_append.hpp @@ -206,7 +206,7 @@ namespace algorithm OUTCOME_TRY(ret, file_handle::file(base, lockfile, file_handle::mode::write, file_handle::creation::if_needed, file_handle::caching::temporary)); atomic_append_detail::header header; // Lock the entire header for exclusive access - auto lockresult = ret.lock_file_range(0, sizeof(header), file_handle::lock_kind::exclusive, std::chrono::seconds(0)); + auto lockresult = ret.lock_file_range(0, sizeof(header), lock_kind::exclusive, std::chrono::seconds(0)); //! \todo fs_mutex_append needs to check if file still exists after lock is granted, awaiting path fetching. if(lockresult.has_error()) { @@ -231,7 +231,7 @@ namespace algorithm OUTCOME_TRYV(ret.write(0, {{reinterpret_cast<byte *>(&header), sizeof(header)}})); } // Open a shared lock on last byte in header to prevent other users zomping the file - OUTCOME_TRY(guard, ret.lock_file_range(sizeof(header) - 1, 1, file_handle::lock_kind::shared)); + OUTCOME_TRY(guard, ret.lock_file_range(sizeof(header) - 1, 1, lock_kind::shared)); // Unlock any exclusive lock I gained earlier now if(lockresult) { @@ -292,7 +292,7 @@ namespace algorithm auto lastbyte = static_cast<file_handle::extent_type>(-1); // Lock up to the beginning of the shadow lock space lastbyte &= ~(1ULL << 63U); - OUTCOME_TRY(append_guard_, _h.lock_file_range(my_lock_request_offset, lastbyte, file_handle::lock_kind::exclusive)); + OUTCOME_TRY(append_guard_, _h.lock_file_range(my_lock_request_offset, lastbyte, lock_kind::exclusive)); append_guard = std::move(append_guard_); } OUTCOME_TRYV(_h.write(0, {{reinterpret_cast<byte *>(&lock_request), sizeof(lock_request)}})); @@ -338,7 +338,7 @@ namespace algorithm auto lock_offset = my_lock_request_offset; // Set the top bit to use the shadow lock space on Windows lock_offset |= (1ULL << 63U); - OUTCOME_TRY(my_request_guard_, _h.lock_file_range(lock_offset, sizeof(lock_request), file_handle::lock_kind::exclusive)); + OUTCOME_TRY(my_request_guard_, _h.lock_file_range(lock_offset, sizeof(lock_request), lock_kind::exclusive)); my_request_guard = std::move(my_request_guard_); } @@ -446,7 +446,7 @@ namespace algorithm auto lock_offset = record_offset; // Set the top bit to use the shadow lock space on Windows lock_offset |= (1ULL << 63U); - OUTCOME_TRYV(_h.lock_file_range(lock_offset, sizeof(*record), file_handle::lock_kind::shared, nd)); + OUTCOME_TRYV(_h.lock_file_range(lock_offset, sizeof(*record), lock_kind::shared, nd)); } // Make sure we haven't timed out during this wait if(d) diff --git a/include/llfio/v2.0/algorithm/shared_fs_mutex/byte_ranges.hpp b/include/llfio/v2.0/algorithm/shared_fs_mutex/byte_ranges.hpp index 8ce650b9..bbd91a0e 100644 --- a/include/llfio/v2.0/algorithm/shared_fs_mutex/byte_ranges.hpp +++ b/include/llfio/v2.0/algorithm/shared_fs_mutex/byte_ranges.hpp @@ -179,7 +179,7 @@ namespace algorithm } } } - auto outcome = _h.lock_file_range(out.entities[n].value, 1, (out.entities[n].exclusive != 0u) ? file_handle::lock_kind::exclusive : file_handle::lock_kind::shared, nd); + auto outcome = _h.lock_file_range(out.entities[n].value, 1, (out.entities[n].exclusive != 0u) ? lock_kind::exclusive : lock_kind::shared, nd); if(!outcome) { was_contended = n; |