Skip to content

Commit

Permalink
Merge configuration parameters prefetch and prefetch_max_blocks.
Browse files Browse the repository at this point in the history
  • Loading branch information
alja committed Apr 12, 2016
1 parent e98386a commit fdb98ab
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
3 changes: 1 addition & 2 deletions src/XrdFileCache/XrdFileCache.hh
Expand Up @@ -52,8 +52,7 @@ namespace XrdFileCache
m_diskUsageLWM(-1),
m_diskUsageHWM(-1),
m_bufferSize(1024*1024),
m_NRamBuffers(8000),
m_prefetch(false),
m_NRamBuffers(8000),
m_prefetch_max_blocks(10),
m_hdfsbsize(128*1024*1024) {}

Expand Down
21 changes: 14 additions & 7 deletions src/XrdFileCache/XrdFileCacheConfiguration.cc
Expand Up @@ -251,13 +251,20 @@ bool Cache::ConfigParameters(std::string part, XrdOucStream& config )
}
else if (part == "prefetch" )
{
int p = ::atoi(config.GetWord());
if (p > 0) {
printf("prefetch enabled, max blocks per file=%d\n", p);
m_configuration.m_prefetch = true;
m_configuration.m_prefetch_max_blocks = p;
} else {
m_configuration.m_prefetch = false;
const char* params = config.GetWord();
if (params) {
int p = ::atoi(config.GetWord());
if (p > 0) {
printf("prefetch enabled, max blocks per file=%d\n", p);
m_configuration.m_prefetch_max_blocks = p;
} else {
m_log.Emsg("Config", "Prefetch is disabled");
m_configuration.m_prefetch_max_blocks = 0;
}
}
{
m_log.Emsg("Config", "Error setting prefetch level.");
return false;
}
}
else if (part == "nram" )
Expand Down
6 changes: 3 additions & 3 deletions src/XrdFileCache/XrdFileCacheFile.cc
Expand Up @@ -74,7 +74,7 @@ File::File(XrdOucCacheIO2 *inputIO, std::string& disk_file_path, long long iOffs
m_input(inputIO),
m_output(NULL),
m_infoFile(NULL),
m_cfi(Cache::GetInstance().RefConfiguration().m_bufferSize, Cache::GetInstance().RefConfiguration().m_prefetch),
m_cfi(Cache::GetInstance().RefConfiguration().m_bufferSize, Cache::GetInstance().RefConfiguration().m_prefetch_max_blocks > 0),
m_temp_filename(disk_file_path),
m_offset(iOffset),
m_fileSize(iFileSize),
Expand Down Expand Up @@ -927,7 +927,7 @@ void File::Prefetch()
//______________________________________________________________________________
void File::CheckPrefetchStatRAM(Block* b)
{
if (Cache::GetInstance().RefConfiguration().m_prefetch) {
if (Cache::GetInstance().RefConfiguration().m_prefetch_max_blocks) {
if (b->m_prefetch) {
m_prefetchHitCnt++;
m_prefetchScore = float(m_prefetchHitCnt)/m_prefetchReadCnt;
Expand All @@ -938,7 +938,7 @@ void File::CheckPrefetchStatRAM(Block* b)
//______________________________________________________________________________
void File::CheckPrefetchStatDisk(int idx)
{
if (Cache::GetInstance().RefConfiguration().m_prefetch) {
if (Cache::GetInstance().RefConfiguration().m_prefetch_max_block) {
if (m_cfi.TestPrefetchBit(idx))
m_prefetchHitCnt++;
}
Expand Down

0 comments on commit fdb98ab

Please sign in to comment.