diff options
-rw-r--r-- | .bzrignore | 3 | ||||
-rw-r--r-- | CMakeLists.txt | 11 | ||||
-rw-r--r-- | config.h.in | 1 | ||||
-rw-r--r-- | default.c | 19 |
4 files changed, 31 insertions, 3 deletions
@@ -3,8 +3,7 @@ config.h fastwriter.pc install_manifest.txt libfastwriter.so -libfastwriter.so.0 -libfastwriter.so.0.0.1 Makefile cmake_install.cmake CMakeCache.txt +*.so.* diff --git a/CMakeLists.txt b/CMakeLists.txt index 94d1ad8..7cc39b3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,14 +1,23 @@ project(fastwriter) -set(FASTWRITER_VERSION "0.0.1") +set(FASTWRITER_VERSION "0.0.2") set(FASTWRITER_ABI_VERSION "0") cmake_minimum_required(VERSION 2.8) +set(DISABLE_XFS_REALTIME FALSE CACHE BOOL "Disable support of RealTime XFS partition") + include(CheckIncludeFiles) check_include_files("linux/falloc.h" HAVE_LINUX_FALLOC_H) +if (NOT DISABLE_XFS_REALTIME) + check_include_files("xfs/xfs.h" HAVE_XFS_H) + if (NOT HAVE_XFS_H) + message(FATAL_ERROR "error: xfs/xfs.h is not found...") + endif (NOT HAVE_XFS_H) +endif (NOT DISABLE_XFS_REALTIME) + include_directories( ${CMAKE_SOURCE_DIR}/src ${CMAKE_CURRENT_BINARY_DIR} diff --git a/config.h.in b/config.h.in index 7c8ac8c..3627160 100644 --- a/config.h.in +++ b/config.h.in @@ -1 +1,2 @@ #cmakedefine HAVE_LINUX_FALLOC_H +#cmakedefine DISABLE_XFS_REALTIME
\ No newline at end of file @@ -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; |