Skip to content

Commit

Permalink
Fix offset in disk reads
Browse files Browse the repository at this point in the history
  • Loading branch information
alja authored and osschar committed Mar 9, 2016
1 parent 6b12ae0 commit 673e7e5
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/XrdFileCache/XrdFileCacheVRead.cc
Expand Up @@ -186,15 +186,15 @@ bool File::VReadPreProcess(const XrdOucIOVec *readV, int n, ReadVBlockListRAM& b
else if (m_cfi.TestBit(block_idx))
{
blocks_on_disk.AddEntry(block_idx, iov_idx);
clLog()->Debug(XrdCl::AppMsg, "VReadPreProcess block %d on disk", block_idx);
clLog()->Debug(XrdCl::AppMsg, "VReadPreProcess block %d , chunk idx = %d on disk", block_idx,iov_idx );
}
else {
if ( Factory::GetInstance().GetCache()->HaveFreeWritingSlots() && Factory::GetInstance().GetCache()->RequestRAMBlock())
{
Block *b = RequestBlock(block_idx, false);
if (!b) return false;
blocks_to_process.AddEntry(b, iov_idx);
clLog()->Debug(XrdCl::AppMsg, "VReadPreProcess request block %d", block_idx);
clLog()->Debug(XrdCl::AppMsg, "VReadPreProcess request block %d", block_idx);
inc_ref_count(b);
}
else {
Expand Down Expand Up @@ -233,12 +233,16 @@ int File::VReadFromDisk(const XrdOucIOVec *readV, int n, ReadVBlockListDisk& blo

clLog()->Debug(XrdCl::AppMsg, "VReadFromDisk block=%d chunk=%d", blockIdx, chunkIdx);
overlap(blockIdx, m_cfi.GetBufferSize(), readV[chunkIdx].offset, readV[chunkIdx].size, off, blk_off, size);
int rs = m_output->Read(readV[chunkIdx].data + readV[chunkIdx].offset + off, blockIdx*m_cfi.GetBufferSize() + blk_off, size);

int rs = m_output->Read(readV[chunkIdx].data + off, blockIdx*m_cfi.GetBufferSize() + blk_off, size);
if (rs >=0 ) {
bytes_read += rs;
}
else {
// ofs read shoul set the errno

clLog()->Error(XrdCl::AppMsg, "VReadFromDisk FAILED block=%d chunk=%d off=%lld, blk_off=%lld, size=%lld, chunfoff =%lld", blockIdx, chunkIdx, off, blk_off, size,readV[chunkIdx].offset );

return -1;
}
}
Expand Down

0 comments on commit 673e7e5

Please sign in to comment.