From 9205b50531da1a2dafef356635a9df5eb8a25012 Mon Sep 17 00:00:00 2001 From: probe Date: Wed, 2 Nov 1994 11:28:10 +0000 Subject: [PATCH] Added an extra argument to the afs_quota_adj()... disk usage. This allows the calling routine to update the current disk usage on the given partition, if it has it available (or passes 0 if it doesn't). --- incremental/afs_create.pl | 3 ++- incremental/afs_quota.pl | 7 +------ incremental/afs_utils.pl | 9 +++++---- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/incremental/afs_create.pl b/incremental/afs_create.pl index 1d104f61..807d2b93 100644 --- a/incremental/afs_create.pl +++ b/incremental/afs_create.pl @@ -71,7 +71,8 @@ if ($tmp[$#tmp] !~ /user\../) { &fatal("Can't release $tmp[$#tmp] in cell $cell"); } -&afs_quota_adj($cell,$asrv,$apart,$quota); +# Update the quota records. +&afs_quota_adj($cell,$asrv,$apart,$quota,0); exit(0); sub fatal diff --git a/incremental/afs_quota.pl b/incremental/afs_quota.pl index 444a932f..2f09801c 100644 --- a/incremental/afs_quota.pl +++ b/incremental/afs_quota.pl @@ -52,7 +52,7 @@ $dusage = $dtotal - $tmp[5]; system("$fs","sq",$path,$newq); die "Unable to change quota on $path\n" if ($?); -&afs_quota_adj($cell,$asrv,$apart,$newq-$oldq); +&afs_quota_adj($cell,$asrv,$apart,$newq-$oldq,$dusage); if ($dusage > (0.9 * $dtotal)) { system("$zwrite","-q","-n","-c","afsadm","-m", @@ -70,8 +70,3 @@ elsif ($newq-$oldq > 39999) { system("$zwrite","-q","-n","-c","afsadm","-m", "Increased quota on volume $vname ($asrv:$apart) from $oldq to $newq"); } - -#$stat_fs = $?; -#$stat_qa = &afs_quota_adj($cell,$asrv,$apart,($stat_fs ? 0 : $newq-$oldq)); -#die "Unable to change quota on $path\n" if ($stat_fs && $stat_qa); -#warn "Unable to change quota on $path\n" if ($stat_fs); diff --git a/incremental/afs_utils.pl b/incremental/afs_utils.pl index 183b491b..06cbecb0 100644 --- a/incremental/afs_utils.pl +++ b/incremental/afs_utils.pl @@ -68,8 +68,8 @@ sub afs_unlock # max[ (2*free space) - (unused quota) ] # = max(2*total - usage - alloc) # -# Note: This routine does not actually adjust the quota; the caller -# should use afs_quota_adj(); +# Note: This routine does not actually adjust the quota; +# the calling routine should use afs_quota_adj(); sub afs_find { @@ -101,7 +101,7 @@ sub afs_find # sub afs_quota_adj { - local($cell,$asrv,$apart,$adj) = @_; + local($cell,$asrv,$apart,$adj,$dusage) = @_; local($found) = 0; &afs_lock; @@ -110,8 +110,9 @@ sub afs_quota_adj for (@afs_data) { local ($c, $as, $ap, $t, $total, $used, $alloc) = split(/\s+/,$_); if ($c eq $cell && $as eq $asrv && $ap eq $apart) { + $dusage = $used unless ($dusage); $alloc += $adj; - $_ = join(' ',$c,$asrv,$apart,$t,$total,$used,$alloc); + $_ = join(' ',$c,$asrv,$apart,$t,$total,$dusage,$alloc); $found = 1; } print SRV "$_\n"; -- 2.45.2