#include <hsm_FHdirty.h>


Definition at line 34 of file hsm_FHdirty.h.
Public Member Functions | |
| hsm_FHdirty (bool &a_running, ivd_Time32_t a_waitTime) | |
| virtual | ~hsm_FHdirty () |
| virtual void | TaskTime () |
| implementetion of removing directories from sistem | |
| void | Reconfigure (ivd_Time32_t a_CfgMFAge) |
| void | DumpStatus (ostringstream &sstr) |
| void | DumpList (ostringstream &sstr) |
Public Attributes | |
| log_CLASSID_m | |
| hsm_FHdirty::hsm_FHdirty | ( | bool & | a_running, | |
| ivd_Time32_t | a_waitTime | |||
| ) |
Definition at line 45 of file hsm_FHdirty.cpp.
References log_FUNC_m.
00048 : 00049 hsm_TimedList(a_running, 00050 a_waitTime) 00051 { 00052 log_FUNC_m(hsm_FHdirty); 00053 } //============================================================================//
| virtual hsm_FHdirty::~hsm_FHdirty | ( | ) | [inline, virtual] |
| void hsm_FHdirty::TaskTime | ( | void | ) | [virtual] |
implementetion of removing directories from sistem
Dirty list manager check if exist eny candidate to move to Migration candidate list It is started by thread and is checking Dirty list at some time interval.
Implements hsm_TimedList.
Definition at line 61 of file hsm_FHdirty.cpp.
References dbg_DETAIL, dbg_NORM, hsm_FileHeader::DirtyToMigCnd(), g_hsm_fhLock, hsm_FileHeader::GetInode(), ie_NULLPTR, IVD_PRINT_ID_FS, cmn_Mutex::Lock(), log_DBG_m, log_FUNC_m, hsm_TimedList::m_goDown, hsm_TimedList::m_quaterTime, hsm_TimedList::m_timedList_x, NULL, size, cmn_Time::Time2hms(), cmn_Mutex::Unlock(), and hsm_TimedList::WakeUpTime().
00061 { 00062 log_FUNC_m(TaskTime); 00063 m_timedList_x.Lock(); 00064 hsm_FHtimed_li iter = begin(); 00065 00066 while (iter != end()) { 00067 if (m_goDown) { 00068 log_DBG_m (dbg_NORM, "Shut down. Abort Dirty List."); 00069 break; 00070 } 00071 hsm_FileHeader &fh = *(*iter).m_fh_p; 00072 if (&fh == NULL) { 00073 m_timedList_x.Unlock(); 00074 throw ivd_InternalError(ie_NULLPTR, "Dirty list contain NULL pointer.", true); 00075 } 00076 00077 log_DBG_m(dbg_DETAIL, "try to move FH to mig cand. list."); 00078 // try to lock FH by inode 00079 ivd_GenInode_t inode = fh.GetInode(); 00080 if (!g_hsm_fhLock.CanLockByID(inode)) { 00081 log_DBG_m(dbg_DETAIL, "FH is locked. Skip it. INO " << IVD_PRINT_ID_FS(inode )); 00082 if (size() == 1) { // if only one element is in list and is locked 00083 // reset its wait time for another minfileAge 00084 (*iter).m_wakeUpTime = WakeUpTime(); 00085 } 00086 iter++; 00087 continue; // can't use this FH already locked, so skip it 00088 } 00089 // now FH is locked, so list can be unlock 00090 m_timedList_x.Unlock(); 00091 00092 ivd_Time32_t currentTime = time(NULL); 00093 // procees little more to be more efficient 00094 if ((*iter).m_wakeUpTime <= currentTime + m_quaterTime) { 00095 cmn_Time wakuptime((*iter).m_wakeUpTime); 00096 cmn_Time currT(currentTime); 00097 log_DBG_m(dbg_DETAIL, "Move to migcand. WakeUpTime " << wakuptime.Time2hms() 00098 << " current time " << currT.Time2hms() 00099 << " quoter wait time " << m_quaterTime ); 00100 fh.DirtyToMigCnd(); 00101 g_hsm_fhLock.UnLockByID(inode); 00102 } 00103 else { 00104 g_hsm_fhLock.UnLockByID(inode); 00105 return; 00106 } 00107 m_timedList_x.Lock(); 00108 iter = begin(); 00109 } 00110 m_timedList_x.Unlock(); 00111 }

| void hsm_FHdirty::Reconfigure | ( | ivd_Time32_t | a_CfgMFAge | ) | [inline] |
Reimplemented from hsm_TimedList.
Definition at line 52 of file hsm_FHdirty.h.
References hsm_TimedList::Reconfigure().
Referenced by i_HSM_i::Reconfigure().
00052 { hsm_TimedList::Reconfigure(a_CfgMFAge);};


| void hsm_FHdirty::DumpStatus | ( | ostringstream & | sstr | ) |
Definition at line 114 of file hsm_FHdirty.cpp.
References hsm_TimedList::m_waitTime, and cmn_Time::Time2hms().
Referenced by i_HSM_i::ShowStatus().
00114 { 00115 cmn_Time minFileAge(m_waitTime, 0, true); 00116 sstr << "Cfg: min file age " << minFileAge.Time2hms() << endl; 00117 }


| void hsm_FHdirty::DumpList | ( | ostringstream & | sstr | ) |
Definition at line 120 of file hsm_FHdirty.cpp.
References hsm_FileHeader::DumpListEl(), FSC_MAX_CORBA_BUFFERSIZE, hsm_TimedList::m_goDown, hsm_TimedList::m_timedList_x, NULL, and size.
Referenced by i_HSM_i::ShowStatus().
00120 { 00121 cmn_MutexLock l(m_timedList_x); 00122 00123 sstr << endl << "DIRTY List Contents" << endl; 00124 sstr << "ChgFlg FileID Inode Name... Old name" << endl; 00125 sstr << "------------------------------------------------------------" << endl; 00126 hsm_FHtimed_li iter = begin(); 00127 for (;iter != end(); ++iter) { 00128 if (m_goDown) { 00129 sstr << "Shut down. Abort Dirty List." << endl; 00130 break; 00131 } 00132 hsm_FileHeader &fh = *(*iter).m_fh_p; 00133 if (&fh == NULL) { 00134 sstr << "NULL pointer found." << endl; 00135 break; 00136 } 00137 fh.DumpListEl(sstr); 00138 if (sstr.str().size() > FSC_MAX_CORBA_BUFFERSIZE) { 00139 sstr << "Stop dumping. Too much elements " << size() 00140 << ". Buff size " << sstr.str().size() << endl; 00141 break; 00142 } 00143 } 00144 sstr << "Total files " << size() << endl; 00145 }


1.5.6