Skip to content

Commit

Permalink
file, scheduling: remove non-unified I/O and CPU scheduling
Browse files Browse the repository at this point in the history
In f94b1bb ("Merge 'Unify CPU scheduling groups and
IO priority classes' from Pavel Emelyanov"), we folded I/O scheduling
control into scheduling groups. This was more than a year ago. As it
was a breaking change, we introduced API_LEVEL 7 to avoid breaking users.
We now make API_LEVEL 7 mandatory and remove non-unified scheduling
support.

Closes scylladb#2455
  • Loading branch information
avikivity authored and xemul committed Oct 4, 2024
1 parent 7dec776 commit 3e07190
Show file tree
Hide file tree
Showing 15 changed files with 3 additions and 648 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ set (Seastar_API_LEVEL
"7"
CACHE
STRING
"Seastar compatibility API level (5=future<T>::get() returns T&&, 6=future is not variadic, 7=unified CPU/IO scheduling groups")
"Seastar compatibility API level (7=unified CPU/IO scheduling groups")

set_property (CACHE Seastar_API_LEVEL
PROPERTY
STRINGS 6)
STRINGS 7)

set (Seastar_SCHEDULING_GROUPS_COUNT
"16"
Expand Down
2 changes: 1 addition & 1 deletion doc/compatibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ API Level History
| 4 | 2020-06 | 2023-03 | Non-variadic futures in when_all_succeed() |
| 5 | 2020-08 | 2023-03 | future::get() returns std::monostate() instead of void |
| 6 | 2020-09 | 2023-03 | future<T> instead of future<T...> |
| 7 | 2023-05 | | unified CPU/IO scheduling groups |
| 7 | 2023-05 | 2024-09 | unified CPU/IO scheduling groups |


Note: The "mandatory" column indicates when backwards compatibility
Expand Down
191 changes: 0 additions & 191 deletions include/seastar/core/file.hh
Original file line number Diff line number Diff line change
Expand Up @@ -137,35 +137,11 @@ protected:
public:
virtual ~file_impl() {}

#if SEASTAR_API_LEVEL >= 7
virtual future<size_t> write_dma(uint64_t pos, const void* buffer, size_t len, io_intent*) = 0;
virtual future<size_t> write_dma(uint64_t pos, std::vector<iovec> iov, io_intent*) = 0;
virtual future<size_t> read_dma(uint64_t pos, void* buffer, size_t len, io_intent*) = 0;
virtual future<size_t> read_dma(uint64_t pos, std::vector<iovec> iov, io_intent*) = 0;
virtual future<temporary_buffer<uint8_t>> dma_read_bulk(uint64_t offset, size_t range_size, io_intent*) = 0;
#else
virtual future<size_t> write_dma(uint64_t pos, const void* buffer, size_t len, const io_priority_class& pc) = 0;
virtual future<size_t> write_dma(uint64_t pos, std::vector<iovec> iov, const io_priority_class& pc) = 0;
virtual future<size_t> read_dma(uint64_t pos, void* buffer, size_t len, const io_priority_class& pc) = 0;
virtual future<size_t> read_dma(uint64_t pos, std::vector<iovec> iov, const io_priority_class& pc) = 0;
virtual future<temporary_buffer<uint8_t>> dma_read_bulk(uint64_t offset, size_t range_size, const io_priority_class& pc) = 0;

virtual future<size_t> write_dma(uint64_t pos, const void* buffer, size_t len, const io_priority_class& pc, io_intent*) {
return write_dma(pos, buffer, len, pc);
}
virtual future<size_t> write_dma(uint64_t pos, std::vector<iovec> iov, const io_priority_class& pc, io_intent*) {
return write_dma(pos, std::move(iov), pc);
}
virtual future<size_t> read_dma(uint64_t pos, void* buffer, size_t len, const io_priority_class& pc, io_intent*) {
return read_dma(pos, buffer, len, pc);
}
virtual future<size_t> read_dma(uint64_t pos, std::vector<iovec> iov, const io_priority_class& pc, io_intent*) {
return read_dma(pos, std::move(iov), pc);
}
virtual future<temporary_buffer<uint8_t>> dma_read_bulk(uint64_t offset, size_t range_size, const io_priority_class& pc, io_intent*) {
return dma_read_bulk(offset, range_size, pc);
}
#endif

virtual future<> flush() = 0;
virtual future<struct stat> stat() = 0;
Expand Down Expand Up @@ -289,32 +265,6 @@ public:
return _file_impl->_write_max_length;
}

#if SEASTAR_API_LEVEL < 7
/**
* Perform a single DMA read operation.
*
* @param aligned_pos offset to begin reading at (should be aligned)
* @param aligned_buffer output buffer (should be aligned)
* @param aligned_len number of bytes to read (should be aligned)
* @param pc the IO priority class under which to queue this operation
* @param intent the IO intention confirmation (\ref seastar::io_intent)
*
* Alignment is HW dependent but use 4KB alignment to be on the safe side as
* explained above.
*
* ATTN: The method is going to be deprecated
*
* @return number of bytes actually read
* or exceptional future in case of I/O error
*/
template <typename CharType>
[[deprecated("Use scheduling_groups and API level >= 7")]]
future<size_t>
dma_read(uint64_t aligned_pos, CharType* aligned_buffer, size_t aligned_len, const io_priority_class& pc, io_intent* intent = nullptr) noexcept {
return dma_read_impl(aligned_pos, reinterpret_cast<uint8_t*>(aligned_buffer), aligned_len, internal::maybe_priority_class_ref(pc), intent);
}
#endif

/**
* Perform a single DMA read operation.
*
Expand All @@ -335,34 +285,6 @@ public:
return dma_read_impl(aligned_pos, reinterpret_cast<uint8_t*>(aligned_buffer), aligned_len, internal::maybe_priority_class_ref(), intent);
}

#if SEASTAR_API_LEVEL < 7
/**
* Read the requested amount of bytes starting from the given offset.
*
* @param pos offset to begin reading from
* @param len number of bytes to read
* @param pc the IO priority class under which to queue this operation
* @param intent the IO intention confirmation (\ref seastar::io_intent)
*
* @return temporary buffer containing the requested data.
* or exceptional future in case of I/O error
*
* This function doesn't require any alignment for both "pos" and "len"
*
* ATTN: The method is going to be deprecated
*
* @note size of the returned buffer may be smaller than "len" if EOF is
* reached or in case of I/O error.
*/
template <typename CharType>
[[deprecated("Use scheduling_groups and API level >= 7")]]
future<temporary_buffer<CharType>> dma_read(uint64_t pos, size_t len, const io_priority_class& pc, io_intent* intent = nullptr) noexcept {
return dma_read_impl(pos, len, internal::maybe_priority_class_ref(pc), intent).then([] (temporary_buffer<uint8_t> t) {
return temporary_buffer<CharType>(reinterpret_cast<CharType*>(t.get_write()), t.size(), t.release());
});
}
#endif

/**
* Read the requested amount of bytes starting from the given offset.
*
Expand All @@ -389,32 +311,6 @@ public:
/// with \ref dma_read_exactly().
class eof_error : public std::exception {};

#if SEASTAR_API_LEVEL < 7
/**
* Read the exact amount of bytes.
*
* @param pos offset in a file to begin reading from
* @param len number of bytes to read
* @param pc the IO priority class under which to queue this operation
* @param intent the IO intention confirmation (\ref seastar::io_intent)
*
* ATTN: The method is going to be deprecated
*
* @return temporary buffer containing the read data
* or exceptional future in case an error, holding:
* end_of_file_error if EOF is reached, file_io_error or
* std::system_error in case of I/O error.
*/
template <typename CharType>
[[deprecated("Use scheduling_groups and API level >= 7")]]
future<temporary_buffer<CharType>>
dma_read_exactly(uint64_t pos, size_t len, const io_priority_class& pc, io_intent* intent = nullptr) noexcept {
return dma_read_exactly_impl(pos, len, internal::maybe_priority_class_ref(pc), intent).then([] (temporary_buffer<uint8_t> t) {
return temporary_buffer<CharType>(reinterpret_cast<CharType*>(t.get_write()), t.size(), t.release());
});
}
#endif

/**
* Read the exact amount of bytes.
*
Expand All @@ -435,25 +331,6 @@ public:
});
}

#if SEASTAR_API_LEVEL < 7
/// Performs a DMA read into the specified iovec.
///
/// \param pos offset to read from. Must be aligned to \ref disk_read_dma_alignment.
/// \param iov vector of address/size pairs to read into. Addresses must be
/// aligned.
/// \param pc the IO priority class under which to queue this operation
/// \param intent the IO intention confirmation (\ref seastar::io_intent)
///
/// ATTN: The method is going to be deprecated
///
/// \return a future representing the number of bytes actually read. A short
/// read may happen due to end-of-file or an I/O error.
[[deprecated("Use scheduling_groups and API level >= 7")]]
future<size_t> dma_read(uint64_t pos, std::vector<iovec> iov, const io_priority_class& pc, io_intent* intent = nullptr) noexcept {
return dma_read_impl(pos, std::move(iov), internal::maybe_priority_class_ref(pc), intent);
}
#endif

/// Performs a DMA read into the specified iovec.
///
/// \param pos offset to read from. Must be aligned to \ref disk_read_dma_alignment.
Expand All @@ -467,27 +344,6 @@ public:
return dma_read_impl(pos, std::move(iov), internal::maybe_priority_class_ref(), intent);
}

#if SEASTAR_API_LEVEL < 7
/// Performs a DMA write from the specified buffer.
///
/// \param pos offset to write into. Must be aligned to \ref disk_write_dma_alignment.
/// \param buffer aligned address of buffer to read from. Buffer must exists
/// until the future is made ready.
/// \param len number of bytes to write. Must be aligned.
/// \param pc the IO priority class under which to queue this operation
/// \param intent the IO intention confirmation (\ref seastar::io_intent)
///
/// ATTN: The method is going to be deprecated
///
/// \return a future representing the number of bytes actually written. A short
/// write may happen due to an I/O error.
template <typename CharType>
[[deprecated("Use scheduling_groups and API level >= 7")]]
future<size_t> dma_write(uint64_t pos, const CharType* buffer, size_t len, const io_priority_class& pc, io_intent* intent = nullptr) noexcept {
return dma_write_impl(pos, reinterpret_cast<const uint8_t*>(buffer), len, internal::maybe_priority_class_ref(pc), intent);
}
#endif

/// Performs a DMA write from the specified buffer.
///
/// \param pos offset to write into. Must be aligned to \ref disk_write_dma_alignment.
Expand All @@ -503,25 +359,6 @@ public:
return dma_write_impl(pos, reinterpret_cast<const uint8_t*>(buffer), len, internal::maybe_priority_class_ref(), intent);
}

#if SEASTAR_API_LEVEL < 7
/// Performs a DMA write to the specified iovec.
///
/// \param pos offset to write into. Must be aligned to \ref disk_write_dma_alignment.
/// \param iov vector of address/size pairs to write from. Addresses must be
/// aligned.
/// \param pc the IO priority class under which to queue this operation
/// \param intent the IO intention confirmation (\ref seastar::io_intent)
///
/// ATTN: The method is going to be deprecated
///
/// \return a future representing the number of bytes actually written. A short
/// write may happen due to an I/O error.
[[deprecated("Use scheduling_groups and API level >= 7")]]
future<size_t> dma_write(uint64_t pos, std::vector<iovec> iov, const io_priority_class& pc, io_intent* intent = nullptr) noexcept {
return dma_write_impl(pos, std::move(iov), internal::maybe_priority_class_ref(pc), intent);
}
#endif

/// Performs a DMA write to the specified iovec.
///
/// \param pos offset to write into. Must be aligned to \ref disk_write_dma_alignment.
Expand Down Expand Up @@ -702,34 +539,6 @@ public:
// buffered generator yet.
coroutine::experimental::generator<directory_entry> experimental_list_directory();

#if SEASTAR_API_LEVEL < 7
/**
* Read a data bulk containing the provided addresses range that starts at
* the given offset and ends at either the address aligned to
* dma_alignment (4KB) or at the file end.
*
* @param offset starting address of the range the read bulk should contain
* @param range_size size of the addresses range
* @param pc the IO priority class under which to queue this operation
* @param intent the IO intention confirmation (\ref seastar::io_intent)
*
* ATTN: The method is going to be deprecated
*
* @return temporary buffer containing the read data bulk.
* or exceptional future holding:
* system_error exception in case of I/O error or eof_error when
* "offset" is beyond EOF.
*/
template <typename CharType>
[[deprecated("Use scheduling_groups and API level >= 7")]]
future<temporary_buffer<CharType>>
dma_read_bulk(uint64_t offset, size_t range_size, const io_priority_class& pc, io_intent* intent = nullptr) noexcept {
return dma_read_bulk_impl(offset, range_size, internal::maybe_priority_class_ref(pc), intent).then([] (temporary_buffer<uint8_t> t) {
return temporary_buffer<CharType>(reinterpret_cast<CharType*>(t.get_write()), t.size(), t.release());
});
}
#endif

/**
* Read a data bulk containing the provided addresses range that starts at
* the given offset and ends at either the address aligned to
Expand Down
6 changes: 0 additions & 6 deletions include/seastar/core/fstream.hh
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ class file_input_stream_history {
struct file_input_stream_options {
size_t buffer_size = 8192; ///< I/O buffer size
unsigned read_ahead = 0; ///< Maximum number of extra read-ahead operations
#if SEASTAR_API_LEVEL < 7
::seastar::io_priority_class io_priority_class = default_priority_class();
#endif
lw_shared_ptr<file_input_stream_history> dynamic_adjustments = { }; ///< Input stream history, if null dynamic adjustments are disabled
};

Expand Down Expand Up @@ -107,9 +104,6 @@ struct file_output_stream_options {
unsigned buffer_size = 65536;
unsigned preallocation_size = 0; ///< Preallocate extents. For large files, set to a large number (a few megabytes) to reduce fragmentation
unsigned write_behind = 1; ///< Number of buffers to write in parallel
#if SEASTAR_API_LEVEL < 7
::seastar::io_priority_class io_priority_class = default_priority_class();
#endif
};

/// Create an output_stream for writing starting at the position zero of a
Expand Down
12 changes: 0 additions & 12 deletions include/seastar/core/internal/api-level.hh
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,10 @@
#define SEASTAR_INCLUDE_API_V7
#endif

#if SEASTAR_API_LEVEL == 6
#define SEASTAR_INCLUDE_API_V6 inline
#else
#define SEASTAR_INCLUDE_API_V6
#endif


// Declare them here so we don't have to use the macros everywhere
namespace seastar {
SEASTAR_INCLUDE_API_V6 namespace api_v6 {
inline namespace and_newer {
}
}
SEASTAR_INCLUDE_API_V7 namespace api_v7 {
inline namespace and_newer {
using namespace api_v6::and_newer;
}
}
}
Loading

0 comments on commit 3e07190

Please sign in to comment.