Skip to content
This repository has been archived by the owner on Jun 23, 2022. It is now read-only.

refactor: remove support_write_vec in aio_task #680

Merged
merged 4 commits into from
Dec 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions include/dsn/tool-api/aio_task.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ class aio_context : public ref_counter
// filled by apps
dsn_handle_t file;
void *buffer;
bool support_write_vec; // if the aio provider supports write buffer vector
std::vector<dsn_file_buffer_t> *write_buffer_vec; // only used if support_write_vec is true
uint32_t buffer_size;
uint64_t file_offset;

Expand All @@ -64,8 +62,6 @@ class aio_context : public ref_counter
aio_context()
: file(nullptr),
buffer(nullptr),
support_write_vec(false),
write_buffer_vec(nullptr),
buffer_size(0),
file_offset(0),
type(AIO_Invalid),
Expand Down
7 changes: 2 additions & 5 deletions src/aio/aio_provider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,9 @@ aio_provider::aio_provider(disk_engine *disk) : _engine(disk) {}

service_node *aio_provider::node() const { return _engine->node(); }

void aio_provider::complete_io(aio_task *aio,
error_code err,
uint32_t bytes,
int delay_milliseconds)
void aio_provider::complete_io(aio_task *aio, error_code err, uint32_t bytes)
{
_engine->complete_io(aio, err, bytes, delay_milliseconds);
_engine->complete_io(aio, err, bytes);
}

namespace tools {
Expand Down
2 changes: 1 addition & 1 deletion src/aio/aio_provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class aio_provider

virtual aio_context *prepare_aio_context(aio_task *) = 0;

void complete_io(aio_task *aio, error_code err, uint32_t bytes, int delay_milliseconds = 0);
void complete_io(aio_task *aio, error_code err, uint32_t bytes);

private:
disk_engine *_engine;
Expand Down
11 changes: 2 additions & 9 deletions src/aio/disk_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,14 +207,7 @@ void disk_engine::process_write(aio_task *aio, uint32_t sz)

// no batching
if (dio->buffer_size == sz) {
if (dio->buffer == nullptr) {
if (dio->support_write_vec) {
dio->write_buffer_vec = &aio->_unmerged_write_buffers;
} else {
aio->collapse();
}
}
dassert(dio->buffer || dio->write_buffer_vec, "");
aio->collapse();
_provider->submit_aio_task(aio);
}

Expand Down Expand Up @@ -251,7 +244,7 @@ void disk_engine::process_write(aio_task *aio, uint32_t sz)
}
}

void disk_engine::complete_io(aio_task *aio, error_code err, uint32_t bytes, int delay_milliseconds)
void disk_engine::complete_io(aio_task *aio, error_code err, uint32_t bytes)
{
if (err != ERR_OK) {
dinfo("disk operation failure with code %s, err = %s, aio_task_id = %016" PRIx64,
Expand Down
2 changes: 1 addition & 1 deletion src/aio/disk_engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class disk_engine : public utils::singleton<disk_engine>
~disk_engine() = default;

void process_write(aio_task *wk, uint32_t sz);
void complete_io(aio_task *aio, error_code err, uint32_t bytes, int delay_milliseconds = 0);
void complete_io(aio_task *aio, error_code err, uint32_t bytes);

std::unique_ptr<aio_provider> _provider;
service_node *_node;
Expand Down
2 changes: 1 addition & 1 deletion src/aio/sim_aio_provider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void sim_aio_provider::submit_aio_task(aio_task *aio)
uint32_t bytes;

err = aio_internal(aio, false, &bytes);
complete_io(aio, err, bytes, 0);
complete_io(aio, err, bytes);
}

} // namespace aio
Expand Down