]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore/BlueFS: flush data into disk when close file.
authorJianpeng Ma <jianpeng.ma@intel.com>
Fri, 29 May 2020 01:08:42 +0000 (09:08 +0800)
committerNathan Cutler <ncutler@suse.com>
Thu, 13 Aug 2020 19:52:50 +0000 (21:52 +0200)
Avoid data remain in buffer when close the file, we should flush w/
force.

Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
(cherry picked from commit 8fc4e2301b1f3209f0e55dccea9df2b90ed30a3d)

src/os/bluestore/BlueFS.h
src/os/bluestore/BlueRocksEnv.cc

index 9e635bd8bde753a88372f3a94585f9435af134c1..516ede84189177ff101deb29e8a6ac706086c77f 100644 (file)
@@ -553,9 +553,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 51614c09d2cd61a736b8e4eb4585e6f44543f86c..aa689dbc08b90808624e3dc4d108f75dd01a1713 100644 (file)
@@ -196,7 +196,7 @@ class BlueRocksWritableFile : public rocksdb::WritableFile {
   }
 
   rocksdb::Status Close() override {
-    Flush();
+    fs->flush(h, true);
 
     // mimic posix env, here.  shrug.
     size_t block_size;