From: Sage Weil Date: Wed, 30 Dec 2015 15:16:19 +0000 (-0500) Subject: os/bluestore/BlueFS: wait for flush aios to complete before returning X-Git-Tag: v10.0.3~154^2~11 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=198b156ce6153c0f390ceadb3ea237ade16d135f;p=ceph.git os/bluestore/BlueFS: wait for flush aios to complete before returning 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 --- diff --git a/src/os/bluestore/BlueFS.cc b/src/os/bluestore/BlueFS.cc index ad2c1dd34aa..3b9fe80ad63 100644 --- a/src/os/bluestore/BlueFS.cc +++ b/src/os/bluestore/BlueFS.cc @@ -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(); diff --git a/src/os/bluestore/BlueFS.h b/src/os/bluestore/BlueFS.h index 85b6638b9a2..11d101c3e9c 100644 --- a/src/os/bluestore/BlueFS.h +++ b/src/os/bluestore/BlueFS.h @@ -193,6 +193,7 @@ private: int _allocate(unsigned bdev, uint64_t len, vector *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();