Skip to content

Commit

Permalink
Merge pull request #380 from osschar/pssasync-mt-2
Browse files Browse the repository at this point in the history
XrdPfc: Print data server in info trace
  • Loading branch information
abh3 committed Jun 17, 2016
2 parents 439ec0c + 1705806 commit 72605c1
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 12 deletions.
4 changes: 3 additions & 1 deletion src/XrdFileCache/XrdFileCache.cc
Expand Up @@ -155,7 +155,9 @@ XrdOucCacheIO2 *Cache::Attach(XrdOucCacheIO2 *io, int Options)
else
cio = new IOEntireFile(io, m_stats, *this);

TRACE(Info, "Cache::Attach() " << io->Path());
TRACE_PC(Info, const char* loc = io->Location(),
"Cache::Attach() " << io->Path() << " location: " <<
((loc && loc[0] != 0) ? loc : "<deferred open>"));
return cio;
}
else
Expand Down
12 changes: 6 additions & 6 deletions src/XrdFileCache/XrdFileCacheIO.cc
@@ -1,5 +1,5 @@
#include "XrdFileCacheIO.hh"
#include "XrdSys/XrdSysAtomics.hh"
#include "XrdFileCacheTrace.hh"
#include "XrdPosix/XrdPosixFile.hh"

using namespace XrdFileCache;
Expand All @@ -13,19 +13,19 @@ m_statsGlobal(stats), m_cache(cache), m_traceID("IO"), m_io(io)
void IO::Update(XrdOucCacheIO2 &iocp)
{
SetInput(&iocp);
TRACE_PC(Info, const char* loc = Location(),
"IO::Update() " << Path() << " location: " <<
((loc && loc[0] != 0) ? loc : "<not set>"));
}


void IO::SetInput(XrdOucCacheIO2* x)
{
updMutex.Lock();
XrdSysMutexHelper lock(&updMutex);
m_io = x;
updMutex.UnLock();
}

XrdOucCacheIO2* IO::GetInput()
{
AtomicBeg(updMutex);
XrdSysMutexHelper lock(&updMutex);
return m_io;
AtomicEnd(updMutex);
}
2 changes: 1 addition & 1 deletion src/XrdFileCache/XrdFileCacheIO.hh
Expand Up @@ -52,7 +52,7 @@ namespace XrdFileCache

private:
XrdOucCacheIO2 *m_io; //!< original data source
XrdSysRecMutex updMutex;
XrdSysMutex updMutex;
void SetInput(XrdOucCacheIO2*);
};
}
Expand Down
11 changes: 8 additions & 3 deletions src/XrdFileCache/XrdFileCacheTrace.hh
Expand Up @@ -31,6 +31,10 @@
if (XRD_TRACE What >= TRACE_ ## act) \
{XRD_TRACE Beg(m_traceID); cerr << TRACE_STR_##act <<x; XRD_TRACE End();}

#define TRACE_PC(act, pre_code, x) \
if (XRD_TRACE What >= TRACE_ ## act) \
{pre_code; XRD_TRACE Beg(m_traceID); cerr << TRACE_STR_##act <<x; XRD_TRACE End();}

#define TRACEIO(act, x) \
if (XRD_TRACE What >= TRACE_ ## act) \
{XRD_TRACE Beg(m_traceID); cerr << TRACE_STR_##act <<x << " " << GetPath(); XRD_TRACE End();}
Expand All @@ -39,12 +43,13 @@
if (XRD_TRACE What >= TRACE_ ## act) \
{XRD_TRACE Beg(m_traceID); cerr << TRACE_STR_##act << x << " " << GetLocalPath(); XRD_TRACE End();}




#else

#define TRACE(act,x)
#define TRACE_PC(act, pre_code, x)
#define TRACEIO(act, x)
#define TRACEF(act, x)

#endif

#endif
2 changes: 1 addition & 1 deletion src/XrdPosix/XrdPosixPrepIO.cc
Expand Up @@ -95,6 +95,6 @@ bool XrdPosixPrepIO::Init(XrdOucCacheIOCB *iocbP)

// Inform the cache that we have now have a new I/O object
//
fileP->XCio->Update((XrdOucCacheIO2 &)*fileP);
fileP->XCio->Update(*fileP);
return true;
}

0 comments on commit 72605c1

Please sign in to comment.