Skip to content

Commit

Permalink
Review AMT comments
Browse files Browse the repository at this point in the history
  • Loading branch information
alja committed Oct 26, 2016
1 parent ff6f3d4 commit 67b1ac5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/XrdFileCache/XrdFileCache.cc
Expand Up @@ -187,7 +187,7 @@ Cache::AddWriteTask(Block* b, bool fromRead)
if (fromRead)
m_writeQ.queue.push_back(b);
else
m_writeQ.queue.push_front(b); // AMT should this not be the opposite
m_writeQ.queue.push_front(b);
m_writeQ.size++;
m_writeQ.condVar.Signal();
m_writeQ.condVar.UnLock();
Expand Down Expand Up @@ -227,7 +227,7 @@ Cache::ProcessWriteTasks()
{
m_writeQ.condVar.Wait();
}
Block* block = m_writeQ.queue.front(); // AMT should not be back ???
Block* block = m_writeQ.queue.front();
m_writeQ.queue.pop_front();
m_writeQ.size--;
TRACE(Dump, "Cache::ProcessWriteTasks for %p " << (void*)(block) << " path " << block->m_file->lPath());
Expand Down
4 changes: 2 additions & 2 deletions src/XrdFileCache/XrdFileCacheConfiguration.cc
Expand Up @@ -243,7 +243,7 @@ bool Cache::Config(XrdSysLogger *logger, const char *config_filename, const char
" pfc.trace %d",
config_filename,
m_configuration.m_bufferSize,
m_configuration.m_prefetch_max_blocks, // AMT not sure what parsing should be
m_configuration.m_prefetch_max_blocks,
rg,
m_configuration.m_diskUsageLWM,
m_configuration.m_diskUsageHWM,
Expand Down Expand Up @@ -398,4 +398,4 @@ bool Cache::ConfigParameters(std::string part, XrdOucStream& config, TmpConfigur
assert (config.GetWord() == 0 && "Cache::ConfigParameters() lost argument");

return true;
}
}
20 changes: 6 additions & 14 deletions src/XrdFileCache/XrdFileCacheFile.cc
Expand Up @@ -449,7 +449,6 @@ int File::ReadBlocksFromDisk(std::list<int>& blocks,
return rs;
}

// AMT I think we should exit in this case too
if (rs != size)
{
TRACEF(Error, "File::ReadBlocksFromDisk incomplete size = " << rs << " idx = " << *ii);
Expand Down Expand Up @@ -550,7 +549,7 @@ int File::Read(char* iUserBuff, long long iUserOff, int iUserSize)
{
for (BlockList_i i = blks_to_process.begin(); i != blks_to_process.end(); ++i)
dec_ref_count(*i);
return -1; // AMT ???
return -1;
}

ProcessBlockRequests(blks_to_request);
Expand All @@ -573,7 +572,7 @@ int File::Read(char* iUserBuff, long long iUserOff, int iUserSize)
for (BlockList_i i = blks_to_process.begin(); i!= blks_to_process.end(); ++i )
dec_ref_count(*i);
delete direct_handler;
return -1; // AMT ???
return -1;
}
TRACEF(Dump, "File::Read() direct read finished, size = " << direct_size);
}
Expand All @@ -591,8 +590,7 @@ int File::Read(char* iUserBuff, long long iUserOff, int iUserSize)
{
bytes_read = rc;
TRACEF(Error, "File::Read() failed read from disk");
// AMT commented line below should not be an immediate return, can have block refcount increased and map increased
// return rc;
return -1;
}
}

Expand Down Expand Up @@ -692,8 +690,6 @@ int File::Read(char* iUserBuff, long long iUserOff, int iUserSize)
{
XrdSysCondVarHelper _lck(m_downloadCond);

// AMT what is stamp block ???

// blks_to_process can be non-empty, if we're exiting with an error.
std::copy(blks_to_process.begin(), blks_to_process.end(), std::back_inserter(blks_processed));

Expand Down Expand Up @@ -759,7 +755,7 @@ void File::WriteBlockToDisk(Block* b)
m_cfi.SetBitWritten(pfIdx);

if (b->m_prefetch)
m_cfi.SetBitPrefetch();
m_cfi.SetBitPrefetch(pfIdx);

// clLog()->Dump(XrdCl::AppMsg, "File::WriteToDisk() dec_ref_count %d %s", pfIdx, lPath());
dec_ref_count(b);
Expand Down Expand Up @@ -830,7 +826,7 @@ void File::dec_ref_count(Block* b)
b->m_refcnt--;
assert(b->m_refcnt >= 0);

//AMT ... this is ugly, ... File::Read() can decrease ref count before waiting to be , prefetch starts with refcnt 0
// File::Read() can decrease ref count before waiting to be , prefetch starts with refcnt 0
if (b->m_refcnt == 0 && b->is_finished())
{
free_block(b);
Expand Down Expand Up @@ -876,14 +872,10 @@ void File::ProcessBlockResponse(Block* b, int res)
}
else
{
// AMT how long to keep?
// when to retry?
// TODO: how long to keep? when to retry?
TRACEF(Error, "File::ProcessBlockResponse block " << b << " " << (int)(b->m_offset/BufferSize()) << " error=" << res);
// XrdPosixMap::Result(*status);
// AMT could notfiy global cache we dont need RAM for that block
b->set_error_and_free(res);

// ??? AMT how long to keep
inc_ref_count(b);
}

Expand Down

0 comments on commit 67b1ac5

Please sign in to comment.