lttng-tools-2.0-pre15-no-sync-file-range-in-uclibc.patch 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. Make sync_file_range() usage optional
  2. Under uClibc, sync_file_range() is not available under all
  3. architectures, so we fall back to fdatasync() in this case.
  4. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  5. Index: lttng-tools-2.0-pre15/configure.ac
  6. ===================================================================
  7. --- lttng-tools-2.0-pre15.orig/configure.ac 2012-02-01 16:31:31.140978817 +0100
  8. +++ lttng-tools-2.0-pre15/configure.ac 2012-02-01 16:31:42.110783708 +0100
  9. @@ -96,7 +96,7 @@
  10. AM_CONDITIONAL([HAVE_LIBLTTNG_UST_CTL], [ test "x$ac_cv_lib_lttng_ust_ctl_ustctl_create_session" = "xyes" ])
  11. -AC_CHECK_FUNCS([sched_getcpu sysconf])
  12. +AC_CHECK_FUNCS([sched_getcpu sysconf sync_file_range])
  13. # Option to only build the consumer daemon and its libraries
  14. AC_ARG_WITH([consumerd-only],
  15. Index: lttng-tools-2.0-pre15/liblttng-consumer/lttng-consumer.c
  16. ===================================================================
  17. --- lttng-tools-2.0-pre15.orig/liblttng-consumer/lttng-consumer.c 2012-02-01 16:36:00.876292596 +0100
  18. +++ lttng-tools-2.0-pre15/liblttng-consumer/lttng-consumer.c 2012-02-01 16:36:23.435901163 +0100
  19. @@ -527,11 +527,15 @@
  20. if (orig_offset < stream->chan->max_sb_size) {
  21. return;
  22. }
  23. +#ifdef HAVE_SYNC_FILE_RANGE
  24. sync_file_range(outfd, orig_offset - stream->chan->max_sb_size,
  25. stream->chan->max_sb_size,
  26. SYNC_FILE_RANGE_WAIT_BEFORE
  27. | SYNC_FILE_RANGE_WRITE
  28. | SYNC_FILE_RANGE_WAIT_AFTER);
  29. +#else
  30. + fdatasync(outfd);
  31. +#endif
  32. /*
  33. * Give hints to the kernel about how we access the file:
  34. * POSIX_FADV_DONTNEED : we won't re-access data in a near future after
  35. Index: lttng-tools-2.0-pre15/liblttng-kconsumer/lttng-kconsumer.c
  36. ===================================================================
  37. --- lttng-tools-2.0-pre15.orig/liblttng-kconsumer/lttng-kconsumer.c 2012-02-01 16:36:36.215679416 +0100
  38. +++ lttng-tools-2.0-pre15/liblttng-kconsumer/lttng-kconsumer.c 2012-02-01 16:59:08.622203348 +0100
  39. @@ -71,8 +71,12 @@
  40. goto end;
  41. }
  42. /* This won't block, but will start writeout asynchronously */
  43. +#ifdef HAVE_SYNC_FILE_RANGE
  44. sync_file_range(outfd, stream->out_fd_offset, ret,
  45. SYNC_FILE_RANGE_WRITE);
  46. +#else
  47. + fdatasync(outfd);
  48. +#endif
  49. stream->out_fd_offset += ret;
  50. }
  51. @@ -121,8 +125,12 @@
  52. }
  53. len -= ret;
  54. /* This won't block, but will start writeout asynchronously */
  55. +#ifdef HAVE_SYNC_FILE_RANGE
  56. sync_file_range(outfd, stream->out_fd_offset, ret,
  57. SYNC_FILE_RANGE_WRITE);
  58. +#else
  59. + fdatasync(outfd);
  60. +#endif
  61. stream->out_fd_offset += ret;
  62. }
  63. lttng_consumer_sync_trace_file(stream, orig_offset);
  64. Index: lttng-tools-2.0-pre15/liblttng-ustconsumer/lttng-ustconsumer.c
  65. ===================================================================
  66. --- lttng-tools-2.0-pre15.orig/liblttng-ustconsumer/lttng-ustconsumer.c 2012-02-01 16:37:11.495067263 +0100
  67. +++ lttng-tools-2.0-pre15/liblttng-ustconsumer/lttng-ustconsumer.c 2012-02-01 16:37:31.224724916 +0100
  68. @@ -70,8 +70,12 @@
  69. goto end;
  70. }
  71. /* This won't block, but will start writeout asynchronously */
  72. +#ifdef HAVE_SYNC_FILE_RANGE
  73. sync_file_range(outfd, stream->out_fd_offset, ret,
  74. SYNC_FILE_RANGE_WRITE);
  75. +#else
  76. + fdatasync(outfd);
  77. +#endif
  78. stream->out_fd_offset += ret;
  79. }