]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore/BlueFS: wait for flush aios to complete before returning
authorSage Weil <sage@redhat.com>
Wed, 30 Dec 2015 15:16:19 +0000 (10:16 -0500)
committerSage Weil <sage@redhat.com>
Fri, 1 Jan 2016 18:08:56 +0000 (13:08 -0500)
This makes all the IOs effectively synchronous (while holding the lock),
which isn't great, but at least it's correct.  We can contemplate async
later..

Signed-off-by: Sage Weil <sage@redhat.com>
src/os/bluestore/BlueFS.cc
src/os/bluestore/BlueFS.h

index ad2c1dd34aac57db266370ae7bee098a2a4f231f..3b9fe80ad63efff4355d81ec6dd5cf751422302d 100644 (file)
@@ -986,9 +986,22 @@ int BlueFS::_flush_range(FileWriter *h, uint64_t offset, uint64_t length)
     }
   }
   dout(20) << __func__ << " h " << h << " pos now " << h->pos << dendl;
+  _flush_wait(h);
   return 0;
 }
 
+void BlueFS::_flush_wait(FileWriter *h)
+{
+  dout(10) << __func__ << " " << h << dendl;
+  utime_t start = ceph_clock_now(NULL);
+  for (auto p : h->iocv) {
+    p->aio_wait();
+  }
+  utime_t end = ceph_clock_now(NULL);
+  utime_t dur = end - start;
+  dout(10) << __func__ << " " << h << " done in " << dur << dendl;
+}
+
 int BlueFS::_flush(FileWriter *h, bool force)
 {
   uint64_t length = h->buffer.length();
index 85b6638b9a22f9f60173452f7c44449483f42615..11d101c3e9c07bbcef6ac71f437ea9b1bac6387b 100644 (file)
@@ -193,6 +193,7 @@ private:
   int _allocate(unsigned bdev, uint64_t len, vector<bluefs_extent_t> *ev);
   int _flush_range(FileWriter *h, uint64_t offset, uint64_t length);
   int _flush(FileWriter *h, bool force);
+  void _flush_wait(FileWriter *h);
   void _fsync(FileWriter *h);
 
   int _flush_log();