summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-09-27 13:08:37 -0700
committerSage Weil <sage@inktank.com>2013-09-27 13:08:37 -0700
commit8c810fd90ce090a85ad326b87f60222108a1fba2 (patch)
tree4aff9f75ebf60c9d3c72c299aa4c96025f8f41aa
parentbeb366302a125dd422c4f092b12eb541cb3bc788 (diff)
downloadceph-8c810fd90ce090a85ad326b87f60222108a1fba2.tar.gz
hack: falloc 4mb rbd data objects
Lets' see if this improves rbd performance vs fragmentation behavior
-rw-r--r--src/os/FileStore.cc17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/os/FileStore.cc b/src/os/FileStore.cc
index 7418039ece6..95dfe672207 100644
--- a/src/os/FileStore.cc
+++ b/src/os/FileStore.cc
@@ -26,6 +26,7 @@
#if defined(__linux__)
#include <linux/fs.h>
#include <syscall.h>
+#include <linux/falloc.h>
#endif
#include <iostream>
@@ -3044,7 +3045,7 @@ int FileStore::_write(coll_t cid, const hobject_t& oid,
<< cpp_strerror(r) << dendl;
goto out;
}
-
+
// seek
actual = ::lseek64(**fd, offset, SEEK_SET);
if (actual < 0) {
@@ -3060,6 +3061,20 @@ int FileStore::_write(coll_t cid, const hobject_t& oid,
goto out;
}
+#ifdef CEPH_HAVE_FALLOCATE
+# if !defined(DARWIN) && !defined(__FreeBSD__)
+ // hack: fallocate rbd?
+ if (oid.oid.name.find("rb.") == 0) {
+ struct stat st;
+ ::fstat(**fd, &st);
+ if (st.st_size == 0 && !(offset == 0 && len == 4194304)) {
+ dout(20) << "write fallocating to 4MB" << dendl;
+ fallocate(**fd, FALLOC_FL_KEEP_SIZE, 0, 4194304);
+ }
+ }
+# endif
+#endif
+
// write
r = bl.write_fd(**fd);
if (r == 0)