[OpenAFS-devel] Running with memory cache

Stephan Wonczak a0033@rrz.uni-koeln.de
Thu, 31 Mar 2005 17:10:05 +0200 (MET DST)


  Hi all!
  When faced with the problem running an afs client with memory cache, I
found that (at least for linux) the afs.rc has no support to make this
really easy. You can always patch the options in the startup script and
use that, of course, but this strikes me as horribly inefficient if
everyone has to do that.
  So it occured to me it would be nice if I could simply use

CACHESIZE=50000
OPTIONS=MEMORY

  in /etc/sysconfig/afs to get memory cache. I then went ahead and patched
the /etc/init.d/afs startup-script (a copy of openafs-1.2.13/src/afsd/afs.rc.linux)
in this way:

[root@altix1 configs]# diff -c
/service/openafs/source-1.2.13/openafs-1.2.13/src/afsd/afs.rc.linux
/etc/init.d/afs
*** /service/openafs/source-1.2.13/openafs-1.2.13/src/afsd/afs.rc.linux
2002-08-01 00:41:54.000000000 +0200
--- /etc/init.d/afs	2005-03-30 11:25:17.000000000 +0200
***************
*** 195,200 ****
--- 195,203 ----
  	    CACHESIZE=`echo $PARTSIZE | awk '{printf
"%d",int(($1*.8)/1000)*1000}'`
  	fi
      fi
+     if [ "$OPTIONS" = "MEMORY" ] ; then
+ 	CACHE="MEMORY"
+     fi
      if [ "x$CACHESIZE" != "x" ]; then
  	echo $AFS:$CACHE:$CACHESIZE >$CACHEINFO
  	chmod 0644 $CACHEINFO
***************
*** 204,209 ****
--- 207,215 ----
  }

  choose_afsdoptions() {
+ 	if [ "$OPTIONS" = "MEMORY" ] ; then
+ 		OPTIONS="-memcache -blocks $CACHESIZE"
+ 	fi
  	if [ -z "$OPTIONS" -o "$OPTIONS" = "AUTOMATIC" ]; then
  		if [ $CACHESIZE -lt 131072 ]; then
  			OPTIONS=$SMALL

  Before putting more work into this (e.g. doing this for all the other
startup scripts, too), would patches like this be acceptable for 1.2.x
(and 1.3x of course). I'm looking for comments!

  Keep up the good work!

	Dipl. Chem. Dr. Stephan Wonczak

        Zentrum fuer Angewandte Informatik (ZAIK)
        Regionales Rechenzentrum der Universitaet zu Koeln (RRZK)
        Universitaet zu Koeln, Robert-Koch-Strasse 10, 50931 Koeln
        Tel: ++49/(0)221/478-5577, Fax: ++49/(0)221/478-5590