diff --git a/src/Makefile b/src/Makefile index 6480664..9276430 100644 --- a/src/Makefile +++ b/src/Makefile @@ -42,7 +42,7 @@ utils: modules_install: modules install -o root -g root -m 0755 -d $(DESTDIR)/lib/modules/$(KERNEL_SOURCE_VERSION)/extra/flashcache/ install -o root -g root -m 0755 flashcache.ko $(DESTDIR)/lib/modules/$(KERNEL_SOURCE_VERSION)/extra/flashcache/ - depmod -a + depmod -a $(KERNEL_SOURCE_VERSION) .PHONY: utils_install utils_install: utils diff --git a/src/flashcache_conf.c b/src/flashcache_conf.c index f72200e..eb47d64 100644 --- a/src/flashcache_conf.c +++ b/src/flashcache_conf.c @@ -1671,11 +1671,16 @@ flashcache_init(void) #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26) r = kcopyd_client_create(FLASHCACHE_COPY_PAGES, &flashcache_kcp_client); -#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0)) || (defined(RHEL_RELEASE_CODE) && (RHEL_RELEASE_CODE >= 1538)) +elif ((LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0))&&(LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0))) || (defined(RHEL_RELEASE_CODE) && (RHEL_RELEASE_CODE >= 1538)) flashcache_kcp_client = dm_kcopyd_client_create(); if ((r = IS_ERR(flashcache_kcp_client))) { r = PTR_ERR(flashcache_kcp_client); } +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) + flashcache_kcp_client = dm_kcopyd_client_create(NULL); + if ((r = IS_ERR(flashcache_kcp_client))) { + r = PTR_ERR(flashcache_kcp_client); + } #else /* .26 <= VERSION < 3.0.0 */ r = dm_kcopyd_client_create(FLASHCACHE_COPY_PAGES, &flashcache_kcp_client); #endif /* .26 <= VERSION < 3.0.0 */ diff --git a/src/ocf/flashcache b/src/ocf/flashcache index 0edd020..a5ed8ab 100755 --- a/src/ocf/flashcache +++ b/src/ocf/flashcache @@ -92,12 +92,12 @@ flashcache_start() { exit $OCF_ERR_INSTALLED fi - if [ ! -e /proc/flashcache_version ]; then + if [ ! -e /proc/flashcache/flashcache_version ]; then ocf_log debug "Flashcache support not loaded, loading module" ocf_run modprobe -v flashcache || exit $OCF_ERR_INSTALLED fi - ocf_log debug "Flashcache module information obtained from kernel: `cat /proc/flashcache_version`" + ocf_log debug "Flashcache module information obtained from kernel: `cat /proc/flashcache/flashcache_version`" # actually start up the resource here (make sure to immediately # exit with an $OCF_ERR_ error code if anything goes seriously diff --git a/src/utils/flashcache_destroy.c b/src/utils/flashcache_destroy.c index b974401..308215e 100644 --- a/src/utils/flashcache_destroy.c +++ b/src/utils/flashcache_destroy.c @@ -51,6 +51,7 @@ usage(char *pname) } char *pname; +char *sb_buf; char *buf; main(int argc, char **argv) @@ -84,16 +85,16 @@ main(int argc, char **argv) exit(1); } lseek(cache_fd, 0, SEEK_SET); - buf = (char *)malloc(512); - if (!buf) { + sb_buf = (char *)malloc(512); + if (!sb_buf) { fprintf(stderr, "Failed to allocate sector buffer\n"); exit(1); } - if (read(cache_fd, buf, 512) < 0) { + if (read(cache_fd, sb_buf, 512) < 0) { fprintf(stderr, "Cannot read Flashcache superblock %s\n", ssd_devname); exit(1); } - sb = (struct flash_superblock *)buf; + sb = (struct flash_superblock *)sb_buf; if (!(sb->cache_sb_state == CACHE_MD_STATE_DIRTY || sb->cache_sb_state == CACHE_MD_STATE_CLEAN || sb->cache_sb_state == CACHE_MD_STATE_FASTCLEAN || @@ -113,7 +114,6 @@ main(int argc, char **argv) lseek(cache_fd, md_block_bytes, SEEK_SET); /* lseek past the superblock to first MD slot */ md_slots_per_block = (md_block_bytes / (sizeof(struct flash_cacheblock))); - free(buf); buf = (char *)malloc(md_block_bytes); if (!buf) { fprintf(stderr, "Failed to allocate sector buffer\n"); @@ -154,7 +154,7 @@ main(int argc, char **argv) pname, ssd_devname); sb->cache_sb_state = 0; lseek(cache_fd, 0, SEEK_SET); - if (write(cache_fd, buf, 512) < 0) { + if (write(cache_fd, sb_buf, 512) < 0) { fprintf(stderr, "Cannot write Flashcache superblock %s\n", ssd_devname); exit(1); } diff --git a/src/utils/flashcache_load.c b/src/utils/flashcache_load.c index 9a149d4..cb841a9 100644 --- a/src/utils/flashcache_load.c +++ b/src/utils/flashcache_load.c @@ -114,7 +114,7 @@ main(int argc, char **argv) } } - if ((argc < 2) || (argc > 3)) { + if ((argc < 2) || (argc > 4)) { usage(pname); } @@ -143,10 +143,10 @@ main(int argc, char **argv) } // switch to new vdev name if requested by load command - if (argc == 3) { - cachedev = argv[optind]; - } else { + if (optind == argc) { cachedev = sb->cache_devname; + } else { + cachedev = argv[optind]; } disk_devname = sb->disk_devname;