From 95bd048062dbcb5d221b8f41459cd21ba30f1461 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 18 Jun 2013 21:44:15 -0700 Subject: [PATCH] os/FileStore: disable fadvise on XFS 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 Reviewed-by: Samuel Just --- src/os/FileStore.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/os/FileStore.cc b/src/os/FileStore.cc index 4218f695bc34..bfc485113849 100644 --- a/src/os/FileStore.cc +++ b/src/os/FileStore.cc @@ -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; -- 2.47.3