[OpenAFS-devel] patch to maintain "filecount" in volume header

Rainer Toebbicke rtb@pclella.cern.ch
Fri, 15 Apr 2005 13:23:38 +0200


This is a multi-part message in MIME format.
--------------040907030108010801040107
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

The volume header has a field called "filecount", updated upon salvage, 
and henceforth forgotten.

The attached patch maintains that count (which for existing volumes is 
obviously wrong until the next salvage, but care is taken not to 
underflow). The only way to display it is through 'volinfo' (which means 
the information is out-of-date until the fileserver flushes the header), 
but I'm sure some motivated soul can eventually cram this into 'vos 
examine' or thereabouts.

The field is useful as it is the number 1 parameter governing the time 
it takes for a 'vos backup', 'release' or a salvage.

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Rainer Toebbicke
European Laboratory for Particle Physics(CERN) - Geneva, Switzerland
Phone: +41 22 767 8985       Fax: +41 22 767 7155

--------------040907030108010801040107
Content-Type: text/plain;
 name="patch_filecount"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="patch_filecount"

*** openafs/src/vol/vnode.c.orig	2004-08-25 09:14:19.000000000 +0200
--- openafs/src/vol/vnode.c	2004-11-19 17:34:40.000000000 +0100
***************
*** 428,433 ****
--- 428,434 ----
      vnp->disk.uniquifier = unique;
      vnp->handle = NULL;
      vcp->allocs++;
+     vp->header->diskstuff.filecount++;
      return vnp;
  }
  
***************
*** 760,765 ****
--- 761,767 ----
  		 * (doing so could cause a "addled bitmap" message).
  		 */
  		if (vnp->delete && !*ec) {
+ 		    if (vnp->volumePtr->header->diskstuff.filecount-- < 1) vnp->volumePtr->header->diskstuff.filecount=0;
  		    VFreeBitMapEntry_r(ec, &vp->vnodeIndex[class],
  				       vnodeIdToBitNumber(vnp->vnodeNumber));
  		}

--------------040907030108010801040107--