Skip to content

Commit

Permalink
Remove abosolete argument in Info constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
alja authored and abh3 committed Jun 30, 2016
1 parent 11b4d04 commit 9c53ad5
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/XrdFileCache/XrdFileCacheFile.cc
Expand Up @@ -75,7 +75,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().GetTrace(), Cache::GetInstance().RefConfiguration().m_bufferSize, Cache::GetInstance().RefConfiguration().m_prefetch_max_blocks > 0),
m_cfi(Cache::GetInstance().GetTrace(), Cache::GetInstance().RefConfiguration().m_prefetch_max_blocks > 0),
m_temp_filename(disk_file_path),
m_offset(iOffset),
m_fileSize(iFileSize),
Expand Down Expand Up @@ -254,6 +254,7 @@ bool File::Open()
m_fileSize = m_fileSize;
int ss = (m_fileSize - 1)/m_cfi.GetBufferSize() + 1;
TRACEF(Debug, "Creating new file info, data size = " << m_fileSize << " num blocks = " << ss);
m_cfi.SetBufferSize(Cache::GetInstance().RefConfiguration().m_bufferSize);
m_cfi.SetFileSize(m_fileSize);
m_cfi.WriteHeader(m_infoFile);
m_infoFile->Fsync();
Expand Down
2 changes: 1 addition & 1 deletion src/XrdFileCache/XrdFileCacheIOEntireFile.cc
Expand Up @@ -90,7 +90,7 @@ struct stat* IOEntireFile::getValidLocalStat(const char* path)
XrdOucEnv myEnv;
int res = infoFile->Open(path, O_RDONLY, 0600, myEnv);
if (res >= 0) {
Info info(m_cache.GetTrace(), 0);
Info info(m_cache.GetTrace());
if (info.Read(infoFile) > 0) {
tmpStat.st_size = info.GetFileSize();
m_localStat = new struct stat;
Expand Down
13 changes: 10 additions & 3 deletions src/XrdFileCache/XrdFileCacheInfo.cc
Expand Up @@ -34,16 +34,16 @@
#include "XrdFileCacheTrace.hh"

const char* XrdFileCache::Info::m_infoExtension = ".cinfo";
const char* XrdFileCache::Info::m_traceID = "cinfo";
const char* XrdFileCache::Info::m_traceID = "Cinfo";

#define BIT(n) (1ULL << (n))
using namespace XrdFileCache;


Info::Info(XrdOucTrace* trace, long long iBufferSize, bool prefetchBuffer) :
Info::Info(XrdOucTrace* trace, bool prefetchBuffer) :
m_trace(trace),
m_version(1),
m_bufferSize(iBufferSize),
m_bufferSize(-1),
m_hasPrefetchBuffer(prefetchBuffer),
m_sizeInBits(0),
m_buff_fetched(0), m_buff_write_called(0), m_buff_prefetch(0),
Expand All @@ -59,6 +59,13 @@ Info::~Info()
if (m_buff_prefetch) free(m_buff_prefetch);
}

//______________________________________________________________________________
void Info::SetBufferSize(long long bs)
{
// Needed only info is created first time in File::Open()
m_bufferSize = bs;
}

//______________________________________________________________________________
void Info::SetFileSize(long long fs)
{
Expand Down
3 changes: 2 additions & 1 deletion src/XrdFileCache/XrdFileCacheInfo.hh
Expand Up @@ -60,7 +60,7 @@ namespace XrdFileCache
//------------------------------------------------------------------------
//! Constructor.
//------------------------------------------------------------------------
Info(XrdOucTrace* trace, long long bufferSize, bool prefetchBuffer = false);
Info(XrdOucTrace* trace, bool prefetchBuffer = false);

//------------------------------------------------------------------------
//! Destructor.
Expand All @@ -86,6 +86,7 @@ namespace XrdFileCache
//---------------------------------------------------------------------
void SetBitPrefetch(int i);

void SetBufferSize(long long);
void SetFileSize(long long);

//---------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/XrdFileCache/XrdFileCachePrint.cc
Expand Up @@ -62,7 +62,7 @@ void Print::printFile(const std::string& path)
XrdSysLogger log;
XrdSysError err(&log);
XrdOucTrace tr(&err); tr.What = 1;
Info cfi(&tr, 0);
Info cfi(&tr);
long long off = cfi.Read(fh);

std::vector<Info::AStat> statv;
Expand Down
2 changes: 1 addition & 1 deletion src/XrdFileCache/XrdFileCachePurge.cc
Expand Up @@ -87,7 +87,7 @@ void FillFileMapRecurse( XrdOssDF* iOssDF, const std::string& path, FPurgeState&
// XXXX MT - shouldn't we also check if it is currently opened?

fh->Open(np.c_str(), O_RDONLY, 0600, env);
Info cinfo(Cache::GetInstance().GetTrace(), factory.RefConfiguration().m_bufferSize);
Info cinfo(Cache::GetInstance().GetTrace());
time_t accessTime;
cinfo.Read(fh);
if (cinfo.GetLatestDetachTime(accessTime, fh))
Expand Down

0 comments on commit 9c53ad5

Please sign in to comment.