From: Sage Weil Date: Fri, 2 Sep 2016 19:31:20 +0000 (-0400) Subject: os/bluestore/BlueFS: factor unflushed log into runway calculation X-Git-Tag: v11.0.1~321^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=f967b17c488329f5f464ff76932c02c1d0e01511;p=ceph-ci.git os/bluestore/BlueFS: factor unflushed log into runway calculation Include the size of the in-memory buffer we haven't yet flushed into the runway calculation when deciding whether to allocate more log space. Reported-by: Somnath Roy Signed-off-by: Sage Weil --- diff --git a/src/os/bluestore/BlueFS.cc b/src/os/bluestore/BlueFS.cc index 9c7e21eb72b..b60b0966ae1 100644 --- a/src/os/bluestore/BlueFS.cc +++ b/src/os/bluestore/BlueFS.cc @@ -1284,8 +1284,9 @@ int BlueFS::_flush_and_sync_log(std::unique_lock& l, assert(!log_t.empty()); // allocate some more space (before we run out)? - uint64_t runway = log_writer->file->fnode.get_allocated() - log_writer->pos; - if (runway < g_conf->bluefs_min_log_runway) { + int64_t runway = log_writer->file->fnode.get_allocated() - + log_writer->get_effective_write_pos(); + if (runway < (int64_t)g_conf->bluefs_min_log_runway) { dout(10) << __func__ << " allocating more log runway (0x" << std::hex << runway << std::dec << " remaining)" << dendl; while (new_log_writer) { diff --git a/src/os/bluestore/BlueFS.h b/src/os/bluestore/BlueFS.h index 43681a35347..4ffee086bc6 100644 --- a/src/os/bluestore/BlueFS.h +++ b/src/os/bluestore/BlueFS.h @@ -135,6 +135,10 @@ public: void append(bufferptr& bp) { buffer.append(bp); } + + uint64_t get_effective_write_pos() { + return pos + buffer.length(); + } }; struct FileReaderBuffer {