Skip to content

Commit

Permalink
DeRegister/Register files in case when they are ready for prefetching.
Browse files Browse the repository at this point in the history
  • Loading branch information
alja authored and osschar committed Mar 9, 2016
1 parent 4af1628 commit 4dbe469
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/XrdFileCache/XrdFileCacheFile.cc
Expand Up @@ -49,7 +49,7 @@ namespace XrdPosixGlobals
namespace
{
const int PREFETCH_MAX_ATTEMPTS = 10;
const size_t PREFETCH_MAX_BLOCKS=5;
const size_t PREFETCH_MAX_BLOCKS=10;

class DiskSyncer : public XrdJob
{
Expand Down Expand Up @@ -361,6 +361,7 @@ Block* File::RequestBlock(int i, bool prefetch)

if (m_prefetchState == kOn && m_block_map.size() > PREFETCH_MAX_BLOCKS) {
m_prefetchState = kHold;
cache()->DeRegisterPrefetchFile(this);
}
return b;
}
Expand Down Expand Up @@ -840,8 +841,10 @@ void File::free_block(Block* b)
cache()->RAMBlockReleased();
}

if (m_prefetchState == kHold && m_block_map.size() < PREFETCH_MAX_BLOCKS)
if (m_prefetchState == kHold && m_block_map.size() < PREFETCH_MAX_BLOCKS) {
m_prefetchState = kOn;
cache()->RegisterPrefetchFile(this);
}
}

//------------------------------------------------------------------------------
Expand Down

0 comments on commit 4dbe469

Please sign in to comment.