From ff6f3d476c5201360a47bbeb8f3c099505f403cd Mon Sep 17 00:00:00 2001 From: Alja Mrak-Tadel Date: Wed, 26 Oct 2016 16:09:37 -0700 Subject: [PATCH] Fixes in prefetch statistics. --- src/XrdFileCache/XrdFileCacheFile.cc | 6 +++++- src/XrdFileCache/XrdFileCacheInfo.hh | 8 +++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/XrdFileCache/XrdFileCacheFile.cc b/src/XrdFileCache/XrdFileCacheFile.cc index ecfb941969e..532a670f10a 100644 --- a/src/XrdFileCache/XrdFileCacheFile.cc +++ b/src/XrdFileCache/XrdFileCacheFile.cc @@ -757,6 +757,10 @@ void File::WriteBlockToDisk(Block* b) XrdSysCondVarHelper _lck(m_downloadCond); m_cfi.SetBitWritten(pfIdx); + + if (b->m_prefetch) + m_cfi.SetBitPrefetch(); + // clLog()->Dump(XrdCl::AppMsg, "File::WriteToDisk() dec_ref_count %d %s", pfIdx, lPath()); dec_ref_count(b); @@ -999,4 +1003,4 @@ void DirectResponseHandler::Done(int res) { m_cond.Signal(); } -} \ No newline at end of file +} diff --git a/src/XrdFileCache/XrdFileCacheInfo.hh b/src/XrdFileCache/XrdFileCacheInfo.hh index 4f3fc138216..bda5a892a0b 100644 --- a/src/XrdFileCache/XrdFileCacheInfo.hh +++ b/src/XrdFileCache/XrdFileCacheInfo.hh @@ -261,14 +261,16 @@ inline bool Info::TestBit(int i) const return (m_buff_written[cn] & cfiBIT(off)) == cfiBIT(off); } -// AMT could have only one function to test bit and pass an argument, but would loose clarity + inline bool Info::TestPrefetchBit(int i) const { + if (m_buff_prefetch) return false; + const int cn = i/8; assert(cn < GetSizeInBytes()); const int off = i - cn*8; - return (m_buff_written[cn] & cfiBIT(off)) == cfiBIT(off); + return (m_buff_prefetch[cn] & cfiBIT(off)) == cfiBIT(off); } inline int Info::GetNDownloadedBlocks() const @@ -361,4 +363,4 @@ inline long long Info::GetBufferSize() const // XrdFileCacheInfoBlock //---------------------------------------------------------------- } -#endif \ No newline at end of file +#endif