Skip to contentSkip to conversation

Make sync_file_range() usage optional

PATCH Mathieu Desnoyers 2 participants 2 messages Jan 13, 2013 – Jan 16, 2013 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Mathieu Desnoyers

author Acked-by
#1 lore raw
Quoted 2 lines · * Samuel Martin ([email protected]) wrote:

Under uClibc, sync_file_range() is not available under all architectures, so we fall back to fdatasync() in this case.

Hi Samuel,

For future, please specify either of:

[PATCH urcu]
[PATCH lttng-tools]
[PATCH lttng-ust]
[PATCH lttng-modules]

in the subject.

This patch belongs to lttng-tools, so I CC David who maintains it.

Thanks!

Mathieu

Quoted 45 lines
---
 configure.ac                     | 2 +-
 src/common/compat/compat-fcntl.c | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)
configure.ac +1 -1
index 425941b..80940c0 100644
@@ -150,7 +150,7 @@ AS_IF([test "x$lttng_ust_support" = "xyes"], [
 	)
 ])
 AM_CONDITIONAL([HAVE_LIBLTTNG_UST_CTL], [test "x$lttng_ust_ctl_found" = xyes])
-AC_CHECK_FUNCS([sched_getcpu sysconf])
+AC_CHECK_FUNCS([sched_getcpu sysconf sync_file_range])
 
 # check for dlopen
 AC_CHECK_LIB([dl], [dlopen],
src/common/compat/compat-fcntl.c +4 -0
index 5a1c757..7ff63a3 100644
@@ -23,7 +23,11 @@
 int compat_sync_file_range(int fd, off64_t offset, off64_t nbytes,
 		unsigned int flags)
 {
+#ifdef HAVE_SYNC_FILE_RANGE
 	return sync_file_range(fd, offset, nbytes, flags);
+#else
+	return fdatasync(fd);
+#endif
 }
 
 #endif /* __linux__ */
Signature · 7 lines
1.8.1


_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
Signature · 3 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
#2 lore raw
In reply to a message not in the archive

Merged!

Thanks!

David

Samuel Martin:

Quoted 39 lines

Under uClibc, sync_file_range() is not available under all architectures, so we fall back to fdatasync() in this case.

---
 configure.ac                     | 2 +-
 src/common/compat/compat-fcntl.c | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)
configure.ac +1 -1
index 425941b..80940c0 100644
@@ -150,7 +150,7 @@ AS_IF([test "x$lttng_ust_support" = "xyes"], [
 	)
 ])
 AM_CONDITIONAL([HAVE_LIBLTTNG_UST_CTL], [test "x$lttng_ust_ctl_found" = xyes])
-AC_CHECK_FUNCS([sched_getcpu sysconf])
+AC_CHECK_FUNCS([sched_getcpu sysconf sync_file_range])
 
 # check for dlopen
 AC_CHECK_LIB([dl], [dlopen],
src/common/compat/compat-fcntl.c +4 -0
index 5a1c757..7ff63a3 100644
@@ -23,7 +23,11 @@
 int compat_sync_file_range(int fd, off64_t offset, off64_t nbytes,
 		unsigned int flags)
 {
+#ifdef HAVE_SYNC_FILE_RANGE
 	return sync_file_range(fd, offset, nbytes, flags);
+#else
+	return fdatasync(fd);
+#endif
 }
 
 #endif /* __linux__ */