summaryrefslogtreecommitdiffstats
path: root/default.c
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@dside.dyndns.org>2012-03-08 21:26:06 +0100
committerSuren A. Chilingaryan <csa@dside.dyndns.org>2012-03-08 21:26:06 +0100
commit4fdf54d4690fdf33c94b27bcf44094bb933e11fd (patch)
treea18e4b509f30e95c48df4641a823190cf1210f53 /default.c
parent792cb8124ebb8f119f678d5d4df1a8d30d568564 (diff)
downloadfastwriter-4fdf54d4690fdf33c94b27bcf44094bb933e11fd.tar.gz
fastwriter-4fdf54d4690fdf33c94b27bcf44094bb933e11fd.tar.bz2
fastwriter-4fdf54d4690fdf33c94b27bcf44094bb933e11fd.tar.xz
fastwriter-4fdf54d4690fdf33c94b27bcf44094bb933e11fd.zip
Support XFS RealTime partition
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;