Skip to content

Commit

Permalink
Fix restoration of file size (bug from the previous commit).
Browse files Browse the repository at this point in the history
  • Loading branch information
alja authored and abh3 committed Jun 30, 2016
1 parent c3126f8 commit 09087c7
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/XrdFileCache/XrdFileCacheInfo.cc
Expand Up @@ -57,7 +57,7 @@ Info::~Info()
void Info::SetFileSize(long long fs)
{
m_fileSize = fs;
ResizeBits(m_fileSize/m_bufferSize);
ResizeBits((m_fileSize-1)/m_bufferSize + 1) ;
}

//______________________________________________________________________________
Expand Down Expand Up @@ -89,9 +89,9 @@ int Info::Read(XrdOssDF* fp, bool init_prefetch_buff )
off += fp->Read(&m_bufferSize, off, sizeof(long long));
if (off <= 0) return off;


off += fp->Read(&m_fileSize, off, sizeof(long long));
ResizeBits(m_fileSize/m_bufferSize);
long long fs;
off += fp->Read(&fs, off, sizeof(long long));
SetFileSize(fs);

off += fp->Read(m_buff_fetched, off, GetSizeInBytes());
assert (off == GetHeaderSize());
Expand Down Expand Up @@ -131,7 +131,6 @@ void Info::WriteHeader(XrdOssDF* fp)
off += fp->Write(&m_version, off, sizeof(int));
off += fp->Write(&m_bufferSize, off, sizeof(long long));


off += fp->Write(&m_fileSize, off, sizeof(long long));
off += fp->Write(m_buff_write_called, off, GetSizeInBytes());

Expand Down

0 comments on commit 09087c7

Please sign in to comment.