Public Member Functions | Public Attributes

hsm_DirWaitList Class Reference
[Classes for managing object list]

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

#include <hsm_DirWaitList.h>

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

List of all members.

Public Member Functions

 hsm_DirWaitList (bool &a_running, ivd_Time32_t a_waitTime)
virtual ~hsm_DirWaitList ()
virtual void TaskTime ()
 implementetion of removing directories from sistem
void DumpStatus (ostringstream &sstr)

Public Attributes

 log_CLASSID_m

Detailed Description

hsm_DirWaitList class manages files which are "Dirty".

Definition at line 48 of file hsm_DirWaitList.h.


Constructor & Destructor Documentation

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

Definition at line 60 of file hsm_DirWaitList.cpp.

References log_FUNC_m.

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

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

Definition at line 55 of file hsm_DirWaitList.h.

{};


Member Function Documentation

void hsm_DirWaitList::DumpStatus ( ostringstream &  sstr  ) 

Definition at line 130 of file hsm_DirWaitList.cpp.

References size.

Referenced by i_HSM_i::ShowStatus().

                                                    {
    sstr << "Number of directories in DirWaitList :  " << size() << endl;
}

Here is the caller graph for this function:

void hsm_DirWaitList::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.

proceed one quoter more than policy ask

Implements hsm_TimedList.

Definition at line 76 of file hsm_DirWaitList.cpp.

References hsm_FileHeader::CleanDirListPos(), dbg_DETAIL, dbg_NORM, g_hsm_FHCache_p, 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, hsm_TimedList::Remove(), hsm_FHcache::RemoveLastButOne(), size, hsm_TimedList::SpliceToEndNoLock(), and cmn_Mutex::Unlock().

                                   {
    log_FUNC_m(TaskTime);

    log_DBG_m(dbg_DETAIL, "Start removing not used directories from memory.");

    m_timedList_x.Lock();
    hsm_FHtimed_li iter;
    while ((iter = begin()) != end()) {
        if (m_goDown) {
            log_DBG_m (dbg_NORM, "Shut down. Abort Directory List."); 
            break;
        }
        if ((*iter).m_wakeUpTime <= time(NULL) + m_quaterTime) {
            hsm_FileHeader &fh = *(*iter).m_fh_p;
            if (&fh == NULL) {
                m_timedList_x.Unlock();
                throw ivd_InternalError(ie_NULLPTR, "unused dir list contain NULL pointer.", true);
            }
            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) );
                SpliceToEndNoLock(iter);
                if (size() == 1) { // if only one element is in list then stop
                   break;
                }
                continue;  // can't use this FH already locked, so skip it
            }
            // now FH is locked, so list can be unlock
            m_timedList_x.Unlock();
            
            log_DBG_m(dbg_DETAIL, "Directory is going to remove. INO " 
                                    << IVD_PRINT_ID_FS(inode));
            if (g_hsm_FHCache_p->RemoveLastButOne(&fh)) { // must be last but one reference 
                Remove(iter);
                g_hsm_fhLock.UnLockByID(inode);
            }
            else {
                log_DBG_m(dbg_DETAIL, "Directory is not removed from cache. INO " 
                                    << IVD_PRINT_ID_FS(inode));
                Remove(iter);
                fh.CleanDirListPos();
                g_hsm_fhLock.UnLockByID(inode);
            }
        }
        else {
            break; // next directoryes are to young
        }
        m_timedList_x.Lock();
    }
    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_DirWaitList.h.


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