]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore/BlueFS: flush data into disk when close file. 35258/head
authorJianpeng Ma <jianpeng.ma@intel.com>
Fri, 29 May 2020 01:08:42 +0000 (09:08 +0800)
committerJianpeng Ma <jianpeng.ma@intel.com>
Fri, 29 May 2020 01:08:42 +0000 (09:08 +0800)
Avoid data remain in buffer when close the file, we should flush w/
force.

Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
src/os/bluestore/BlueFS.h
src/os/bluestore/BlueRocksEnv.cc

index 9d699069d77d305044becf8045f0e231224e3641..738445d2ceabeff7ea5a564b20f99d4bb39595fb 100644 (file)
@@ -557,9 +557,9 @@ public:
   // handler for discard event
   void handle_discard(unsigned dev, interval_set<uint64_t>& to_release);
 
-  void flush(FileWriter *h) {
+  void flush(FileWriter *h, bool force = false) {
     std::lock_guard l(lock);
-    _flush(h, false);
+    _flush(h, force);
   }
   void flush_range(FileWriter *h, uint64_t offset, uint64_t length) {
     std::lock_guard l(lock);
index e5cc992bff7dfb12a77d196e70d32002d429c0a5..54c7d27458cc92b16873f6a6a1eeb6c00ee16d48 100644 (file)
@@ -198,7 +198,7 @@ class BlueRocksWritableFile : public rocksdb::WritableFile {
   }
 
   rocksdb::Status Close() override {
-    Flush();
+    fs->flush(h, true);
 
     // mimic posix env, here.  shrug.
     size_t block_size;