XRootD
XrdPfc::DataFsState Struct Reference

#include <XrdPfcDirState.hh>

+ Inheritance diagram for XrdPfc::DataFsState:
+ Collaboration diagram for XrdPfc::DataFsState:

Public Member Functions

 DataFsState ()
 
void dump_recursively (int max_depth) const
 
DirState * find_dirstate_for_lfn (const std::string &lfn, DirState **last_existing_dir=nullptr)
 
DirState * get_root ()
 
void init_stat_reset_times (time_t t)
 
long long reap_empty_leaf_dirs (unlink_func unlink_foo)
 
void reset_sshot_stats (time_t last_update)
 
void update_stats_and_usages (time_t last_update, bool collect_reap_candidates)
 

Public Attributes

std::vector< DirState * > m_reap_candidates
 
DirState m_root
 
time_t m_sshot_stats_reset_time = 0
 
long long m_st_blocks_fuzz = 0
 
time_t m_stats_reset_time = 0
 
- Public Attributes inherited from XrdPfc::DataFsStateBase
long long m_disk_total = 0
 
long long m_disk_used = 0
 
long long m_file_usage = 0
 
long long m_meta_total = 0
 
long long m_meta_used = 0
 
time_t m_usage_update_time = 0
 

Detailed Description

Definition at line 145 of file XrdPfcDirState.hh.

Constructor & Destructor Documentation

◆ DataFsState()

XrdPfc::DataFsState::DataFsState ( )
inline

Definition at line 155 of file XrdPfcDirState.hh.

155 : m_root() {}

Member Function Documentation

◆ dump_recursively()

void DataFsState::dump_recursively ( int  max_depth) const

Definition at line 314 of file XrdPfcDirState.cc.

315 {
316  if (max_depth < 0)
317  max_depth = 4096;
318 
319  printf("DataFsState::dump_recursively delta_t = %lld, max_dump_depth = %d\n",
320  (long long)(m_usage_update_time - m_sshot_stats_reset_time), max_depth);
321 
322  m_root.dump_recursively("root", max_depth);
323 }
void dump_recursively(const char *name, int max_depth) const

References XrdPfc::DirState::dump_recursively(), m_root, m_sshot_stats_reset_time, and XrdPfc::DataFsStateBase::m_usage_update_time.

Referenced by XrdPfc::ResourceMonitor::heart_beat().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ find_dirstate_for_lfn()

DirState* XrdPfc::DataFsState::find_dirstate_for_lfn ( const std::string &  lfn,
DirState **  last_existing_dir = nullptr 
)
inline

Definition at line 161 of file XrdPfcDirState.hh.

162  {
163  return m_root.find_path(lfn, -1, true, true, last_existing_dir);
164  }
DirState * find_path(const std::string &path, int max_depth, bool parse_as_lfn, bool create_subdirs, DirState **last_existing_dir=nullptr)

References XrdPfc::DirState::find_path(), and m_root.

Referenced by XrdPfc::ResourceMonitor::process_queues().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_root()

DirState* XrdPfc::DataFsState::get_root ( )
inline

Definition at line 159 of file XrdPfcDirState.hh.

159 { return & m_root; }

References m_root.

Referenced by XrdPfc::ResourceMonitor::heart_beat(), XrdPfc::ResourceMonitor::perform_initial_scan(), XrdPfc::ResourceMonitor::perform_purge_check(), and XrdPfc::ResourceMonitor::process_queues().

+ Here is the caller graph for this function:

◆ init_stat_reset_times()

void XrdPfc::DataFsState::init_stat_reset_times ( time_t  t)
inline

Definition at line 157 of file XrdPfcDirState.hh.

References m_sshot_stats_reset_time, and m_stats_reset_time.

Referenced by XrdPfc::ResourceMonitor::main_thread_function().

+ Here is the caller graph for this function:

◆ reap_empty_leaf_dirs()

long long DataFsState::reap_empty_leaf_dirs ( unlink_func  unlink_foo)

Remove the empty leaves collected at the last snapshot, which reported them once more, empty. The root is never a candidate, and a parent waits for the next snapshot. Returns the leftover st_blocks taken out of the tree.

Definition at line 276 of file XrdPfcDirState.cc.

277 {
278  long long total_residue = 0;
279  for (DirState *ds : m_reap_candidates)
280  {
281  // A pending close points at a DirState while m_NFilesOpen > 0.
282  if ( ! ds->is_empty_leaf())
283  continue;
284 
285  std::string dir_path;
286  dir_path.reserve(1024);
287  ds->generate_dir_path(dir_path);
288  if (unlink_foo(dir_path) != 0)
289  continue;
290 
291  // Return a leftover st_blocks through the recursive stats, where the ancestors
292  // counted it, rather than lose it with the node. Keep the correction, and the
293  // node's own fuzz, as the parent's.
294  DirState *parent = ds->m_parent;
295  long long residue = ds->m_here_usage.m_StBlocks + ds->m_recursive_subdir_usage.m_StBlocks;
296  parent->m_recursive_subdir_stats.m_StBlocksRemoved += residue;
297  parent->m_StBlocksFuzz += std::llabs(residue) + ds->m_StBlocksFuzz;
298  m_st_blocks_fuzz += std::llabs(residue);
299  total_residue += residue;
300 
301  ++parent->m_here_stats.m_NDirectoriesRemoved;
302  parent->m_subdirs.erase(parent->m_subdirs.find(ds->m_dir_name));
303  }
304  m_reap_candidates.clear();
305  return total_residue;
306 }
static void parent()
std::vector< DirState * > m_reap_candidates

References m_reap_candidates, m_st_blocks_fuzz, and parent().

Referenced by XrdPfc::ResourceMonitor::heart_beat().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reset_sshot_stats()

void DataFsState::reset_sshot_stats ( time_t  last_update)

Definition at line 308 of file XrdPfcDirState.cc.

309 {
311  m_sshot_stats_reset_time = last_update;
312 }

References m_root, m_sshot_stats_reset_time, and XrdPfc::DirState::reset_sshot_stats().

Referenced by XrdPfc::ResourceMonitor::heart_beat().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update_stats_and_usages()

void DataFsState::update_stats_and_usages ( time_t  last_update,
bool  collect_reap_candidates 
)

Definition at line 260 of file XrdPfcDirState.cc.

261 {
262  if (collect_reap_candidates)
263  m_reap_candidates.clear();
264  m_root.update_stats_and_usages(collect_reap_candidates ? &m_reap_candidates : nullptr);
267  m_usage_update_time = last_update;
268  m_stats_reset_time = last_update;
269 }
DirStats m_recursive_subdir_stats
void update_stats_and_usages(std::vector< DirState * > *reap_candidates=nullptr)

References XrdPfc::DirState::m_here_stats, m_reap_candidates, XrdPfc::DirState::m_recursive_subdir_stats, m_root, m_stats_reset_time, XrdPfc::DataFsStateBase::m_usage_update_time, XrdPfc::DirStats::Reset(), and XrdPfc::DirState::update_stats_and_usages().

Referenced by XrdPfc::ResourceMonitor::heart_beat().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_reap_candidates

std::vector<DirState*> XrdPfc::DataFsState::m_reap_candidates

◆ m_root

DirState XrdPfc::DataFsState::m_root

◆ m_sshot_stats_reset_time

time_t XrdPfc::DataFsState::m_sshot_stats_reset_time = 0

◆ m_st_blocks_fuzz

long long XrdPfc::DataFsState::m_st_blocks_fuzz = 0

Definition at line 151 of file XrdPfcDirState.hh.

Referenced by XrdPfc::ResourceMonitor::heart_beat(), and reap_empty_leaf_dirs().

◆ m_stats_reset_time

time_t XrdPfc::DataFsState::m_stats_reset_time = 0

Definition at line 148 of file XrdPfcDirState.hh.

Referenced by init_stat_reset_times(), and update_stats_and_usages().


The documentation for this struct was generated from the following files: