Skip to content

Commit

Permalink
Properly handle open and read failures of cinfo files.
Browse files Browse the repository at this point in the history
  • Loading branch information
osschar committed Jun 28, 2016
1 parent 647ae2c commit 6e3d6b8
Show file tree
Hide file tree
Showing 11 changed files with 538 additions and 402 deletions.
18 changes: 3 additions & 15 deletions src/XrdFileCache/XrdFileCache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -199,19 +199,6 @@ void Cache::Detach(XrdOucCacheIO* io)
delete io;
}

//______________________________________________________________________________
bool
Cache::HaveFreeWritingSlots()
{
const static size_t maxWriteWaits=100000;
if ( m_writeQ.size < maxWriteWaits) {
return true;
}
else {
TRACE(Dump, "Cache::HaveFreeWritingSlots() negative " << m_writeQ.size);
return false;
}
}
//______________________________________________________________________________
void
Cache::AddWriteTask(Block* b, bool fromRead)
Expand Down Expand Up @@ -438,7 +425,8 @@ int Cache::Stat(const char *curl, struct stat &sbuff)
int res = infoFile->Open(name.c_str(), O_RDONLY, 0600, myEnv);
if (res >= 0) {
Info info(m_trace, 0);
if (info.Read(infoFile) > 0) {
if (info.Read(infoFile))
{
sbuff.st_size = info.GetFileSize();
success = true;
}
Expand All @@ -461,7 +449,7 @@ Cache::Prefetch()
int limitRAM= Cache::GetInstance().RefConfiguration().m_NRamBuffers * 0.7;
while (true) {
m_RAMblock_mutex.Lock();
bool doPrefetch = (m_RAMblocks_used < limitRAM && HaveFreeWritingSlots());
bool doPrefetch = (m_RAMblocks_used < limitRAM);
m_RAMblock_mutex.UnLock();

if (doPrefetch) {
Expand Down
5 changes: 0 additions & 5 deletions src/XrdFileCache/XrdFileCache.hh
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,6 @@ namespace XrdFileCache
//---------------------------------------------------------------------
void AddWriteTask(Block* b, bool from_read);

//---------------------------------------------------------------------
//! Check write queue size is not over limit.
//---------------------------------------------------------------------
bool HaveFreeWritingSlots();

//---------------------------------------------------------------------
//! \brief Remove blocks from write queue which belong to given prefetch.
//! This method is used at the time of File destruction.
Expand Down
Loading

0 comments on commit 6e3d6b8

Please sign in to comment.