Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

os/bluestore: support calculate cost when using spdk. #17091

Merged
merged 1 commit into from Aug 29, 2017
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions src/os/bluestore/BlockDevice.h
Expand Up @@ -39,6 +39,7 @@ struct IOContext {
#ifdef HAVE_SPDK
void *nvme_task_first = nullptr;
void *nvme_task_last = nullptr;
std::atomic_int total_nseg = {0};
#endif


Expand Down
5 changes: 5 additions & 0 deletions src/os/bluestore/BlueStore.cc
Expand Up @@ -7657,6 +7657,11 @@ void BlueStore::_txc_calc_cost(TransContext *txc)
for (auto& p : txc->ioc.pending_aios) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we may should put this loop in else case

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ioc.pending_aios is not needed for SPDK case.

ios += p.iov.size();
}

#ifdef HAVE_SPDK
ios += txc->ioc.total_nseg;
#endif

auto cost = throttle_cost_per_io.load();
txc->cost = ios * cost + txc->bytes;
dout(10) << __func__ << " " << txc << " cost " << txc->cost << " ("
Expand Down
2 changes: 2 additions & 0 deletions src/os/bluestore/NVMEDevice.cc
Expand Up @@ -320,6 +320,7 @@ struct Task {
for (uint16_t i = 0; i < io_request.nseg; i++)
queue_data->data_buf_mempool.push_back(io_request.inline_segs[i]);
}
ctx->total_nseg -= io_request.nseg;
io_request.nseg = 0;
}

Expand Down Expand Up @@ -423,6 +424,7 @@ int SharedDriverQueueData::alloc_buf_from_pool(Task *t, bool write)
data_buf_mempool.pop_back();
}
t->io_request.nseg = count;
t->ctx->total_nseg += count;
if (write) {
auto blp = t->write_bl.begin();
uint32_t len = 0;
Expand Down