summaryrefslogtreecommitdiff
path: root/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp
diff options
context:
space:
mode:
authorunknown <stewart@willster.(none)>2006-11-10 01:08:35 +1100
committerunknown <stewart@willster.(none)>2006-11-10 01:08:35 +1100
commitfdd6efb69a2b6225a2405d4ca2d360f317c58daf (patch)
tree11dfe9c58649bba8b6cbaf4198df7489090cdd59 /storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp
parent42c2a2cb50aa3676efc4d5cd903efcf59702e83a (diff)
downloadmariadb-git-fdd6efb69a2b6225a2405d4ca2d360f317c58daf.tar.gz
BUG#24143 Heavy file fragmentation with multiple ndbd on single fs
If we have the XFS headers (at build time) we can use XFS specific ioctls (once testing the file is on XFS) to better allocate space. This dramatically improves performance of mysql-test-run cases as well: e.g. number of extents for ndb_dd_basic tablespaces and log files BEFORE this patch: 57, 13, 212, 95, 17, 113 WITH this patch : ALL 1 or 2 extents (results are consistent over multiple runs. BEFORE always has several files with lots of extents). As for timing of test run: BEFORE ndb_dd_basic [ pass ] 107727 real 3m2.683s user 0m1.360s sys 0m1.192s AFTER ndb_dd_basic [ pass ] 70060 real 2m30.822s user 0m1.220s sys 0m1.404s (results are again consistent over various runs) similar for other tests (BEFORE and AFTER): ndb_dd_alter [ pass ] 245360 ndb_dd_alter [ pass ] 211632 configure.in: Check for XFS headers storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp: If the XFS headers are installed, use the xfsctl(XFS_IOC_RESVSP64) call (a wrapper around ioctl) to tell the xfs file system how much space to reserve for this file.
Diffstat (limited to 'storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp')
-rw-r--r--storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp b/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp
index 149310d03a4..89d393557c0 100644
--- a/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp
+++ b/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp
@@ -18,6 +18,10 @@
#include <my_sys.h>
#include <my_pthread.h>
+#ifdef HAVE_XFS_XFS_H
+#include <xfs/xfs.h>
+#endif
+
#include "AsyncFile.hpp"
#include <ErrorHandlingMacros.hpp>
@@ -459,6 +463,18 @@ no_odirect:
Uint32 index = 0;
Uint32 block = refToBlock(request->theUserReference);
+#ifdef HAVE_XFS_XFS_H
+ if(platform_test_xfs_fd(theFd))
+ {
+ ndbout_c("Using xfsctl(XFS_IOC_RESVSP64) to allocate disk space");
+ xfs_flock64_t fl;
+ fl.l_whence= 0;
+ fl.l_start= 0;
+ fl.l_len= (off64_t)sz;
+ if(xfsctl(NULL, theFd, XFS_IOC_RESVSP64, &fl) < 0)
+ ndbout_c("failed to optimally allocate disk space");
+ }
+#endif
#ifdef HAVE_POSIX_FALLOCATE
posix_fallocate(theFd, 0, sz);
#endif