diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2016-07-08 15:07:49 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2016-07-08 15:07:49 +0200 |
commit | e521cb104fe6e962bd10501735256c420614d872 (patch) | |
tree | b2c8f0a8be381474ece35bf425ca68cd1ca81800 | |
parent | aa56395f5b3d6feaa12148a6dc8b31422461ab01 (diff) |
Correct the cachedSize
-rw-r--r-- | fastos/src/vespa/fastos/linux_file.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fastos/src/vespa/fastos/linux_file.cpp b/fastos/src/vespa/fastos/linux_file.cpp index 9452d1f50f9..8d1b76404b8 100644 --- a/fastos/src/vespa/fastos/linux_file.cpp +++ b/fastos/src/vespa/fastos/linux_file.cpp @@ -330,6 +330,10 @@ FastOS_Linux_File::DirectIOPadding (int64_t offset, size_t &padAfter) { if (_directIOEnabled) { + if (offset+length > _cachedSize) { + // _cachedSize is not really trustworthy, so if we suspect it is not correct, we correct it. + _cachedSize = GetSize(); + } padBefore = offset & (_directIOFileAlign - 1); padAfter = _directIOFileAlign - ((padBefore + length) & (_directIOFileAlign - 1)); |