]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/FileStore: disable fadvise on XFS
authorSage Weil <sage@inktank.com>
Wed, 19 Jun 2013 04:44:15 +0000 (21:44 -0700)
committerSage Weil <sage@inktank.com>
Wed, 19 Jun 2013 17:57:13 +0000 (10:57 -0700)
fadvise(DONTNEED) on XFS can break writeback ordering and zeroing; see

      http://oss.sgi.com/archives/xfs/2013-06/msg00066.html

If we detect XFS, turn this option off.

Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Samuel Just <sam.just@inktank.com>
src/os/FileStore.cc

index 4218f695bc347d1d969b95900cd174058d3b74bf..bfc485113849122b60388cb68cf9dac56f601b28 100644 (file)
@@ -90,6 +90,9 @@ using ceph::crypto::SHA1;
 # ifndef BTRFS_SUPER_MAGIC
 static const __SWORD_TYPE BTRFS_SUPER_MAGIC(0x9123683E);
 # endif
+# ifndef XFS_SUPER_MAGIC
+static const __SWORD_TYPE XFS_SUPER_MAGIC(0x58465342);
+# endif
 #endif
 
 #define COMMIT_SNAP_ITEM "snap_%lld"
@@ -1062,6 +1065,17 @@ int FileStore::_detect_fs()
   }
   blk_size = st.f_bsize;
 
+#if defined(__linux__)
+  if (st.f_type == XFS_SUPER_MAGIC) {
+    dout(1) << "mount detected xfs" << dendl;
+    if (m_filestore_replica_fadvise) {
+      dout(1) << " disabling 'filestore replica fadvise' due to known issues with fadvise(DONTNEED) on xfs" << dendl;
+      g_conf->set_val("filestore_replica_fadvise", "false");
+      assert(m_filestore_replica_fadvise == false);
+    }
+  }
+#endif
+
 #if defined(__linux__)
   if (st.f_type == BTRFS_SUPER_MAGIC) {
     dout(0) << "mount detected btrfs" << dendl;