Public Member Functions | Public Attributes

hsm_FHdirty Class Reference
[Classes for managing object list]

hsm_FHdirty class manages files which are "Dirty". More...

#include <hsm_FHdirty.h>

Inheritance diagram for hsm_FHdirty:
Inheritance graph
[legend]
Collaboration diagram for hsm_FHdirty:
Collaboration graph
[legend]

List of all members.

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

Detailed Description

hsm_FHdirty class manages files which are "Dirty".

Definition at line 48 of file hsm_FHdirty.h.


Constructor & Destructor Documentation

hsm_FHdirty::hsm_FHdirty ( bool &  a_running,
ivd_Time32_t  a_waitTime 
)

Definition at line 59 of file hsm_FHdirty.cpp.

References log_FUNC_m.

    :
    hsm_TimedList(a_running,
                  a_waitTime)
{
    log_FUNC_m(hsm_FHdirty);
}

virtual hsm_FHdirty::~hsm_FHdirty (  )  [inline, virtual]

Definition at line 55 of file hsm_FHdirty.h.

{};


Member Function Documentation

void hsm_FHdirty::DumpList ( ostringstream &  sstr  ) 

Definition at line 134 of file hsm_FHdirty.cpp.

References hsm_FileHeader::DumpListEl(), hsm_TimedList::m_goDown, hsm_TimedList::m_timedList_x, NULL, and size.

Referenced by i_HSM_i::ShowStatus().

                                              {
    cmn_MutexLock l(m_timedList_x);
    
    sstr << endl << "DIRTY List Contents" << endl;
    sstr << "ChgFlg     FileID               Inode   Name... Old name" << endl;
    sstr << "------------------------------------------------------------" << endl;
    hsm_FHtimed_li iter = begin();
    for (;iter != end(); ++iter) {
        if (m_goDown) {
            sstr << "Shut down. Abort Dirty List." << endl;
            break;
        }
        hsm_FileHeader &fh = *(*iter).m_fh_p;
        if (&fh == NULL) {
            sstr << "NULL pointer found." << endl;
            break;
        }
        fh.DumpListEl(sstr);    
        if (sstr.str().size() > FSC_MAX_CORBA_BUFFERSIZE) {
            sstr << "Stop dumping. Too much elements " << size() 
                 << ". Buff size " << sstr.str().size() << endl;
            break;
        }
    }
    sstr << "Total files " << size() << endl;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void hsm_FHdirty::DumpStatus ( ostringstream &  sstr  ) 

Definition at line 128 of file hsm_FHdirty.cpp.

References hsm_TimedList::m_waitTime, and cmn_Time::Time2hms().

Referenced by i_HSM_i::ShowStatus().

                                                {
    cmn_Time minFileAge(m_waitTime, 0, true);
    sstr << "Cfg: min file age                       " << minFileAge.Time2hms() << endl;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void hsm_FHdirty::Reconfigure ( ivd_Time32_t  a_CfgMFAge  )  [inline]

Reimplemented from hsm_TimedList.

Definition at line 66 of file hsm_FHdirty.h.

Referenced by i_HSM_i::Reconfigure().

{ hsm_TimedList::Reconfigure(a_CfgMFAge);};

Here is the caller graph for this function:

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 75 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().

                               {
    log_FUNC_m(TaskTime);
    m_timedList_x.Lock();
    hsm_FHtimed_li iter = begin();
    
    while (iter != end()) {
        if (m_goDown) {
            log_DBG_m (dbg_NORM, "Shut down. Abort Dirty List."); 
            break;
        }
        hsm_FileHeader &fh = *(*iter).m_fh_p;
        if (&fh == NULL) {
            m_timedList_x.Unlock();
            throw ivd_InternalError(ie_NULLPTR, "Dirty list contain NULL pointer.", true);
        }

        log_DBG_m(dbg_DETAIL, "try to move FH to mig cand. list.");
        //  try to lock FH by inode
        ivd_GenInode_t inode = fh.GetInode();
        if (!g_hsm_fhLock.CanLockByID(inode)) {
            log_DBG_m(dbg_DETAIL, "FH is locked. Skip it. INO " << IVD_PRINT_ID_FS(inode ));
            if (size() == 1) { // if only one element is in list and is locked
                               // reset its wait time for another minfileAge
                (*iter).m_wakeUpTime = WakeUpTime();
            }
            iter++;
            continue;  // can't use this FH already locked, so skip it
        }
        // now FH is locked, so list can be unlock
        m_timedList_x.Unlock();

        ivd_Time32_t currentTime = time(NULL);
        // procees little more to be more efficient
        if ((*iter).m_wakeUpTime <= currentTime + m_quaterTime) {
            cmn_Time wakuptime((*iter).m_wakeUpTime);
            cmn_Time currT(currentTime);
            log_DBG_m(dbg_DETAIL, "Move to migcand. WakeUpTime " <<  wakuptime.Time2hms()
                                << " current time " << currT.Time2hms()
                                << " quoter wait time " << m_quaterTime );
            fh.DirtyToMigCnd();
            g_hsm_fhLock.UnLockByID(inode);
        }
        else {
            g_hsm_fhLock.UnLockByID(inode);
            return;
        }
        m_timedList_x.Lock();
        iter = begin();
    }
    m_timedList_x.Unlock();
}

Here is the call graph for this function:


Member Data Documentation

Reimplemented from hsm_TimedList.

Definition at line 55 of file hsm_FHdirty.h.


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