]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
Unix CM: Fix byte accounting for storebehind
authorSimon Wilkinson <sxw@your-file-system.com>
Fri, 22 Feb 2013 16:54:17 +0000 (16:54 +0000)
committerStephan Wiesand <stephan.wiesand@desy.de>
Tue, 26 Mar 2013 11:39:00 +0000 (04:39 -0700)
In the current version of CacheStoreDCaches, the stored variable is
maintained within the for loop that iterates over the chunk list. This
means that it is reset to 0 each time we handle a new chunk.

However, this means that our progress is no longer accurately tracked,
as (bytes - stored) no longer gives the number of bytes which remain to
be transfered. In fact, as stored is zeroed with each loop iteration,
(bytes - stored) == bytes. This means that store behind is no longer
activated according to the users settings.

Prior to commit 334114ac58b0039ae90d7e29fa2f019fe068bd79, the
stored variable was maintained within the outer, function, scope.
Just move it back there to restore the previous behaviour.

Caught by clang-analyzer

Reviewed-on: http://gerrit.openafs.org/9237
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
(cherry picked from commit 5acb1a0f323a6692cca66ee3aa4c7e5f1a0f24f2)

Change-Id: I22c60b07ba9518d5714c65b1952a35214f690433
Reviewed-on: http://gerrit.openafs.org/9530
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
src/afs/afs_fetchstore.c

index 6746f1b4ffd017a48e7c7a5338cb55b5c37c22bd..c05389c1f54d89727abcad3423d0bb423b078bf9 100644 (file)
@@ -463,6 +463,7 @@ afs_CacheStoreDCaches(struct vcache *avc, struct dcache **dclist,
 {
     int *shouldwake = NULL;
     unsigned int i;
+    int stored = 0;
     afs_int32 code = 0;
     afs_size_t bytesXferred;
 
@@ -473,7 +474,6 @@ afs_CacheStoreDCaches(struct vcache *avc, struct dcache **dclist,
     XSTATS_DECLS;
 
     for (i = 0; i < nchunks && !code; i++) {
-       int stored = 0;
        struct dcache *tdc = dclist[i];
        afs_int32 size = tdc->f.chunkBytes;
        if (!tdc) {