]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
filestore: use BTRFS_IOC_SYNC instead of fsync
authorSage Weil <sage@newdream.net>
Thu, 9 Oct 2008 23:03:57 +0000 (16:03 -0700)
committerSage Weil <sage@newdream.net>
Mon, 13 Oct 2008 19:02:27 +0000 (12:02 -0700)
fsync() won't do the right thing on newer versions of btrfs, due do the
new tree log stuff.  Use the SYNC ioctl.

src/os/FileStore.cc

index 3ab0cbd23d3b40421fdabcc967e741dd1c4fc54f..19746cb796c29d3ad6afad76471c810adbca4814 100644 (file)
@@ -1405,7 +1405,13 @@ void FileStore::sync_entry()
 
     commit_started();
 
-    ::fsync(fd);  // this should cause the fs's journal to commit.  (on btrfs too.)
+    if (btrfs) {
+      // do a full btrfs commit
+      ::ioctl(fd, BTRFS_IOC_SYNC);
+    } else {
+      // make the file system's journal to commit.
+      ::fsync(fd);  
+    }
     ::close(fd);
 
     commit_finish();