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

Matthew N. Andrews matt@slackers.net
Thu, 21 Apr 2005 14:54:06 -0700


It seems like it might be interesting to get the balancer to have a 
policy based on this.

-Matt Andrews

Rainer Toebbicke wrote:
> 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.
> 
> 
> ------------------------------------------------------------------------
> 
> *** 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));
>   		}