Skip to content
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.

Commit

Permalink
Merge branch 'master' of github.com:facebook/flashcache
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohan Srinivasan committed Apr 19, 2013
2 parents 4cc45e1 + 2381e0a commit d6f0d58
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/Makefile
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion src/flashcache_conf.c
Expand Up @@ -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 */
Expand Down
4 changes: 2 additions & 2 deletions src/ocf/flashcache
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions src/utils/flashcache_destroy.c
Expand Up @@ -51,6 +51,7 @@ usage(char *pname)
}

char *pname;
char *sb_buf;
char *buf;

main(int argc, char **argv)
Expand Down Expand Up @@ -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 ||
Expand All @@ -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");
Expand Down Expand Up @@ -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);
}
Expand Down
8 changes: 4 additions & 4 deletions src/utils/flashcache_load.c
Expand Up @@ -114,7 +114,7 @@ main(int argc, char **argv)
}
}

if ((argc < 2) || (argc > 3)) {
if ((argc < 2) || (argc > 4)) {
usage(pname);
}

Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit d6f0d58

Please sign in to comment.