Skip to content

Commit

Permalink
Remove ReadInBlocks().
Browse files Browse the repository at this point in the history
  • Loading branch information
alja authored and osschar committed Mar 9, 2016
1 parent 6704cca commit 8dd2f98
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 92 deletions.
82 changes: 0 additions & 82 deletions src/XrdFileCache/XrdFileCacheFile.cc
Expand Up @@ -106,88 +106,6 @@ bool File::Open()
return true;
}

//==============================================================================

ssize_t File::ReadInBlocks(char *buff, off_t off, size_t size)
{
long long off0 = off;
int idx_first = off0 / m_cfi.GetBufferSize();
int idx_last = (off0 + size - 1)/ m_cfi.GetBufferSize();

size_t bytes_read = 0;
for (int blockIdx = idx_first; blockIdx <= idx_last; ++blockIdx)
{
int readBlockSize = size;
if (idx_first != idx_last)
{
if (blockIdx == idx_first)
{
readBlockSize = (blockIdx + 1) * m_cfi.GetBufferSize() - off0;
clLog()->Dump(XrdCl::AppMsg, "Read partially till the end of the block %", m_input.Path());
}
else if (blockIdx == idx_last)
{
readBlockSize = (off0 + size) - blockIdx * m_cfi.GetBufferSize();
clLog()->Dump(XrdCl::AppMsg, "Read partially from beginning of block %s", m_input.Path());
}
else
{
readBlockSize = m_cfi.GetBufferSize();
}
}

if (readBlockSize > m_cfi.GetBufferSize()) {
clLog()->Error(XrdCl::AppMsg, "block size invalid");
}

int retvalBlock = -1;
// now do per block read at Read(buff, off, readBlockSize)

m_downloadStatusMutex.Lock();
bool dsl = m_cfi.TestBit(blockIdx);
m_downloadStatusMutex.UnLock();

if (dsl)
{
retvalBlock = m_output->Read(buff, off, readBlockSize);
m_stats.m_BytesDisk += retvalBlock;
clLog()->Dump(XrdCl::AppMsg, "File::ReadInBlocks [%d] disk = %d",blockIdx, retvalBlock);
}
else
{
if (ReadFromTask(blockIdx, buff, off, readBlockSize))
{
retvalBlock = readBlockSize; // presume since ReadFromTask did not fail, could pass a refrence to ReadFromTask
m_stats.m_BytesRam += retvalBlock;
clLog()->Dump(XrdCl::AppMsg, "File::ReadInBlocks [%d] ram = %d", blockIdx, retvalBlock);
}
else
{
retvalBlock = m_input.Read(buff, off, readBlockSize);
clLog()->Dump(XrdCl::AppMsg, "File::ReadInBlocks [%d] client = %d", blockIdx, retvalBlock);
m_stats.m_BytesMissed += retvalBlock;
}
}

if (retvalBlock > 0 )
{
bytes_read += retvalBlock;
buff += retvalBlock;
off += retvalBlock;
if (readBlockSize != retvalBlock)
{
clLog()->Warning(XrdCl::AppMsg, "File::ReadInBlocks incomplete , missing = %d", readBlockSize-retvalBlock);
return bytes_read;
}
}
else
{
return bytes_read;
}
}
return bytes_read;
}


//==============================================================================
// Read and helpers
Expand Down
10 changes: 0 additions & 10 deletions src/XrdFileCache/XrdFileCacheFile.hh
Expand Up @@ -76,13 +76,6 @@ namespace XrdFileCache

int m_num_reads;

// XrdSysCondVar m_stateCond;

// XrdSysMutex m_downloadStatusMutex; //!< mutex locking access to m_cfi object

// std::deque<Task*> m_tasks_queue; //!< download queue
// XrdSysCondVar m_queueCond;

Stats m_stats; //!< cache statistics, used in IO detach

public:
Expand Down Expand Up @@ -115,9 +108,6 @@ namespace XrdFileCache

void ProcessBlockResponse(Block* b, XrdCl::XRootDStatus *status);

int ReadInBlocks(char* buff, off_t offset, size_t size);


};


Expand Down

0 comments on commit 8dd2f98

Please sign in to comment.