]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
os/bluestore/BlueFS: factor unflushed log into runway calculation
authorSage Weil <sage@redhat.com>
Fri, 2 Sep 2016 19:31:20 +0000 (15:31 -0400)
committerSage Weil <sage@redhat.com>
Fri, 2 Sep 2016 19:31:20 +0000 (15:31 -0400)
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 <somnath.roy@sandisk.com>
Signed-off-by: Sage Weil <sage@redhat.com>
src/os/bluestore/BlueFS.cc
src/os/bluestore/BlueFS.h

index 9c7e21eb72b4ec72f8127a29af4b5cb9493a74fd..b60b0966ae14cc4fe8a038951c34872419bb00a6 100644 (file)
@@ -1284,8 +1284,9 @@ int BlueFS::_flush_and_sync_log(std::unique_lock<std::mutex>& 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) {
index 43681a3534747448bab4ca32e6dc9277f772ef51..4ffee086bc66a72a278303d2e8ab7eb2de6dce28 100644 (file)
@@ -135,6 +135,10 @@ public:
     void append(bufferptr& bp) {
       buffer.append(bp);
     }
+
+    uint64_t get_effective_write_pos() {
+      return pos + buffer.length();
+    }
   };
 
   struct FileReaderBuffer {