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)
committerDerrick Brashear <shadow@your-file-system.com>
Sun, 24 Feb 2013 13:23:08 +0000 (05:23 -0800)
commit5acb1a0f323a6692cca66ee3aa4c7e5f1a0f24f2
tree1eb0aacbd6046a3b0db97efbbdf2675c3fe91eef
parente76966e22ec234070157ef9179d96c2ccdb80075
Unix CM: Fix byte accounting for storebehind

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

Change-Id: I248ed81f1331f4d3d4ed2e1206acebb0a8200762
Reviewed-on: http://gerrit.openafs.org/9237
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
src/afs/afs_fetchstore.c