Permalink
Browse files

included few globals :P

  • Loading branch information...
1 parent d33601e commit 5ae471a49e611e4131e56b2da4a68a5dc68ea293 @boopathi boopathi committed Sep 22, 2012
Showing with 13 additions and 6 deletions.
  1. +13 −6 utils/flashcache
View
@@ -24,6 +24,12 @@ FLASHCACHE_NAME=
# Source function library.
. /etc/rc.d/init.d/functions
+#globals
+DMSETUP=`/usr/bin/which dmsetup`
+SERVICE=flashcache
+FLASHCACHE_LOAD=/sbin/flashcache_load
+SUBSYS_LOCK=/var/lock/subsys/$SERVICE
+
RETVAL=0
start() {
@@ -36,7 +42,7 @@ start() {
exit $RETVAL
fi
#flashcache_load the cachedev
- /sbin/flashcache_load $SSD_DISK $CACHEDEV_NAME
+ $FLASHCACHE_LOAD $SSD_DISK $CACHEDEV_NAME
RETVAL=$?
if [ $RETVAl -ne 0 ]; then
echo "Failed: flashcache_load $SSD_DISK $CACHEDEV_NAME"
@@ -55,22 +61,23 @@ start() {
exit 1
fi
#lock subsys
- touch /var/lock/subsys/flashcache
+ touch $SUBSYS_LOCK
}
stop() {
#unmount
/bin/umount $MOUNTPOINT
/sbin/sysctl -w dev.flashcache.$FLASHCACHE_NAME.fast_remove=0
echo "Flushing flashcache: Flushes to $BACKEND_DISK"
- dmsetup remove $CACHEDEV_NAME
+ $DMSETUP remove $CACHEDEV_NAME
#unlock subsys
- rm -f /var/lock/subsys/flashcache
+ rm -f $SUBSYS_LOCK
}
status() {
- [ -f /var/lock/subsys/flashcache ] && echo "Flashcache status: loaded" || echo "Flashcache status: NOT loaded";
- exit 0
+ [ -f $SUBSYS_LOCK ] && echo "Flashcache status: loaded" || echo "Flashcache status: NOT loaded";
+ $DMSETUP status $CACHEDEV_NAME
+ exit $?
}
case $1 in

0 comments on commit 5ae471a

Please sign in to comment.