From bc4c1b7460d014c1e5bf29d611c139a0c8236b0f Mon Sep 17 00:00:00 2001 From: Alja Mrak-Tadel Date: Mon, 28 Mar 2016 15:00:03 -0700 Subject: [PATCH] Pass input source as a pointer instead of reference. --- src/XrdFileCache/XrdFileCache.cc | 42 +++++++++++++++--- src/XrdFileCache/XrdFileCache.hh | 7 +++ src/XrdFileCache/XrdFileCacheFile.cc | 27 +++++++----- src/XrdFileCache/XrdFileCacheFile.hh | 4 +- src/XrdFileCache/XrdFileCacheIO.hh | 11 ++--- src/XrdFileCache/XrdFileCacheIOEntireFile.cc | 32 ++++++++------ src/XrdFileCache/XrdFileCacheIOEntireFile.hh | 2 +- src/XrdFileCache/XrdFileCacheIOFileBlock.cc | 46 ++++++++++---------- src/XrdFileCache/XrdFileCacheIOFileBlock.hh | 6 +-- src/XrdFileCache/XrdFileCacheVRead.cc | 2 +- 10 files changed, 113 insertions(+), 66 deletions(-) diff --git a/src/XrdFileCache/XrdFileCache.cc b/src/XrdFileCache/XrdFileCache.cc index 0d63aff1926..383579cb59b 100644 --- a/src/XrdFileCache/XrdFileCache.cc +++ b/src/XrdFileCache/XrdFileCache.cc @@ -30,11 +30,9 @@ #include "XrdOuc/XrdOucUtils.hh" #include "XrdFileCache.hh" +#include "XrdFileCacheInfo.hh" #include "XrdFileCacheIOEntireFile.hh" #include "XrdFileCacheIOFileBlock.hh" -//#include "XrdFileCacheConfiguration.cc" -//#include "XrdFileCachePurge.cc" - using namespace XrdFileCache; @@ -146,9 +144,9 @@ XrdOucCacheIO2 *Cache::Attach(XrdOucCacheIO2 *io, int Options) clLog()->Info(XrdCl::AppMsg, "Cache::Attach() %s", io->Path()); IO* cio; if (Cache::GetInstance().RefConfiguration().m_hdfsmode) - cio = new IOFileBlock(*io, m_stats, *this); + cio = new IOFileBlock(io, m_stats, *this); else - cio = new IOEntireFile(*io, m_stats, *this); + cio = new IOEntireFile(io, m_stats, *this); return cio; } @@ -316,6 +314,7 @@ Cache::DeRegisterPrefetchFile(File* file) } m_prefetch_condVar.UnLock(); } + //______________________________________________________________________________ File* @@ -336,6 +335,39 @@ Cache::GetNextFileToPrefetch() return f; } +//______________________________________________________________________________ + +int +Cache::Prepare(const char *url, int oflags, mode_t mode) +{ + return 1; +} + +//______________________________________________________________________________ + +int +Cache::Stat(const char *curl, struct stat &sbuff) +{ + XrdCl::URL url(curl); + std::string fname = Cache::GetInstance().RefConfiguration().m_cache_dir + url.GetPath(); + fname += ".cinfo"; + + XrdOucEnv myEnv; + XrdOssDF* df = m_output_fs->newFile(Cache::GetInstance().RefConfiguration().m_username.c_str()); + int res = df->Open(fname.c_str(), O_RDONLY, 0600, myEnv); + if (res != 0) + return 1; + + df->Fstat(&sbuff); + + Info cinfo(0); + cinfo.Read(df); + sbuff.st_size = cinfo.GetSizeInBits(); + delete df; + return 0; +} + + //______________________________________________________________________________ diff --git a/src/XrdFileCache/XrdFileCache.hh b/src/XrdFileCache/XrdFileCache.hh index 97477a1c5f0..e23aeefadf0 100644 --- a/src/XrdFileCache/XrdFileCache.hh +++ b/src/XrdFileCache/XrdFileCache.hh @@ -99,6 +99,13 @@ namespace XrdFileCache // this is an obsolete method virtual XrdOucCache* Create(XrdOucCache::Parms&, XrdOucCacheIO::aprParms*); + // Virtual function of XrdOucCache2. Used for deferred open. + virtual int Prepare(const char *url, int oflags, mode_t mode); + + + // virtual function of XrdOucCache2::Stat() + virtual int Stat(const char *url, struct stat &sbuff); + //-------------------------------------------------------------------- //! \brief Makes decision if the original XrdOucCacheIO should be cached. //! diff --git a/src/XrdFileCache/XrdFileCacheFile.cc b/src/XrdFileCache/XrdFileCacheFile.cc index a670874846a..5bd2704c3aa 100644 --- a/src/XrdFileCache/XrdFileCacheFile.cc +++ b/src/XrdFileCache/XrdFileCacheFile.cc @@ -70,7 +70,7 @@ namespace Cache* cache() { return &Cache::GetInstance(); } } -File::File(XrdOucCacheIO2 &inputIO, std::string& disk_file_path, long long iOffset, long long iFileSize) : +File::File(XrdOucCacheIO2 *inputIO, std::string& disk_file_path, long long iOffset, long long iFileSize) : m_input(inputIO), m_output(NULL), m_infoFile(NULL), @@ -91,9 +91,9 @@ m_prefetchHitCnt(0), m_prefetchScore(1), m_prefetchCurrentCnt(0) { - clLog()->Debug(XrdCl::AppMsg, "File::File() %s", m_input.Path()); + clLog()->Debug(XrdCl::AppMsg, "File::File() %s", m_input->Path()); if (!Open()) { - clLog()->Error(XrdCl::AppMsg, "File::File() Open failed %s !!!", m_input.Path()); + clLog()->Error(XrdCl::AppMsg, "File::File() Open failed %s !!!", m_input->Path()); } } @@ -220,7 +220,7 @@ bool File::InitiateClose() bool File::Open() { - clLog()->Dump(XrdCl::AppMsg, "File::Open() open file for disk cache %s", m_input.Path()); + clLog()->Dump(XrdCl::AppMsg, "File::Open() open file for disk cache %s", m_input->Path()); XrdOss &m_output_fs = *Cache::GetInstance().GetOss(); // Create the data file itself. @@ -232,7 +232,7 @@ bool File::Open() int res = m_output->Open(m_temp_filename.c_str(), O_RDWR, 0600, myEnv); if (res < 0) { - clLog()->Error(XrdCl::AppMsg, "File::Open() can't get data-FD for %s %s", m_temp_filename.c_str(), m_input.Path()); + clLog()->Error(XrdCl::AppMsg, "File::Open() can't get data-FD for %s %s", m_temp_filename.c_str(), m_input->Path()); delete m_output; m_output = 0; @@ -254,7 +254,7 @@ bool File::Open() int res = m_infoFile->Open(ifn.c_str(), O_RDWR, 0600, myEnv); if (res < 0) { - clLog()->Error(XrdCl::AppMsg, "File::Open() can't get info-FD %s %s", ifn.c_str(), m_input.Path()); + clLog()->Error(XrdCl::AppMsg, "File::Open() can't get info-FD %s %s", ifn.c_str(), m_input->Path()); delete m_infoFile; m_infoFile = 0; return false; @@ -267,14 +267,17 @@ bool File::Open() if (m_cfi.Read(m_infoFile, Cache::GetInstance().RefConfiguration().m_prefetch) <= 0) { + m_fileSize = m_input->FSize(); int ss = (m_fileSize - 1)/m_cfi.GetBufferSize() + 1; - clLog()->Info(XrdCl::AppMsg, "Creating new file info with size %lld. Reserve space for %d blocks %s", m_fileSize, ss, m_input.Path()); + clLog()->Info(XrdCl::AppMsg, "Creating new file info with size %lld. Reserve space for %d blocks %s", m_fileSize, ss, m_input->Path()); m_cfi.ResizeBits(ss, Cache::GetInstance().RefConfiguration().m_prefetch); m_cfi.WriteHeader(m_infoFile); } else { - clLog()->Debug(XrdCl::AppMsg, "Info file read from disk: %s", m_input.Path()); + m_fileSize = m_cfi.GetSizeInBits(); + printf("%lld file size \n", m_fileSize); + clLog()->Debug(XrdCl::AppMsg, "Info file read from disk: %s", m_input->Path()); } @@ -339,12 +342,12 @@ Block* File::RequestBlock(int i, bool prefetch) const int last_block = m_cfi.GetSizeInBits() - 1; long long off = i * BS; - long long this_bs = (i == last_block) ? m_input.FSize() - off : BS; + long long this_bs = (i == last_block) ? m_input->FSize() - off : BS; Block *b = new Block(this, off, this_bs, prefetch); // should block be reused to avoid recreation BlockResponseHandler* oucCB = new BlockResponseHandler(b); - m_input.Read(*oucCB, (char*)b->get_buff(), off, (int)this_bs); + m_input->Read(*oucCB, (char*)b->get_buff(), off, (int)this_bs); clLog()->Dump(XrdCl::AppMsg, "File::RequestBlock() this = %p, b=%p, this idx=%d pOn=(%d) %s", (void*)this, (void*)b, i, prefetch, lPath()); m_block_map[i] = b; @@ -377,7 +380,7 @@ int File::RequestBlocksDirect(DirectResponseHandler *handler, IntList_t& blocks, overlap(*ii, BS, req_off, req_size, off, blk_off, size); - m_input.Read( *handler, req_buf + off, *ii * BS + blk_off, size); + m_input->Read( *handler, req_buf + off, *ii * BS + blk_off, size); clLog()->Dump(XrdCl::AppMsg, "RequestBlockDirect success %d %ld %s", *ii, size, lPath()); total += size; @@ -684,7 +687,7 @@ void File::WriteBlockToDisk(Block* b) int retval = 0; // write block buffer into disk file long long offset = b->m_offset - m_offset; - long long size = (b->m_offset + m_cfi.GetBufferSize()) > m_input.FSize() ? (m_input.FSize() - b->m_offset) : m_cfi.GetBufferSize(); + long long size = (b->m_offset + m_cfi.GetBufferSize()) > m_input->FSize() ? (m_input->FSize() - b->m_offset) : m_cfi.GetBufferSize(); int buffer_remaining = size; int buffer_offset = 0; int cnt = 0; diff --git a/src/XrdFileCache/XrdFileCacheFile.hh b/src/XrdFileCache/XrdFileCacheFile.hh index 45af499445c..6857edf9957 100644 --- a/src/XrdFileCache/XrdFileCacheFile.hh +++ b/src/XrdFileCache/XrdFileCacheFile.hh @@ -97,7 +97,7 @@ namespace XrdFileCache private: enum PrefetchState_e { kOn, kHold, kCanceled }; - XrdOucCacheIO2 &m_input; //!< original data source + XrdOucCacheIO2 *m_input; //!< original data source XrdOssDF *m_output; //!< file handle for data file on disk XrdOssDF *m_infoFile; //!< file handle for data-info file on disk Info m_cfi; //!< download status of file blocks and access statistics @@ -144,7 +144,7 @@ namespace XrdFileCache //------------------------------------------------------------------------ //! Constructor. //------------------------------------------------------------------------ - File(XrdOucCacheIO2 &io, std::string &path, + File(XrdOucCacheIO2 *io, std::string &path, long long offset, long long fileSize); //------------------------------------------------------------------------ diff --git a/src/XrdFileCache/XrdFileCacheIO.hh b/src/XrdFileCache/XrdFileCacheIO.hh index 815cf196ffe..a91d90d32f8 100644 --- a/src/XrdFileCache/XrdFileCacheIO.hh +++ b/src/XrdFileCache/XrdFileCacheIO.hh @@ -13,17 +13,17 @@ namespace XrdFileCache class IO : public XrdOucCacheIO2 { public: - IO (XrdOucCacheIO2 &io, XrdOucCacheStats &stats, Cache &cache) : + IO (XrdOucCacheIO2 *io, XrdOucCacheStats &stats, Cache &cache) : m_io(io), m_statsGlobal(stats), m_cache(cache) {} //! Original data source. - virtual XrdOucCacheIO *Base() { return &m_io; } + virtual XrdOucCacheIO *Base() { return m_io; } //! Original data source URL. - virtual long long FSize() { return m_io.FSize(); } + virtual long long FSize() { return m_io->FSize(); } //! Original data source URL. - virtual const char *Path() { return m_io.Path(); } + virtual const char *Path() { return m_io->Path(); } virtual int Sync() { return 0; } @@ -32,11 +32,12 @@ namespace XrdFileCache virtual int Write(char *Buffer, long long Offset, int Length) { errno = ENOTSUP; return -1; } + virtual void Update(XrdOucCacheIO2 &iocp) { m_io = &iocp; } protected: XrdCl::Log* clLog() const { return XrdCl::DefaultEnv::GetLog(); } - XrdOucCacheIO2 &m_io; //!< original data source + XrdOucCacheIO2 *m_io; //!< original data source XrdOucCacheStats &m_statsGlobal; //!< reference to Cache statistics Cache &m_cache; //!< reference to Cache needed in detach }; diff --git a/src/XrdFileCache/XrdFileCacheIOEntireFile.cc b/src/XrdFileCache/XrdFileCacheIOEntireFile.cc index 25fb8cdbff3..6da14758973 100644 --- a/src/XrdFileCache/XrdFileCacheIOEntireFile.cc +++ b/src/XrdFileCache/XrdFileCacheIOEntireFile.cc @@ -31,16 +31,16 @@ using namespace XrdFileCache; //______________________________________________________________________________ -IOEntireFile::IOEntireFile(XrdOucCacheIO2 &io, XrdOucCacheStats &stats, Cache & cache) +IOEntireFile::IOEntireFile(XrdOucCacheIO2 *io, XrdOucCacheStats &stats, Cache & cache) : IO(io, stats, cache), m_file(0) { - clLog()->Info(XrdCl::AppMsg, "IO::IO() [%p] %s", this, m_io.Path()); + clLog()->Info(XrdCl::AppMsg, "IO::IO() [%p] %s", this, m_io->Path()); - XrdCl::URL url(io.Path()); + XrdCl::URL url(m_io->Path()); std::string fname = Cache::GetInstance().RefConfiguration().m_cache_dir + url.GetPath(); - m_file = new File(io, fname, 0, io.FSize()); + m_file = new File(io, fname, 0, 0); } IOEntireFile::~IOEntireFile() @@ -55,7 +55,7 @@ XrdOucCacheIO *IOEntireFile::Detach() { m_statsGlobal.Add(m_file->GetStats()); - XrdOucCacheIO * io = &m_io; + XrdOucCacheIO * io = m_io; delete m_file; m_file = 0; @@ -72,24 +72,28 @@ void IOEntireFile::Read (XrdOucCacheIOCB &iocb, char *buff, long long offs, int int IOEntireFile::Read (char *buff, long long off, int size) { - clLog()->Debug(XrdCl::AppMsg, "IOEntireFile::Read() [%p] %lld@%d %s", this, off, size, m_io.Path()); + + + clLog()->Debug(XrdCl::AppMsg, "IOEntireFile::Read() [%p] %lld@%d %s", this, off, size, m_io->Path()); + + return m_io->Read(buff, off, size); // protect from reads over the file size - if (off >= m_io.FSize()) - return 0; + // if (off >= m_io->FSize()) + // return 0; if (off < 0) { errno = EINVAL; return -1; } - if (off + size > m_io.FSize()) - size = m_io.FSize() - off; + //if (off + size > m_io->FSize()) + // size = m_io->FSize() - off; ssize_t bytes_read = 0; ssize_t retval = 0; retval = m_file->Read(buff, off, size); - clLog()->Debug(XrdCl::AppMsg, "IOEntireFile::Read() read from File retval = %d %s", retval, m_io.Path()); + clLog()->Debug(XrdCl::AppMsg, "IOEntireFile::Read() read from File retval = %d %s", retval, m_io->Path()); if (retval >= 0) { bytes_read += retval; @@ -97,11 +101,11 @@ int IOEntireFile::Read (char *buff, long long off, int size) size -= retval; if (size > 0) - clLog()->Warning(XrdCl::AppMsg, "IOEntireFile::Read() missed %d bytes %s", size, m_io.Path()); + clLog()->Warning(XrdCl::AppMsg, "IOEntireFile::Read() missed %d bytes %s", size, m_io->Path()); } else { - clLog()->Error(XrdCl::AppMsg, "IOEntireFile::Read(), origin bytes read %d %s", retval, m_io.Path()); + clLog()->Error(XrdCl::AppMsg, "IOEntireFile::Read(), origin bytes read %d %s", retval, m_io->Path()); } return (retval < 0) ? retval : bytes_read; @@ -113,7 +117,7 @@ int IOEntireFile::Read (char *buff, long long off, int size) */ int IOEntireFile::ReadV (const XrdOucIOVec *readV, int n) { - clLog()->Warning(XrdCl::AppMsg, "IOEntireFile::ReadV(), get %d requests %s", n, m_io.Path()); + clLog()->Warning(XrdCl::AppMsg, "IOEntireFile::ReadV(), get %d requests %s", n, m_io->Path()); return m_file->ReadV(readV, n); diff --git a/src/XrdFileCache/XrdFileCacheIOEntireFile.hh b/src/XrdFileCache/XrdFileCacheIOEntireFile.hh index 1c2db014e9e..f0d112249d5 100644 --- a/src/XrdFileCache/XrdFileCacheIOEntireFile.hh +++ b/src/XrdFileCache/XrdFileCacheIOEntireFile.hh @@ -43,7 +43,7 @@ namespace XrdFileCache //------------------------------------------------------------------------ //! Constructor //------------------------------------------------------------------------ - IOEntireFile(XrdOucCacheIO2 &io, XrdOucCacheStats &stats, Cache &cache); + IOEntireFile(XrdOucCacheIO2 *io, XrdOucCacheStats &stats, Cache &cache); //------------------------------------------------------------------------ //! Destructor diff --git a/src/XrdFileCache/XrdFileCacheIOFileBlock.cc b/src/XrdFileCache/XrdFileCacheIOFileBlock.cc index 921e0a28db1..9151cbdccdf 100644 --- a/src/XrdFileCache/XrdFileCacheIOFileBlock.cc +++ b/src/XrdFileCache/XrdFileCacheIOFileBlock.cc @@ -33,7 +33,7 @@ using namespace XrdFileCache; //______________________________________________________________________________ -IOFileBlock::IOFileBlock(XrdOucCacheIO2 &io, XrdOucCacheStats &statsGlobal, Cache & cache) +IOFileBlock::IOFileBlock(XrdOucCacheIO2 *io, XrdOucCacheStats &statsGlobal, Cache & cache) : IO(io, statsGlobal, cache) { m_blocksize = Cache::GetInstance().RefConfiguration().m_hdfsbsize; @@ -43,8 +43,8 @@ IOFileBlock::IOFileBlock(XrdOucCacheIO2 &io, XrdOucCacheStats &statsGlobal, Cach //______________________________________________________________________________ XrdOucCacheIO* IOFileBlock::Detach() { - clLog()->Info(XrdCl::AppMsg, "IOFileBlock::Detach() %s", m_io.Path()); - XrdOucCacheIO * io = &m_io; + clLog()->Info(XrdCl::AppMsg, "IOFileBlock::Detach() %s", m_io->Path()); + XrdOucCacheIO * io = m_io; for (std::map::iterator it = m_blocks.begin(); it != m_blocks.end(); ++it) @@ -62,7 +62,7 @@ XrdOucCacheIO* IOFileBlock::Detach() void IOFileBlock::GetBlockSizeFromPath() { const static std::string tag = "hdfsbsize="; - std::string path= m_io.Path(); + std::string path= m_io->Path(); size_t pos1 = path.find(tag); size_t t = tag.length(); if ( pos1 != path.npos) @@ -78,14 +78,14 @@ void IOFileBlock::GetBlockSizeFromPath() m_blocksize = atoi(path.substr(pos1).c_str()); } - clLog()->Debug(XrdCl::AppMsg, "FileBlock::GetBlockSizeFromPath(), blocksize = %lld. %s", m_blocksize, m_io.Path()); + clLog()->Debug(XrdCl::AppMsg, "FileBlock::GetBlockSizeFromPath(), blocksize = %lld. %s", m_blocksize, m_io->Path()); } } //______________________________________________________________________________ -File* IOFileBlock::newBlockFile(long long off, int blocksize, XrdOucCacheIO2* io) +File* IOFileBlock::newBlockFile(long long off, int blocksize) { - XrdCl::URL url(io->Path()); + XrdCl::URL url(m_io->Path()); std::string fname = Cache::GetInstance().RefConfiguration().m_cache_dir + url.GetPath(); std::stringstream ss; @@ -96,8 +96,8 @@ File* IOFileBlock::newBlockFile(long long off, int blocksize, XrdOucCacheIO2* i ss << &offExt[0]; fname = ss.str(); - clLog()->Debug(XrdCl::AppMsg, "FileBlock::FileBlock(), create XrdFileCacheFile. %s", m_io.Path()); - File* prefetch = new File(*io, fname, off, blocksize); + clLog()->Debug(XrdCl::AppMsg, "FileBlock::FileBlock(), create XrdFileCacheFile. %s", m_io->Path()); + File* prefetch = new File(m_io, fname, off, blocksize); return prefetch; } @@ -118,21 +118,21 @@ bool IOFileBlock::ioActive() int IOFileBlock::Read (char *buff, long long off, int size) { // protect from reads over the file size - if (off >= m_io.FSize()) + if (off >= m_io->FSize()) return 0; if (off < 0) { errno = EINVAL; return -1; } - if (off + size > m_io.FSize()) - size = m_io.FSize() - off; + if (off + size > m_io->FSize()) + size = m_io->FSize() - off; long long off0 = off; int idx_first = off0/m_blocksize; int idx_last = (off0+size-1)/m_blocksize; int bytes_read = 0; - clLog()->Debug(XrdCl::AppMsg, "IOFileBlock::Read() %lld@%d block range [%d-%d] \n %s", off, size, idx_first, idx_last, m_io.Path()); + clLog()->Debug(XrdCl::AppMsg, "IOFileBlock::Read() %lld@%d block range [%d-%d] \n %s", off, size, idx_first, idx_last, m_io->Path()); for (int blockIdx = idx_first; blockIdx <= idx_last; ++blockIdx ) { @@ -148,14 +148,14 @@ int IOFileBlock::Read (char *buff, long long off, int size) { size_t pbs = m_blocksize; // check if this is last block - int lastIOFileBlock = (m_io.FSize()-1)/m_blocksize; + int lastIOFileBlock = (m_io->FSize()-1)/m_blocksize; if (blockIdx == lastIOFileBlock ) { - pbs = m_io.FSize() - blockIdx*m_blocksize; - clLog()->Debug(XrdCl::AppMsg, "IOFileBlock::Read() last block, change output file size to %lld \n %s", pbs, m_io.Path()); + pbs = m_io->FSize() - blockIdx*m_blocksize; + clLog()->Debug(XrdCl::AppMsg, "IOFileBlock::Read() last block, change output file size to %lld \n %s", pbs, m_io->Path()); } - fb = newBlockFile(blockIdx*m_blocksize, pbs, &m_io); + fb = newBlockFile(blockIdx*m_blocksize, pbs); m_blocks.insert(std::pair(blockIdx, (File*) fb)); } m_mutex.UnLock(); @@ -167,12 +167,12 @@ int IOFileBlock::Read (char *buff, long long off, int size) if (blockIdx == idx_first) { readBlockSize = (blockIdx + 1) *m_blocksize - off0; - clLog()->Debug(XrdCl::AppMsg, "Read partially till the end of the block %s", m_io.Path()); + clLog()->Debug(XrdCl::AppMsg, "Read partially till the end of the block %s", m_io->Path()); } else if (blockIdx == idx_last) { readBlockSize = (off0+size) - blockIdx*m_blocksize; - clLog()->Debug(XrdCl::AppMsg, "Read partially from beginning of block %s", m_io.Path()); + clLog()->Debug(XrdCl::AppMsg, "Read partially from beginning of block %s", m_io->Path()); } else { @@ -181,14 +181,14 @@ int IOFileBlock::Read (char *buff, long long off, int size) } assert(readBlockSize); - clLog()->Info(XrdCl::AppMsg, "IOFileBlock::Read() block[%d] read-block-size[%d], offset[%lld] %s", blockIdx, readBlockSize, off, m_io.Path()); + clLog()->Info(XrdCl::AppMsg, "IOFileBlock::Read() block[%d] read-block-size[%d], offset[%lld] %s", blockIdx, readBlockSize, off, m_io->Path()); long long min = blockIdx*m_blocksize; if ( off < min) { assert(0); } assert(off+readBlockSize <= (min + m_blocksize)); int retvalBlock = fb->Read(buff, off, readBlockSize); - clLog()->Debug(XrdCl::AppMsg, "IOFileBlock::Read() Block read returned %d %s", retvalBlock , m_io.Path()); + clLog()->Debug(XrdCl::AppMsg, "IOFileBlock::Read() Block read returned %d %s", retvalBlock , m_io->Path()); if (retvalBlock == readBlockSize ) { bytes_read += retvalBlock; @@ -196,12 +196,12 @@ int IOFileBlock::Read (char *buff, long long off, int size) off += retvalBlock; } else if (retvalBlock > 0) { - clLog()->Warning(XrdCl::AppMsg, "IOFileBlock::Read() incomplete read, missing bytes %d %s", readBlockSize-retvalBlock, m_io.Path()); + clLog()->Warning(XrdCl::AppMsg, "IOFileBlock::Read() incomplete read, missing bytes %d %s", readBlockSize-retvalBlock, m_io->Path()); return bytes_read + retvalBlock; } else { - clLog()->Error(XrdCl::AppMsg, "IOFileBlock::Read() read error, retval %d %s", retvalBlock, m_io.Path()); + clLog()->Error(XrdCl::AppMsg, "IOFileBlock::Read() read error, retval %d %s", retvalBlock, m_io->Path()); return retvalBlock; } } diff --git a/src/XrdFileCache/XrdFileCacheIOFileBlock.hh b/src/XrdFileCache/XrdFileCacheIOFileBlock.hh index 8fb43736bbe..b6820ebff49 100644 --- a/src/XrdFileCache/XrdFileCacheIOFileBlock.hh +++ b/src/XrdFileCache/XrdFileCacheIOFileBlock.hh @@ -41,7 +41,7 @@ namespace XrdFileCache //------------------------------------------------------------------------ //! Constructor. //------------------------------------------------------------------------ - IOFileBlock(XrdOucCacheIO2 &io, XrdOucCacheStats &stats, Cache &cache); + IOFileBlock(XrdOucCacheIO2 *io, XrdOucCacheStats &stats, Cache &cache); //------------------------------------------------------------------------ //! Destructor. @@ -66,11 +66,11 @@ namespace XrdFileCache private: long long m_blocksize; //!< size of file-block - std::map m_blocks; //!< map of created blocks + std::map m_blocks; //!< map of created blocks XrdSysMutex m_mutex; //!< map mutex void GetBlockSizeFromPath(); - File* newBlockFile(long long off, int blocksize, XrdOucCacheIO2* io); + File* newBlockFile(long long off, int blocksize); }; } diff --git a/src/XrdFileCache/XrdFileCacheVRead.cc b/src/XrdFileCache/XrdFileCacheVRead.cc index 5e8103cc561..0c3e5f289dd 100644 --- a/src/XrdFileCache/XrdFileCacheVRead.cc +++ b/src/XrdFileCache/XrdFileCacheVRead.cc @@ -88,7 +88,7 @@ int File::ReadV (const XrdOucIOVec *readV, int n) direct_handler = new DirectResponseHandler(1); // TODO check interface in the client file // m_input.VectorRead(chunkVec, (void*) 0, direct_handler); - m_input.ReadV(*direct_handler, &chunkVec[0], chunkVec.size()); + m_input->ReadV(*direct_handler, &chunkVec[0], chunkVec.size()); } }