summaryrefslogtreecommitdiffstats
path: root/default.c
diff options
context:
space:
mode:
Diffstat (limited to 'default.c')
-rw-r--r--default.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/default.c b/default.c
index 6c7970b..97baec1 100644
--- a/default.c
+++ b/default.c
@@ -27,6 +27,10 @@
# include <linux/falloc.h>
#endif /* HAVE_LINUX_FALLOC_H */
+#ifndef DISABLE_XFS_REALTIME
+# include <xfs/xfs.h>
+#endif /* !DISABLE_XFS_REALTIME */
+
#include "fastwriter.h"
#include "private.h"
#include "sysinfo.h"
@@ -55,6 +59,10 @@ int fastwriter_default_open(fastwriter_t *fw, const char *name, fastwriter_flags
int err;
char fs[16];
+#ifndef DISABLE_XFS_REALTIME
+ struct fsxattr attr;
+#endif /* !DISABLE_XFS_REALTIME */
+
int open_flags = (O_CREAT|O_WRONLY|O_NOATIME|O_LARGEFILE);
int open_mode = (S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
@@ -127,6 +135,17 @@ int fastwriter_default_open(fastwriter_t *fw, const char *name, fastwriter_flags
# endif /* SYNC_MODE */
}
+#ifndef DISABLE_XFS_REALTIME
+ if (!strcmp(fs, "xfs")) {
+ err = xfsctl (name, ctx->fd, XFS_IOC_FSGETXATTR, (void *) &attr);
+ if (!err) {
+ attr.fsx_xflags |= XFS_XFLAG_REALTIME;
+ err = xfsctl (name, ctx->fd, XFS_IOC_FSSETXATTR, (void *) &attr);
+// if (!err) puts("Real-time");
+ }
+ }
+#endif /* !DISABLE_XFS_REALTIME */
+
ctx->preallocated = 0;
return 0;