Skip to content

Commit

Permalink
Implement review suggestions by @amadio.
Browse files Browse the repository at this point in the history
  • Loading branch information
osschar committed Nov 20, 2024
1 parent c609ebc commit 6f6736b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
5 changes: 5 additions & 0 deletions src/XrdPfc/XrdPfcConfiguration.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@

#include <fcntl.h>

namespace XrdPfc
{
const char *trace_what_strings[] = {"","error ","warning ","info ","debug ","dump "};
}

using namespace XrdPfc;

XrdVERSIONINFO(XrdOucGetCache, XrdPfc);
Expand Down
2 changes: 1 addition & 1 deletion src/XrdPfc/XrdPfcIO.hh
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ private:

void SetInput(XrdOucCacheIO*);

protected:
// Variables used by File to store IO-relates state. Managed under
// File::m_state_cond mutex.
friend class File;
Expand All @@ -87,6 +86,7 @@ protected:
bool m_allow_prefetching {true};
bool m_in_detach {false};

protected:
int m_incomplete_count {0};
std::map<int, int> m_error_counts;
bool register_incomplete_read() {
Expand Down
2 changes: 0 additions & 2 deletions src/XrdPfc/XrdPfcIOFile.cc
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ void IOFile::DetachFinalize()
m_file->RequestSyncOfDetachStats();
Cache::GetInstance().ReleaseFile(m_file, this);

#ifndef NODEBUG
if (( ! m_error_counts.empty() || m_incomplete_count > 0) && XRD_TRACE What >= TRACE_Error) {
char info[1024];
int pos = 0, cap = 1024;
Expand All @@ -175,7 +174,6 @@ void IOFile::DetachFinalize()
TRACE(Error, "DetachFinalize() " << this << " n_incomplete_reads=" << m_incomplete_count
<< ", block (error : count) report:" << info << (truncated ? " - truncated" : ""));
}
#endif

delete this;
}
Expand Down
11 changes: 7 additions & 4 deletions src/XrdPfc/XrdPfcTrace.hh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@
#define XRD_TRACE GetTrace()->
#endif

namespace XrdPfc
{
extern const char *trace_what_strings[];
}

#define ERRNO_AND_ERRSTR(err_code) ", err_code=" << err_code << ", err_str=" << XrdSysE2T(err_code)

#define TRACE(act, x) \
Expand All @@ -46,8 +51,7 @@

#define TRACE_INT(act, x) \
if (XRD_TRACE What >= act) \
{static const char* t_what[]={"","error ","warning ","info ","debug ","dump "};\
SYSTRACE(XRD_TRACE, 0, m_traceID, 0, t_what[act] << x)}
SYSTRACE(XRD_TRACE, 0, m_traceID, 0, trace_what_strings[act] << x)

#define TRACE_TEST(act, x) \
SYSTRACE(XRD_TRACE, 0, m_traceID, 0, TRACE_STR_ ## act << x)
Expand All @@ -66,8 +70,7 @@

#define TRACEF_INT(act, x) \
if (XRD_TRACE What >= act) \
{static const char* t_what[]={"","error ","warning ","info ","debug ","dump "};\
SYSTRACE(XRD_TRACE, 0, m_traceID, 0, t_what[act] << x << " " << GetLocalPath())}
SYSTRACE(XRD_TRACE, 0, m_traceID, 0, trace_what_strings[act] << x << " " << GetLocalPath())

#else

Expand Down

0 comments on commit 6f6736b

Please sign in to comment.