aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile14
-rw-r--r--plugin_blk.c11
2 files changed, 22 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index c839653..edf3402 100644
--- a/Makefile
+++ b/Makefile
@@ -89,12 +89,20 @@ endif
89 89
90# $(call test-build, snippet, ret) -> ret if snippet compiles 90# $(call test-build, snippet, ret) -> ret if snippet compiles
91# -> empty otherwise 91# -> empty otherwise
92test-build = $(if $(shell $(CC) -o /dev/null -c -x c - > /dev/null 2>&1 \ 92test-build = $(if $(shell sh -c 'echo "$(1)" | \
93 <<<'$1' && echo y), $2) 93 $(CC) -o /dev/null -c -x c - > /dev/null 2>&1 && echo y'), $2)
94 94
95# have udis86 disassembler library? 95# have udis86 disassembler library?
96udis86-flags := $(call test-build,\#include <udis86.h>,-DHAVE_UDIS86 -ludis86) 96udis86-flags := $(call test-build,\#include <udis86.h>,-DHAVE_UDIS86 -ludis86)
97 97
98define BLK_TC_FLUSH_SOURCE
99#include <linux/blktrace_api.h>
100int main(void) { return BLK_TC_FLUSH; }
101endef
102
103# have flush/fua block layer instead of barriers?
104blk-flags := $(call test-build,$(BLK_TC_FLUSH_SOURCE),-DHAVE_BLK_TC_FLUSH)
105
98ifeq ("$(origin O)", "command line") 106ifeq ("$(origin O)", "command line")
99 BUILD_OUTPUT := $(O) 107 BUILD_OUTPUT := $(O)
100endif 108endif
@@ -223,7 +231,7 @@ endif
223 231
224# Append required CFLAGS 232# Append required CFLAGS
225override CFLAGS += $(CONFIG_FLAGS) $(INCLUDES) $(PLUGIN_DIR_SQ) 233override CFLAGS += $(CONFIG_FLAGS) $(INCLUDES) $(PLUGIN_DIR_SQ)
226override CFLAGS += $(udis86-flags) 234override CFLAGS += $(udis86-flags) $(blk-flags)
227 235
228ifeq ($(VERBOSE),1) 236ifeq ($(VERBOSE),1)
229 Q = 237 Q =
diff --git a/plugin_blk.c b/plugin_blk.c
index 9327b17..c0ecef9 100644
--- a/plugin_blk.c
+++ b/plugin_blk.c
@@ -54,6 +54,11 @@ static void fill_rwbs(char *rwbs, int action, unsigned int bytes)
54 goto out; 54 goto out;
55 } 55 }
56 56
57#if defined(HAVE_BLK_TC_FLUSH)
58 if (tc & BLK_TC_FLUSH)
59 rwbs[i++] = 'F';
60#endif
61
57 if (tc & BLK_TC_DISCARD) 62 if (tc & BLK_TC_DISCARD)
58 rwbs[i++] = 'D'; 63 rwbs[i++] = 'D';
59 else if (tc & BLK_TC_WRITE) 64 else if (tc & BLK_TC_WRITE)
@@ -63,10 +68,16 @@ static void fill_rwbs(char *rwbs, int action, unsigned int bytes)
63 else 68 else
64 rwbs[i++] = 'N'; 69 rwbs[i++] = 'N';
65 70
71#if defined(HAVE_BLK_TC_FLUSH)
72 if (tc & BLK_TC_FUA)
73 rwbs[i++] = 'F';
74#endif
66 if (tc & BLK_TC_AHEAD) 75 if (tc & BLK_TC_AHEAD)
67 rwbs[i++] = 'A'; 76 rwbs[i++] = 'A';
77#if !defined(HAVE_BLK_TC_FLUSH)
68 if (tc & BLK_TC_BARRIER) 78 if (tc & BLK_TC_BARRIER)
69 rwbs[i++] = 'B'; 79 rwbs[i++] = 'B';
80#endif
70 if (tc & BLK_TC_SYNC) 81 if (tc & BLK_TC_SYNC)
71 rwbs[i++] = 'S'; 82 rwbs[i++] = 'S';
72 if (tc & BLK_TC_META) 83 if (tc & BLK_TC_META)