1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
diff --git a/flashcache-wt/Makefile b/flashcache-wt/Makefile
index c9beb28..79f5505 100644
--- a/flashcache-wt/Makefile
+++ b/flashcache-wt/Makefile
@@ -1,3 +1,5 @@
+KERNEL_TREE ?= /lib/modules/$(shell uname -r)/build
+
all:
$(MAKE) -C src KERNEL_TREE=$(KERNEL_TREE) PWD=$(PWD)/src
diff --git a/flashcache-wt/src/Makefile b/flashcache-wt/src/Makefile
index d21ff2a..8f81c20 100644
--- a/flashcache-wt/src/Makefile
+++ b/flashcache-wt/src/Makefile
@@ -1,13 +1,15 @@
EXTRA_CFLAGS=-I$(KERNEL_TREE)/drivers/md -I./
UTILS_CFLAGS=-I./
+KERNEL_TREE ?= /lib/modules/$(shell uname -r)/build
+
obj-m += flashcache-wt.o
flashcache-wt-objs := flashcache_wt.o
KERNEL_SOURCE_VERSION ?= $(shell uname -r)
all:
- make -C $(KERNEL_TREE) M=$(PWD) modules
+ $(MAKE) -C $(KERNEL_TREE) M=$(PWD) modules
$(CC) $(UTILS_CFLAGS) -o utils/flashcache_wt_create utils/flashcache_wt_create.c
install: all
@@ -17,5 +19,5 @@ install: all
install -o root -g root -m 0755 utils/flashcache_wt_create /sbin/
clean:
- make -C $(KERNEL_TREE) M=$(PWD) clean
+ $(MAKE) -C $(KERNEL_TREE) M=$(PWD) clean
rm -f utils/flashcache_wt_create
diff --git a/flashcache-wt/src/flashcache_wt.c b/flashcache-wt/src/flashcache_wt.c
index 6cd2a3d..0259e26 100644
--- a/flashcache-wt/src/flashcache_wt.c
+++ b/flashcache-wt/src/flashcache_wt.c
@@ -826,8 +826,10 @@ cache_write(struct cache_c *dmc, struct bio* bio)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36)
#define bio_barrier(bio) ((bio)->bi_rw & (1 << BIO_RW_BARRIER))
-#else
+#elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)
#define bio_barrier(bio) ((bio)->bi_rw & REQ_HARDBARRIER)
+#else
+#define bio_barrier(bio) ((bio)->bi_rw & REQ_FLUSH)
#endif
#endif
diff --git a/src/Makefile b/src/Makefile
index 5938043..536f4a7 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -9,7 +9,7 @@ flashcache-objs := flashcache_conf.o flashcache_main.o flashcache_subr.o flashca
KERNEL_SOURCE_VERSION ?= $(shell uname -r)
all:
- make -C $(KERNEL_TREE) M=$(PWD) modules V=0
+ $(MAKE) -C $(KERNEL_TREE) M=$(PWD) modules V=0
@echo "building utils"
@$(CC) $(UTILS_CFLAGS) -o utils/flashcache_create utils/flashcache_create.c
@$(CC) $(UTILS_CFLAGS) -o utils/flashcache_destroy utils/flashcache_destroy.c
@@ -24,5 +24,5 @@ install: all
install -o root -g root -m 0755 utils/flashcache_load /sbin/
clean:
- make -C $(KERNEL_TREE) M=$(PWD) clean
+ $(MAKE) -C $(KERNEL_TREE) M=$(PWD) clean
rm -f utils/flashcache_{create,destroy,load}
diff --git a/src/flashcache_main.c b/src/flashcache_main.c
index d9e47ee..e8240db 100644
--- a/src/flashcache_main.c
+++ b/src/flashcache_main.c
@@ -1533,8 +1533,10 @@ flashcache_write(struct cache_c *dmc, struct bio *bio)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36)
#define bio_barrier(bio) ((bio)->bi_rw & (1 << BIO_RW_BARRIER))
-#else
+#elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)
#define bio_barrier(bio) ((bio)->bi_rw & REQ_HARDBARRIER)
+#else
+#define bio_barrier(bio) ((bio)->bi_rw & REQ_FLUSH)
#endif
#endif
diff --git a/src/utils/flashcache_create.c b/src/utils/flashcache_create.c
index 839205d..23fd4e7 100644
--- a/src/utils/flashcache_create.c
+++ b/src/utils/flashcache_create.c
@@ -274,7 +274,7 @@ main(int argc, char **argv)
exit(1);
}
}
- sprintf(dmsetup_cmd, "echo 0 %lu flashcache %s %s 2 %lu %lu %lu"
+ sprintf(dmsetup_cmd, "echo 0 %lu flashcache %s %s 2 %lu %lu %d"
" | dmsetup create %s",
disk_devsize, disk_devname, ssd_devname, block_size,
cache_size, associativity,
|