Skip to content

Commit

Permalink
Merge "More dynamic fstream patches" from Paweł
Browse files Browse the repository at this point in the history
"These are an additional fix (accounting for buffers droppped at stream
deconstruction) and a cleanup (history made private) for fstream dynamic
adjustments."

* 'pdziepak/dynamic-fstream-cleanup/v1' of github.com:cloudius-systems/seastar-dev:
  fstream: make members file_input_stream_history private
  fstream: account for buffers dropped while closing stream
  • Loading branch information
avikivity committed Oct 16, 2016
2 parents e4620d7 + 4e52545 commit c523736
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions core/fstream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,12 @@ class file_data_source_impl : public data_source_impl {
_done->set_value();
}
return _done->get_future().then([this] {
uint64_t dropped = 0;
for (auto&& c : _read_buffers) {
dropped += c._size;
c._ready.ignore_ready_future();
}
update_history_unused(dropped);
return std::move(_dropped_reads);
});
}
Expand Down
4 changes: 3 additions & 1 deletion core/fstream.hh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include "iostream.hh"
#include "shared_ptr.hh"

struct file_input_stream_history {
class file_input_stream_history {
static constexpr uint64_t window_size = 4 * 1024 * 1024;
struct window {
uint64_t total_read = 0;
Expand All @@ -43,6 +43,8 @@ struct file_input_stream_history {
window current_window;
window previous_window;
unsigned read_ahead = 1;

friend class file_data_source_impl;
};

/// Data structure describing options for opening a file input stream
Expand Down

0 comments on commit c523736

Please sign in to comment.