Skip to content

Commit

Permalink
io_queue: rename io_desc_read_write to queued_io_request_completion
Browse files Browse the repository at this point in the history
This patch is a part of the preparation to route discard requests
via I/O scheduler.

The mentioned 'io_desc_read_write' is used to track the completion
of read and write requests submitted to 'io_sink'. It implements
'io_completion' interface -- its functions are invoked when the
processing of a request via 'reactor_backend' is finished.

In spite of the fact that 'fallocate()' is not supported by Linux AIO
and therefore, discards will not be submitted to 'io_sink' and processed
by 'reactor_backend', discard requests will need to notify 'io_queue'
about completion in the same way that reads and writes do. Thus, to avoid
code duplication 'io_desc_read_write' is renamed to 'queued_io_request_completion'
as it will be used by discard requests.

Signed-off-by: Patryk Wrobel <[email protected]>
  • Loading branch information
pwrobelse committed Jul 8, 2024
1 parent 378b776 commit c2fedbc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions include/seastar/core/io_queue.hh
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class io_sink;
using shard_id = unsigned;
using stream_id = unsigned;

class io_desc_read_write;
class queued_io_request_completion;
class queued_io_request;
class io_group;

Expand Down Expand Up @@ -163,10 +163,10 @@ public:
future<size_t> submit_io_write(internal::priority_class priority_class,
size_t len, internal::io_request req, io_intent* intent, iovec_keeper iovs = {}) noexcept;

void submit_request(io_desc_read_write* desc, internal::io_request req) noexcept;
void submit_request(queued_io_request_completion* desc, internal::io_request req) noexcept;
void cancel_request(queued_io_request& req) noexcept;
void complete_cancelled_request(queued_io_request& req) noexcept;
void complete_request(io_desc_read_write& desc) noexcept;
void complete_request(queued_io_request_completion& desc) noexcept;

[[deprecated("I/O queue users should not track individual requests, but resources (weight, size) passing through the queue")]]
size_t queued_requests() const {
Expand Down
12 changes: 6 additions & 6 deletions src/core/io_queue.cc
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ class io_queue::priority_class_data {
metrics::metric_groups metric_groups;
};

class io_desc_read_write final : public io_completion {
class queued_io_request_completion final : public io_completion {
io_queue& _ioq;
io_queue::priority_class_data& _pclass;
io_queue::clock_type::time_point _ts;
Expand All @@ -222,7 +222,7 @@ class io_desc_read_write final : public io_completion {
iovec_keeper _iovs;

public:
io_desc_read_write(io_queue& ioq, io_queue::priority_class_data& pc, stream_id stream, io_direction_and_length dnl, fair_queue_entry::capacity_t cap, iovec_keeper iovs)
queued_io_request_completion(io_queue& ioq, io_queue::priority_class_data& pc, stream_id stream, io_direction_and_length dnl, fair_queue_entry::capacity_t cap, iovec_keeper iovs)
: _ioq(ioq)
, _pclass(pc)
, _ts(io_queue::clock_type::now())
Expand Down Expand Up @@ -277,7 +277,7 @@ class queued_io_request : private internal::io_request {
const stream_id _stream;
fair_queue_entry _fq_entry;
internal::cancellable_queue::link _intent;
std::unique_ptr<io_desc_read_write> _desc;
std::unique_ptr<queued_io_request_completion> _desc;

bool is_cancelled() const noexcept { return !_desc; }

Expand All @@ -287,7 +287,7 @@ class queued_io_request : private internal::io_request {
, _ioq(q)
, _stream(_ioq.request_stream(dnl))
, _fq_entry(cap)
, _desc(std::make_unique<io_desc_read_write>(_ioq, pc, _stream, dnl, cap, std::move(iovs)))
, _desc(std::make_unique<queued_io_request_completion>(_ioq, pc, _stream, dnl, cap, std::move(iovs)))
{
}

Expand Down Expand Up @@ -548,7 +548,7 @@ void io_queue::update_flow_ratio() noexcept {
}

void
io_queue::complete_request(io_desc_read_write& desc) noexcept {
io_queue::complete_request(queued_io_request_completion& desc) noexcept {
_requests_executing--;
_requests_completed++;
_streams[desc.stream()].notify_request_finished(desc.capacity());
Expand Down Expand Up @@ -1038,7 +1038,7 @@ void io_queue::poll_io_queue() {
}
}

void io_queue::submit_request(io_desc_read_write* desc, internal::io_request req) noexcept {
void io_queue::submit_request(queued_io_request_completion* desc, internal::io_request req) noexcept {
_queued_requests--;
_requests_executing++;
_requests_dispatched++;
Expand Down

0 comments on commit c2fedbc

Please sign in to comment.