Skip to content

Commit

Permalink
Run prefetch thread after parsing configuration.
Browse files Browse the repository at this point in the history
  • Loading branch information
alja authored and abh3 committed Jun 30, 2016
1 parent b88ec9b commit 9514dd1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
15 changes: 8 additions & 7 deletions src/XrdFileCache/XrdFileCache.cc
Expand Up @@ -78,6 +78,12 @@ XrdOucCache2 *XrdOucGetCache2(XrdSysLogger *logger,
}
err.Emsg("Retrieve", "Success - returning a factory.");

pthread_t tid1;
XrdSysThread::Run(&tid1, ProcessWriteTaskThread, (void*)(&factory), 0, "XrdFileCache WriteTasks ");

pthread_t tid2;
XrdSysThread::Run(&tid2, PrefetchThread, (void*)(&factory), 0, "XrdFileCache Prefetch ");


pthread_t tid;
XrdSysThread::Run(&tid, CacheDirCleanupThread, NULL, 0, "XrdFileCache CacheDirCleanup");
Expand Down Expand Up @@ -128,11 +134,6 @@ Cache::Cache() : XrdOucCache(),
m_prefetch_condVar(0),
m_RAMblocks_used(0)
{
pthread_t tid1;
XrdSysThread::Run(&tid1, ProcessWriteTaskThread, (void*)this, 0, "XrdFileCache WriteTasks ");

pthread_t tid2;
XrdSysThread::Run(&tid2, PrefetchThread, (void*)this, 0, "XrdFileCache Prefetch ");
}

//______________________________________________________________________________
Expand Down Expand Up @@ -315,7 +316,7 @@ Cache::RegisterPrefetchFile(File* file)
{
// called from File::Open()

if (Cache::GetInstance().RefConfiguration().m_prefetch)
if (Cache::GetInstance().RefConfiguration().m_prefetch_max_blocks)
{

XrdCl::DefaultEnv::GetLog()->Dump(XrdCl::AppMsg, "Cache::Register new file BEGIN");
Expand Down Expand Up @@ -408,7 +409,7 @@ Cache::Stat(const char *curl, struct stat &sbuff)
void
Cache::Prefetch()
{
const static int limitRAM= Cache::GetInstance().RefConfiguration().m_NRamBuffers * 0.7;
int limitRAM= Cache::GetInstance().RefConfiguration().m_NRamBuffers * 0.7;

XrdCl::DefaultEnv::GetLog()->Dump(XrdCl::AppMsg, "Cache::Prefetch thread start");

Expand Down
4 changes: 2 additions & 2 deletions src/XrdFileCache/XrdFileCacheConfiguration.cc
Expand Up @@ -159,10 +159,10 @@ bool Cache::Config(XrdSysLogger *logger, const char *config_filename, const char
char buff[2048];
loff = snprintf(buff, sizeof(buff), "result\n"
"\tpfc.blocksize %lld\n"
"\tpfc.prefetch %d\n"
"\tpfc.prefetch %ld\n"
"\tpfc.nramblocks %d\n\n",
m_configuration.m_bufferSize,
m_configuration.m_prefetch, // AMT not sure what parsing should be
m_configuration.m_prefetch_max_blocks, // AMT not sure what parsing should be
m_configuration.m_NRamBuffers );

if (m_configuration.m_hdfsmode)
Expand Down

0 comments on commit 9514dd1

Please sign in to comment.