Skip to content

Commit

Permalink
Set prefetch state when file is recycled by some other IO.
Browse files Browse the repository at this point in the history
  • Loading branch information
alja authored and abh3 committed Jun 30, 2016
1 parent adcf932 commit b043f32
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
13 changes: 9 additions & 4 deletions src/XrdFileCache/XrdFileCacheFile.cc
Expand Up @@ -146,11 +146,11 @@ bool File::ioActive()
m_prefetchState = kStopped;
cache()->DeRegisterPrefetchFile(this);
}
m_stateCond.UnLock();

m_stateCond.Lock();
m_stateCond.UnLock();


// remove failed blocks and check if map is empty
m_downloadCond.Lock();
/*
// high debug print
Expand All @@ -160,7 +160,6 @@ bool File::ioActive()
}
*/
// remove failed blocks
BlockMap_i itr = m_block_map.begin();
while (itr != m_block_map.end()) {
if (itr->second->is_failed() && itr->second->m_refcnt == 1) {
Expand Down Expand Up @@ -191,7 +190,13 @@ bool File::ioActive()

//______________________________________________________________________________


void File::WakeUp()
{
// called if this object is recycled by other IO
m_stateCond.Lock();
if (m_prefetchState != kComplete) m_prefetchState = kOn;
m_stateCond.UnLock();
}

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

Expand Down
2 changes: 2 additions & 0 deletions src/XrdFileCache/XrdFileCacheFile.hh
Expand Up @@ -192,6 +192,8 @@ namespace XrdFileCache
XrdOucTrace* GetTrace();

long long GetFileSize() { return m_fileSize;}

void WakeUp();
private:
bool overlap(int blk, // block to query
long long blk_size, //
Expand Down
6 changes: 5 additions & 1 deletion src/XrdFileCache/XrdFileCacheIOEntireFile.cc
Expand Up @@ -42,8 +42,12 @@ IOEntireFile::IOEntireFile(XrdOucCacheIO2 *io, XrdOucCacheStats &stats, Cache &
XrdCl::URL url(m_io->Path());
std::string fname = Cache::GetInstance().RefConfiguration().m_cache_dir + url.GetPath();

if (!(m_file = Cache::GetInstance().GetFileWithLocalPath(fname, this)))
if ((m_file = Cache::GetInstance().GetFileWithLocalPath(fname, this)))
{
m_file->WakeUp();
}
else {

struct stat st;
int res = Fstat(st);

Expand Down

0 comments on commit b043f32

Please sign in to comment.