Skip to content

Commit 438e040

Browse files
author
Mohan Srinivasan
committed
Committing changes from Taira Hajime (redhat) for getting flashcache
compiling on RHEL6 and make intall.
1 parent fcf2ec4 commit 438e040

File tree

6 files changed

+57
-10
lines changed

6 files changed

+57
-10
lines changed

Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
all:
22
$(MAKE) -C src KERNEL_TREE=$(KERNEL_TREE) PWD=$(PWD)/src
33

4+
install:
5+
$(MAKE) -C src KERNEL_TREE=$(KERNEL_TREE) PWD=$(PWD)/src install
6+
47
clean:
58
$(MAKE) -C src KERNEL_TREE=$(KERNEL_TREE) PWD=$(PWD)/src clean

flashcache-wt/Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
all:
22
$(MAKE) -C src KERNEL_TREE=$(KERNEL_TREE) PWD=$(PWD)/src
33

4+
install:
5+
$(MAKE) -C src KERNEL_TREE=$(KERNEL_TREE) PWD=$(PWD)/src install
6+
47
clean:
58
$(MAKE) -C src KERNEL_TREE=$(KERNEL_TREE) PWD=$(PWD)/src clean

flashcache-wt/src/Makefile

+8
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,18 @@ UTILS_CFLAGS=-I./
44
obj-m += flashcache-wt.o
55
flashcache-wt-objs := flashcache_wt.o
66

7+
KERNEL_SOURCE_VERSION ?= $(shell uname -r)
8+
79
all:
810
make -C $(KERNEL_TREE) M=$(PWD) modules
911
$(CC) $(UTILS_CFLAGS) -o utils/flashcache_wt_create utils/flashcache_wt_create.c
1012

13+
install: all
14+
install -o root -g root -m 0755 -d /lib/modules/$(KERNEL_SOURCE_VERSION)/extra/flashcache/
15+
install -o root -g root -m 0755 flashcache-wt.ko /lib/modules/$(KERNEL_SOURCE_VERSION)/extra/flashcache/
16+
depmod -a
17+
install -o root -g root -m 0755 utils/flashcache_wt_create /sbin/
18+
1119
clean:
1220
make -C $(KERNEL_TREE) M=$(PWD) clean
1321
rm -f utils/flashcache_wt_create

flashcache-wt/src/flashcache_wt.c

+15-5
Original file line numberDiff line numberDiff line change
@@ -937,24 +937,34 @@ static int cache_ctr(struct dm_target *ti, unsigned int argc, char **argv)
937937

938938
dmc->tgt = ti;
939939

940-
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34)
941-
r = dm_get_device(ti, argv[0], 0, ti->len,
940+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)
941+
r = dm_get_device(ti, argv[0],
942942
dm_table_get_mode(ti->table), &dmc->disk_dev);
943943
#else
944+
#if defined(RHEL_MAJOR) && RHEL_MAJOR == 6
944945
r = dm_get_device(ti, argv[0],
945946
dm_table_get_mode(ti->table), &dmc->disk_dev);
947+
#else
948+
r = dm_get_device(ti, argv[0], 0, ti->len,
949+
dm_table_get_mode(ti->table), &dmc->disk_dev);
950+
#endif
946951
#endif
947952
if (r) {
948953
ti->error = "flashcache-wt: Source device lookup failed";
949954
goto bad1;
950955
}
951956

952-
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34)
953-
r = dm_get_device(ti, argv[1], 0, 0,
957+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)
958+
r = dm_get_device(ti, argv[0],
959+
dm_table_get_mode(ti->table), &dmc->cache_dev);
960+
#else
961+
#if defined(RHEL_MAJOR) && RHEL_MAJOR == 6
962+
r = dm_get_device(ti, argv[0],
954963
dm_table_get_mode(ti->table), &dmc->cache_dev);
955964
#else
956-
r = dm_get_device(ti, argv[1],
965+
r = dm_get_device(ti, argv[0], 0, ti->len,
957966
dm_table_get_mode(ti->table), &dmc->cache_dev);
967+
#endif
958968
#endif
959969
if (r) {
960970
ti->error = "flashcache-wt: Cache device lookup failed";

src/Makefile

+10
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,22 @@ UTILS_CFLAGS=-I./
44
obj-m += flashcache.o
55
flashcache-objs := flashcache_conf.o flashcache_main.o flashcache_subr.o flashcache_ioctl.o
66

7+
KERNEL_SOURCE_VERSION ?= $(shell uname -r)
8+
79
all:
810
make -C $(KERNEL_TREE) M=$(PWD) modules
911
$(CC) $(UTILS_CFLAGS) -o utils/flashcache_create utils/flashcache_create.c
1012
$(CC) $(UTILS_CFLAGS) -o utils/flashcache_destroy utils/flashcache_destroy.c
1113
$(CC) $(UTILS_CFLAGS) -o utils/flashcache_load utils/flashcache_load.c
1214

15+
install: all
16+
install -o root -g root -m 0755 -d /lib/modules/$(KERNEL_SOURCE_VERSION)/extra/flashcache/
17+
install -o root -g root -m 0755 flashcache.ko /lib/modules/$(KERNEL_SOURCE_VERSION)/extra/flashcache/
18+
depmod -a
19+
install -o root -g root -m 0755 utils/flashcache_create /sbin/
20+
install -o root -g root -m 0755 utils/flashcache_destroy /sbin/
21+
install -o root -g root -m 0755 utils/flashcache_load /sbin/
22+
1323
clean:
1424
make -C $(KERNEL_TREE) M=$(PWD) clean
1525
rm -f utils/flashcache_{create,destroy,load}

src/flashcache_conf.c

+18-5
Original file line numberDiff line numberDiff line change
@@ -1232,24 +1232,34 @@ flashcache_ctr(struct dm_target *ti, unsigned int argc, char **argv)
12321232
}
12331233

12341234
dmc->tgt = ti;
1235-
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34)
1236-
r = dm_get_device(ti, argv[0], 0, ti->len,
1235+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)
1236+
r = dm_get_device(ti, argv[0],
12371237
dm_table_get_mode(ti->table), &dmc->disk_dev);
12381238
#else
1239+
#if defined(RHEL_MAJOR) && RHEL_MAJOR == 6
12391240
r = dm_get_device(ti, argv[0],
12401241
dm_table_get_mode(ti->table), &dmc->disk_dev);
1242+
#else
1243+
r = dm_get_device(ti, argv[0], 0, ti->len,
1244+
dm_table_get_mode(ti->table), &dmc->disk_dev);
1245+
#endif
12411246
#endif
12421247
if (r) {
12431248
ti->error = "flashcache: Source device lookup failed";
12441249
goto bad1;
12451250
}
12461251
strncpy(dmc->disk_devname, argv[0], DEV_PATHLEN);
1247-
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34)
1248-
r = dm_get_device(ti, argv[1], 0, 0,
1252+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)
1253+
r = dm_get_device(ti, argv[0],
12491254
dm_table_get_mode(ti->table), &dmc->cache_dev);
12501255
#else
1251-
r = dm_get_device(ti, argv[1],
1256+
#if defined(RHEL_MAJOR) && RHEL_MAJOR == 6
1257+
r = dm_get_device(ti, argv[0],
1258+
dm_table_get_mode(ti->table), &dmc->cache_dev);
1259+
#else
1260+
r = dm_get_device(ti, argv[0], 0, ti->len,
12521261
dm_table_get_mode(ti->table), &dmc->cache_dev);
1262+
#endif
12531263
#endif
12541264
if (r) {
12551265
ti->error = "flashcache: Cache device lookup failed";
@@ -2049,6 +2059,9 @@ flashcache_init(void)
20492059
if (r < 0) {
20502060
DMERR("cache: register failed %d", r);
20512061
}
2062+
2063+
printk("flashcache: %s initialized\n", flashcache_sw_version);
2064+
20522065
#ifdef CONFIG_PROC_FS
20532066
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)
20542067
flashcache_table_header =

0 commit comments

Comments
 (0)