From 5b93745be362146fa5fb76e3d58a3f9588b81240 Mon Sep 17 00:00:00 2001 From: Matevz Tadel Date: Mon, 19 Sep 2016 13:29:05 -0700 Subject: [PATCH] Set errno to be positive (stored as negative in respnse handlers). Add info printout in File::ioActive(). --- src/XrdFileCache/XrdFileCacheFile.cc | 22 +++++++++++----------- src/XrdFileCache/XrdFileCacheFile.hh | 2 +- src/XrdFileCache/XrdFileCacheVRead.cc | 4 ++-- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/XrdFileCache/XrdFileCacheFile.cc b/src/XrdFileCache/XrdFileCacheFile.cc index 1160109dd96..b4ceeb08456 100644 --- a/src/XrdFileCache/XrdFileCacheFile.cc +++ b/src/XrdFileCache/XrdFileCacheFile.cc @@ -143,8 +143,7 @@ bool File::ioActive() { // Retruns true if delay is needed - TRACEF(Debug, "File::Initiate close start"); - + TRACEF(Debug, "File::ioActive start"); // remove failed blocks and check if map is empty m_downloadCond.Lock(); @@ -155,14 +154,15 @@ bool File::ioActive() cache()->DeRegisterPrefetchFile(this); } - /* - // high debug print - for (BlockMap_i it = m_block_map.begin(); it != m_block_map.end(); ++it) { - Block* b = it->second; - TRACEF(Dump, "File::InitiateClose() block idx = " << b->m_offset/m_cfi.GetBufferSize() << " prefetch = " << b->preferch << " refcnt " << b->refcnt); - } - */ + // High debug print + // for (BlockMap_i it = m_block_map.begin(); it != m_block_map.end(); ++it) + // { + // Block* b = it->second; + // TRACEF(Dump, "File::ioActive block idx = " << b->m_offset/m_cfi.GetBufferSize() << " prefetch = " << b->prefetch << " refcnt " << b->refcnt); + // } + TRACEF(Info, "ioActive block_map.size() = " << m_block_map.size()); + BlockMap_i itr = m_block_map.begin(); while (itr != m_block_map.end()) { @@ -625,7 +625,7 @@ int File::Read(char* iUserBuff, long long iUserOff, int iUserSize) else // it has failed ... krap up. { bytes_read = -1; - errno = (*bi)->m_errno; + errno = - (*bi)->m_errno; TRACEF(Error, "File::Read(), block "<< (*bi)->m_offset/BS << " finished with error " << errno << " " << strerror(errno)); break; @@ -655,7 +655,7 @@ int File::Read(char* iUserBuff, long long iUserOff, int iUserSize) } else { - errno = direct_handler->m_errno; + errno = - direct_handler->m_errno; bytes_read = -1; } diff --git a/src/XrdFileCache/XrdFileCacheFile.hh b/src/XrdFileCache/XrdFileCacheFile.hh index a5745d0aab1..b7084c1ea0a 100644 --- a/src/XrdFileCache/XrdFileCacheFile.hh +++ b/src/XrdFileCache/XrdFileCacheFile.hh @@ -63,7 +63,7 @@ namespace XrdFileCache File *m_file; bool m_prefetch; int m_refcnt; - int m_errno; + int m_errno; // stores negative errno bool m_downloaded; Block(File *f, long long off, int size, bool m_prefetch) : diff --git a/src/XrdFileCache/XrdFileCacheVRead.cc b/src/XrdFileCache/XrdFileCacheVRead.cc index 2ab5d7567df..776ec36805e 100644 --- a/src/XrdFileCache/XrdFileCacheVRead.cc +++ b/src/XrdFileCache/XrdFileCacheVRead.cc @@ -160,7 +160,7 @@ int File::ReadV(const XrdOucIOVec *readV, int n) } else { - errno = direct_handler->m_errno; + errno = - direct_handler->m_errno; bytesRead = -1; } } @@ -366,7 +366,7 @@ int File::VReadProcessBlocks(const XrdOucIOVec *readV, int n, else { bytes_read = -1; - errno = bi->block->m_errno; + errno = - bi->block->m_errno; break; }