Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | Static Private Attributes | Friends

hsm_FileHeader Class Reference
[Classes for managing object list]

hsm_FileHeader class describe header of file. More...

#include <hsm_FileHeader.h>

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

List of all members.

Public Member Functions

 hsm_FileHeader (ivd_FileID_t a_fileID, const string &a_name, const string &a_oldName, hsm_FileHeader *a_hsmFHOwner, hsm_FileHeader *a_hsmOldFHOwner, hsm_InoObj *a_inodeObj)
 Constructor to create File header object from event structure, File header object of file owner, File header object of old file owner, and I-node object.
 hsm_FileHeader (hsm_FileHeader *a_hsmFHOwner, hsm_InoObj *a_inodeObj, hdb_String a_fName)
 Constructor to create File header object.
 hsm_FileHeader (ivd_RecordIDX_t a_activeIdx, hdb_Active_t &a_activeRec, bool a_trigMig=false)
 hsm_FileHeader (hsm_RecallInfoGrp *a_pRI)
 Constructor to create File header object for manual recall.
 hsm_FileHeader ()
 Default constructor.
virtual ~hsm_FileHeader ()
 Destructor.
void SetModifyTimeAtMig (ivd_Time_t a_time)
void InitActive (ivd_RecordIDX_t a_activeIdx, hdb_Active_t &a_activeRec, bool a_trigMig=false)
 InitActiv is used only at startup to construct FH method is called by constructor of FH and directly if FH olready exist in cache NOTE only directory type FH can exist in cache.
void InitFromDB ()
 Read fileID2HSMID record and set some members.
void StoreActiveRec (fio_Transaction &a_trans)
void StoreDirTreeRec (fio_Transaction &a_trans)
void StoreNameOwnRec (fio_Transaction &a_trans)
void StoreOldNameOwnRec (fio_Transaction &a_trans)
void RemoveFromRelCandList (fio_Transaction &a_trans)
void RemoveFromActiveList (fio_Transaction &a_trans)
void RemoveNameFromHSMDB (fio_Transaction &a_trans)
ivd_RecordIDX_t GetOwnersNameOwnIdx ()
ivd_RecordIDX_t GetOwnersOldNameOwnIdx ()
ivd_RecordIDX_t GetNameOwnIdx ()
ivd_RecordIDX_t GetOldNameOwnIdx ()
bool operator== (hsm_FileHeader &a_fh)
 compare if two file headers are organicaly same have equal: name, type, inode
UInt64_t GetInode (void) const
 method to return I-node of File Header object
UInt64_t GetOwnerInode (void) const
UInt64_t GetOldOwnerInode (void) const
ivd_FileID_t GetFileID (void) const
ivd_FileID_t GetOwnFileID (void) const
ivd_FileID_t GetOldOwnFileID (void) const
ivd_FileType_e GetFileType (void) const
UInt32_t GetShortInode () const
ivd_RecordIDX_t GetOwnDirTreeIdx ()
ivd_RecordIDX_t GetDirTreeIdx ()
Int32_t GetRecallJobIdx () const
ivd_RecordIDX_t GetActiveIdx ()
void SetActiveIdx (ivd_RecordIDX_t a_activeIdx)
ivd_FileSize_t GetFileSize (void) const
 Method safely return file size from i-node object (if object IS_NULL return 0).
ivd_FileSize_t GetFileSizeForMig () const
string GetFName (void) const
string GetOldFName (void) const
hsm_InoObjGetInoObj (void) const
hsm_FileHeaderGetFOwner (void) const
hsm_FileHeaderGetOldFOwner (void) const
ivd_FileType_e GetfType () const
UInt32_t GetRef (void) const
 be careful of using GetRef, it's not locked and now is use only in cache and JobComplete that are locked or lock fileID
string GetRecallIntoName (void)
ivd_FS_FileGetRecallFile ()
hsm_RecallInfoGrpGetRecallInfoGrp ()
void SetFileSize (ivd_FileSize_t a_fileSize)
 Method set file data size to i-node object (if object is not NULL set the value otherwise do nothing).
void ResetDataInPacker ()
void SetDataInPacker ()
bool IsDataInPacker ()
ivd_Time32_t GetMigAllowedTime ()
void UnSetInodeChgFlag (hsm_ChgFlag_t a_inodeChgFlag)
void SetInodeChgFlag (hsm_ChgFlag_t a_inodeChgFlag)
void CleanChgFlag ()
hsm_ChgFlag_t GetChgFlag (void) const
void UnSetFHChgFlag (hsm_ChgFlag_t a_fhChgFlag)
void SetFHChgFlag (hsm_ChgFlag_t a_fhChgFlag)
bool IsDeleted ()
bool IsDirty ()
hsm_DataMigStat_e GetDataMigStat ()
void SetDataMigStat (hsm_DataMigStat_e a_stat)
void SetFName (string a_fname)
void SetOldFName (string a_oldFName)
void SetOwnFHObj (hsm_FileHeader *a_FHObj)
void SetOldOwnFHObj (hsm_FileHeader *a_FHObj)
void SendReply (UInt16_t a_reply)
cmn_Path MakePath ()
 return full path with name doesn't matter if name is empty
cmn_Path GetFullPath ()
 return empty path if name not exist
cmn_Path GetOldFullPath ()
 return empty path if old name not exist
void IncMemberRef ()
void DecMemberRef ()
void CleanDirListPos ()
void DecInodeRef ()
void IncrRef ()
 method to increment reference to this object to know how many List records are referenced to it
void DecrRef ()
 method to decrement reference to this object.
void Event (fs_api::Event_e a_eventType, fio_Transaction &trans, cmn_Path *movedFrom=NULL)
void RemoveFromHSM ()
 Remove from HSM in case of syserror see hsm_FHdirty::TaskTime() or hsm_FileHeader::Event() NOTE!!! method doesn't remove FH from permanent release candidate list.
void NameOwnChgGoToDirty ()
void InodeChgGoToDirty ()
void DirtyToMigCnd ()
void ToMigCand ()
void MigCanToPreJob (Int32_t a_preJobIdx)
void MigPreJobToPM (i_JobRequest_t &migElem)
void FileToSeqElem (i_JobRequest_t &migElem)
void MigrationIsDone ()
 this method is called soon after all data is sent to packer
bool AddToReleaseCanList (fio_Transaction &a_trans)
bool CompleteMigIsDone (bool a_succeed, fio_Transaction &a_trans)
void SendToPM (UInt32_t filesNoFID, UInt32_t preJobIdx)
void SetOffline (bool a_offline)
bool GetOffline (void) const
void NewName (const string &a_name)
void NewOwner (hsm_FileHeader *a_owner_p)
void AddToDirTree ()
 when new directory occure in cache call this method.
void EventOffline (ivd_FS_Event &a_event)
bool EventOffline (UInt32_t a_jobIdx, i_Recall_t &a_recallStr, bool a_migrateAfterRecall)
 Add FH to recall job with index a_jobIdx.
ivd_MigrationID_t GetJobMigID ()
void SetDirTreeIdx (ivd_RecordIDX_t a_dirTreeIdx)
void MakeStat (ivd_FileInfo_t &a_fInfo)
 NOTE MekeStat must be used inside try block and catch for catch(ivd_SysError &ise) exception.
void OpenFile (ivd_FS_File &a_file, const ivd_FS_File::ivd_FS_FileOperation_e a_fileOp)
 NOTE use same try catch algorith for OpenFile method as for MakeStat.
void SetFileID (ivd_FileID_t a_fileId)
 check if inode exist and set its fileID and extend atributes
void UpdateFileID (ivd_FileID_t a_fileId)
 check if inode exist and set its fileID DOESN'T set EA
void Recalled (bool a_succeed)
 this method is called after file is extracted from packer, succeed or not.
UInt64_t TruncateFile ()
 open file truncate it and set EA offline
UInt64_t TruncateFile (ivd_FS_File &a_truncFile)
 just truncate file (used also by failed recall)
void DumpListEl (ostringstream &sstr)
void QueueHL7Message (hl7_msgType_e a_msgType)
bool GetGidCidInfo (string &a_gid, string &a_cid, string &a_basePath, string &a_fileName)
 hsm_FileHeader (Event_t &a_event, hsm_FileHeader *a_hsmFHOwner, hsm_FileHeader *a_hsmOldFHOwner, hsm_InoObj *a_inodeObj)
 hsm_FileHeader (hsm_FileHeader *a_hsmFHOwner, hsm_FileHeader *a_hsmOldFHOwner, hsm_InoObj *a_inodeObj, ivd_FileType_e a_fType, string a_fName, string a_fOldName)
 hsm_FileHeader ()
 Default constructor.
virtual ~hsm_FileHeader ()
UInt64_t GetInode (void) const
hsm_List_e GetList (void) const
 Get list where FH is.
ivd_Time32_t GetListIdx (void) const
 Get index on a list (for Dirty and MigCnd list).
ivd_FileSize_t GetFileSize (void) const
ivd_FileID_t GetFileID (void) const
ivd_RecordIDX_t GetRecIdx (void) const
string GetFName (void) const
string GetOldFName (void) const
hsm_InoObjGetInoObj (void) const
hsm_FileHeaderGetFOwner (void) const
UInt64_t GetFOwnerInode (void) const
hsm_FileHeaderGetOldFOwner (void) const
ivd_Time32_t GetChgTime (void) const
ivd_FileType_e GetfType (void) const
UInt16_t GetChnData (void) const
UInt32_t GetRef (void) const
 Return Reference counter of this FH.
void GetValues (UInt64_t &a_inode, string &a_fName, UInt64_t &a_fOwner) const
void GetJob (UInt32_t &a_jobNumber, UInt32_t &a_jobIdx) const
 Get job and job index.
void SetJob (UInt32_t a_jobNumber, UInt32_t a_jobIdx)
 Set job and job index.
void SetList (hsm_List_e a_fList)
void SetListIdx (ivd_Time32_t a_listIdx)
void SetRecIdx (ivd_RecordIDX_t a_idxFH)
void SetFileSize (ivd_FileSize_t a_fileSize)
void SetFileID (ivd_FileID_t a_fileId)
void SetChnData (UInt16_t a_Data)
void SetFName (string a_fname)
void SetOldFName (string a_oldFName)
void SetOwnFHObj (hsm_FileHeader *a_FHObj)
void SetOldOwnFHObj (hsm_FileHeader *a_FHObj)
cmn_Path MakePath (void)
void MakeStat (ivd_FileInfo_t &a_fInfo)
void UpdateChgTime (ivd_Time32_t a_chgTime)
void IncrRef ()
void DecrRef ()
bool IsEqual (const hsm_FileHeader *a_FileHeader) const

Static Public Member Functions

static void DumpStatus (ostringstream &sstr)

Public Attributes

 log_CLASSID_m
 Macro to add class name member s_className.

Private Member Functions

void DoDecrRef ()
 Decrement reference without locking.
cmn_Path DoMakePath (void)
 Create full path without locking.

Private Attributes

hsm_InoObjm_inodeObj
 Inode object.
hdb_String m_fName
hsm_FileHeaderm_FHOwner
 FH owner.
cmn_oneWRmanyRD m_nameOwnRW_x
hdb_String m_oldFName
hsm_FileHeaderm_oldFHOwner
 Old FH owner.
bool m_firstMigPackDone
 some time in past has been migrated yet this mean that is not compleatly new
bool m_nameOwnerChg
hsm_ChgFlag_t m_fhChgFlag
 what is changed? Create, Delete, nameOwn,
Int32_t m_objRef
 when FH is on job lists then this indeces are used it is possible that FH is in job and dirty list at the same time on dirty because of datachanged and on job because of dependencies of change name or owner -1 mean that is not in job list
Int32_t m_dirMemberRef
 If this FH is directory then m_dirMemberRef hold the number of its members.
ivd_RecordIDX_t m_nameOwnIdx
ivd_RecordIDX_t m_oldNameOwnIdx
ivd_RecordIDX_t m_dirTreeIdx
ivd_RecordIDX_t m_activeIdx
bool m_file2hsmIDset
 set when fil2hsmID relation is written to DB
hsm_DataMigStat_e m_dataMigStat
 if FH is in migration process and event manager can't lock file then set this state to eDoMigStart do migration process will abort migration and repeat it without data migration.
hsm_RecallInfoGrpm_reqHeader_p
 if recall is in progress then this pointer point to request header got from filter
ivd_Time_t m_modifyTimeAtMig
 modify time when migration started it's checked after data is packed and send to filter when CLEAN bit is set.
ivd_FileType_e m_fType
 File type ift_FILE, ift_DIR, ift_SYMLINK...
string m_fName
 File name.
string m_oldFName
 Old file name.
UInt16_t m_Data
 Flag to see what is changed.
ivd_Time32_t m_chgTime
 Last modification time of object.
hsm_List_e m_list
 Flag to know where File Header object is.
ivd_Time32_t m_listIdx
 Index in Dirty list or Migration candidate list.
UInt32_t m_jobNumber
 Job Index.
UInt32_t m_jobIdx
 Job List Index.
UInt32_t m_objRef
 Object reference.
ivd_RecordIDX_t m_idxFH
ivd_FileSize_t m_headerSize
 File Header size.

Static Private Attributes

static cmn_Mutex m_fileH_x

Friends

ostream & operator<< (ostream &a_os, hsm_FileHeader &a_o)

Detailed Description

hsm_FileHeader class describe header of file.

This class include Inode class and \ is part of migration class

Author:
Andrej Jamsek, HERMES SoftLab

Definition at line 75 of file client/hsmlist/hsm_FileHeader.h.


Constructor & Destructor Documentation

hsm_FileHeader::hsm_FileHeader ( ivd_FileID_t  a_fileID,
const string &  a_name,
const string &  a_oldName,
hsm_FileHeader a_hsmFHOwner,
hsm_FileHeader a_hsmOldFHOwner,
hsm_InoObj a_inodeObj 
)

Constructor to create File header object from event structure, File header object of file owner, File header object of old file owner, and I-node object.

Parameters:
a_event event structure
a_hsmFHOwner File header object of file owner
a_hsmOldFHOwner File header object of old file owner (in case of move event)
a_inodeObj I-node object

Definition at line 96 of file hsm_FileHeader.cpp.

References fhObjCount_g, hsm_FileHeader(), IncMemberRef(), InitFromDB(), log_FUNC_m, m_FHOwner, m_oldFHOwner, and NULL.

                               :
        m_inodeObj(a_inodeObj),
        m_fName(a_name),
        m_FHOwner(a_hsmFHOwner),
        m_oldFName(a_oldName),
        m_oldFHOwner(a_hsmOldFHOwner),
        m_firstMigPackDone(a_fileID != 0),
        m_nameOwnerChg((a_hsmOldFHOwner != NULL) || (a_oldName.length() != 0)),
        m_fhChgFlag(CHG_CLEAN_d),
        m_objRef(1),
        m_dirMemberRef(0),
        m_nameOwnIdx(0),
        m_oldNameOwnIdx(0),
        m_dirTreeIdx(0),
        m_activeIdx(0),
        m_file2hsmIDset(false),
        m_dataMigStat(eNotInDoMig),
        m_reqHeader_p(NULL),
        m_modifyTimeAtMig(0)
{
    log_FUNC_m(hsm_FileHeader(ivd_FS_Event_t));
    InitFromDB();
    if (m_FHOwner != NULL) {
        m_FHOwner->IncMemberRef();
    }
    if (m_oldFHOwner != NULL) {
        m_oldFHOwner->IncMemberRef();
    }

    cmn_MutexLock l(fhObjCount_x_g);
    fhObjCount_g++;
}

Here is the call graph for this function:

hsm_FileHeader::hsm_FileHeader ( hsm_FileHeader a_hsmFHOwner,
hsm_InoObj a_inodeObj,
hdb_String  a_fName 
)

Constructor to create File header object.

Parameters:
a_hsmFHOwner File header object of file owner
a_hsmOldFHOwner File header object of old file owner (in case of move event)
a_inodeObj I-node object
a_fType File type

Definition at line 162 of file hsm_FileHeader.cpp.

References fhObjCount_g, hsm_FileHeader(), IncMemberRef(), InitFromDB(), log_FUNC_m, m_FHOwner, and NULL.

Here is the call graph for this function:

hsm_FileHeader::hsm_FileHeader ( ivd_RecordIDX_t  a_activeIdx,
hdb_Active_t a_activeRec,
bool  a_trigMig = false 
)

Definition at line 197 of file hsm_FileHeader.cpp.

References fhObjCount_g, hsm_FileHeader(), InitActive(), InitFromDB(), and log_FUNC_m.

        :
        m_inodeObj(NULL),
//        m_fName(""),
        m_FHOwner(NULL),
//        m_oldFName(""),
        m_oldFHOwner(NULL),
        m_fhChgFlag(CHG_CLEAN_d),
//        m_firstMigPackDone(true),
//        m_nameOwnerChg(),
        m_objRef(1),
        m_dirMemberRef(0),
        m_nameOwnIdx(a_activeRec.nameOwnIdx),
        m_oldNameOwnIdx(a_activeRec.oldNameOwnIdx),
        m_dirTreeIdx(0),
// FIX BUG 412 member m_activeIdx not set
        m_activeIdx(0),
// end of FIX
        m_file2hsmIDset(false),
        m_dataMigStat(eNotInDoMig),
        m_reqHeader_p(NULL),
        m_modifyTimeAtMig(0)
{
    log_FUNC_m(hsm_FileHeader(hdb_Active_t));
    InitActive(a_activeIdx, a_activeRec, a_trigMig);
    InitFromDB();
    cmn_MutexLock l(fhObjCount_x_g);
    fhObjCount_g++;
}

Here is the call graph for this function:

hsm_FileHeader::hsm_FileHeader ( hsm_RecallInfoGrp a_hsmRI  ) 

Constructor to create File header object for manual recall.

Parameters:
a_IR recall info header object

Definition at line 141 of file hsm_FileHeader.cpp.

References fhObjCount_g, hsm_FileHeader(), and log_FUNC_m.

Here is the call graph for this function:

hsm_FileHeader::hsm_FileHeader (  ) 

Default constructor.

Default Constructor.

Definition at line 235 of file hsm_FileHeader.cpp.

References fhObjCount_g, and log_FUNC_m.

Referenced by hsm_FileHeader().

Here is the caller graph for this function:

hsm_FileHeader::~hsm_FileHeader (  )  [virtual]

Destructor.

Warning:
destructor of File Header object must never be called directly by delete, always by DecrRef method!

Definition at line 267 of file hsm_FileHeader.cpp.

References dbg_DETAIL, DecMemberRef(), hsm_InoObj::DecrRef(), fhObjCount_g, log_DBG_m, log_FUNC_m, m_FHOwner, m_inodeObj, m_oldFHOwner, m_reqHeader_p, and NULL.

                               {
    log_FUNC_m(~hsm_FileHeader);
    if (m_reqHeader_p != NULL) {
        delete m_reqHeader_p;
         m_reqHeader_p = NULL;
    }
    if (m_FHOwner != NULL) {
        log_DBG_m(dbg_DETAIL, "Dec mem ref of owner.");
        m_FHOwner->DecMemberRef();
    }
    if (m_oldFHOwner != NULL) {
        log_DBG_m(dbg_DETAIL, "Dec mem ref of old owner.");
        m_oldFHOwner->DecMemberRef();
    }
    if (m_inodeObj != NULL) {
        m_inodeObj->DecrRef();
    }
    cmn_MutexLock l(fhObjCount_x_g);
    fhObjCount_g--;
}

Here is the call graph for this function:

hsm_FileHeader::hsm_FileHeader ( Event_t a_event,
hsm_FileHeader a_hsmFHOwner,
hsm_FileHeader a_hsmOldFHOwner,
hsm_InoObj a_inodeObj 
)
hsm_FileHeader::hsm_FileHeader ( hsm_FileHeader a_hsmFHOwner,
hsm_FileHeader a_hsmOldFHOwner,
hsm_InoObj a_inodeObj,
ivd_FileType_e  a_fType,
string  a_fName,
string  a_fOldName 
)
hsm_FileHeader::hsm_FileHeader (  ) 

Default constructor.

virtual hsm_FileHeader::~hsm_FileHeader (  )  [virtual]

Member Function Documentation

void hsm_FileHeader::AddToDirTree (  ) 

when new directory occure in cache call this method.

bool hsm_FileHeader::AddToReleaseCanList ( fio_Transaction a_trans  ) 

Definition at line 1156 of file hsm_FileHeader.cpp.

References hsm_FHrelc::Append(), dbg_DETAIL, dbg_NORM, fio_Transaction::EndTransaction(), g_hsm_relcList_p, GetFileID(), GetFileSize(), GetFName(), GetfType(), hsm_CheckFile2hsmdbRec(), ift_FILE, log_DBG_m, log_FUNC_m, hsm_ListPos::m_relCandCircList, hsm_ListPos::m_relCandIdx, and fio_Transaction::StartTransaction().

Referenced by i_HSM_i::ActivateFiles().

                                                                 {
    log_FUNC_m(AddToReleaseCanList);

    if (GetfType() != ift_FILE) {
        //only files can be released
        return false;
    }

    if (GetFileSize() >  0) {
        log_DBG_m(dbg_NORM, "File  size > 0");

        if (m_relCandIdx == 0) {
            if (!hsm_CheckFile2hsmdbRec(GetFileID(), this)) {
                // file is not added if it is already on file2hdbID.
                a_trans.StartTransaction();
                g_hsm_relcList_p->Append( this,
                                          true,
                                          a_trans);
                a_trans.EndTransaction();

            }
        }
        else {
            log_DBG_m(dbg_NORM, "File '" << GetFName()
                    << "' is already on truc list " << m_relCandCircList
                    << "  idx " << m_relCandIdx);
        }

        log_DBG_m(dbg_DETAIL, "File '" << GetFName()
                << "' was added to release list. "
                << "  Size  " << GetFileSize()
                << "  Type " << GetfType());
    }

    return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void hsm_FileHeader::CleanChgFlag (  ) 

Definition at line 670 of file hsm_FileHeader.cpp.

References hsm_InoObj::CleanChgFlag(), log_FUNC_m, m_fhChgFlag, m_inodeObj, m_modifyTimeAtMig, and NULL.

Referenced by CompleteMigIsDone().

Here is the call graph for this function:

Here is the caller graph for this function:

void hsm_FileHeader::CleanDirListPos (  )  [inline]

Definition at line 299 of file client/hsmlist/hsm_FileHeader.h.

References hsm_ListPos::m_dirListPos.

Referenced by hsm_DirWaitList::TaskTime().

Here is the caller graph for this function:

bool hsm_FileHeader::CompleteMigIsDone ( bool  a_succeed,
fio_Transaction a_trans 
)

Definition at line 1196 of file hsm_FileHeader.cpp.

References hsm_FHrelc::Append(), CHG_DATA_d, CHG_DELETED_d, CleanChgFlag(), ivd_FS_File::Close(), dbg_DETAIL, dbg_LOW, dbg_NORM, ivd_FS_File::e_Cache, fio_Transaction::EndTransaction(), file, g_File2hdbID_p, g_fs_api_p, g_hsm_FHCache_p, g_hsm_preJobList_p, g_hsm_relcList_p, GetChgFlag(), GetFileID(), GetFileSize(), hsm_InoObj::GetFileSize(), GetFName(), GetfType(), GetInode(), hsm_InoObj::GetInodeChgFlag(), GetOldFName(), ivd_FileSystemAPI::GetRootPath(), hsm_CheckFile2hsmdbRec(), ift_DIR, ift_FILE, IsDataInPacker(), IVD_PRINT_ID_FS, log_DBG_m, log_FUNC_m, m_dirTreeIdx, m_file2hsmIDset, m_inodeObj, hsm_ListPos::m_jobElemIdx, m_jobIdx, m_list, m_nameOwnIdx, hsm_ListPos::m_relCandCircList, hsm_ListPos::m_relCandIdx, MakePath(), mt_Migrate, hsm_ListPos::ObjChgGoToDirty(), ivd_FS_File::Open(), QueueHL7Message(), hsm_JobListMgr::ReleaseElement(), RemoveFromActiveList(), hsm_FHcache::RemoveLastButOne(), RemoveNameFromHSMDB(), ResetDataInPacker(), SetInodeChgFlag(), fio_Transaction::StartTransaction(), ToMigCand(), and fio_RelFile::WriteRec().

Referenced by i_HSM_i::CompleteMigration().

                                                                               {
    log_FUNC_m(CompleteMigIsDone);


    if (!a_succeed) {
        // prepare object to repeat migration
        if (IsDataInPacker()) {
            SetInodeChgFlag(CHG_DATA_d); // data is still changed
            ResetDataInPacker(); // data is no more in packer
        }
        return false; // file was not migrated
    }
    else {
        UInt16_t tchgData = GetChgFlag();

        log_DBG_m(dbg_NORM, "CompleteMigIsDone: INO " << IVD_PRINT_ID_FS(GetInode())
            << " size=" << m_inodeObj->GetFileSize()
            << " chgFlag=0x" << hex << m_inodeObj->GetInodeChgFlag()
            << " dataInPacker=" << boolalpha << IsDataInPacker());

        if (     tchgData & CHG_DATA_d
            &&   IsDataInPacker()
            && !(tchgData & CHG_DELETED_d)) {
            ivd_FS_File file(*g_fs_api_p, GetInode());

            // Add HL7 message to cache
            QueueHL7Message(mt_Migrate);

            try {
                //HPUX - The file needs to be opened ( to be in the kernel cache )
                file.Open(ivd_FS_File::e_Cache, g_fs_api_p->GetRootPath() + MakePath());
                CleanChgFlag();
                tchgData &= ~CHG_DATA_d;
                //HPUX - Close File
                file.Close();
            }
            catch (ivd_SysError &ies) { // probably file changed or umount occured or file is deletted

                log_DBG_m(dbg_NORM, "Can't set clean bit, data changed.");
                // do same things as unsucceed
                SetInodeChgFlag(CHG_DATA_d); // data is stil changed
                ResetDataInPacker(); // data is no more in packer

                //HPUX - Close File
                file.Close();
                ObjChgGoToDirty(this);
                return false;
            }
        }

        // TODO do not remove from active list and add to release candidate list if file is
        // still dirty.
        //bug 8458
        //data changed but it is not in packer (maybe changed again while packing)
        if (    !IsDataInPacker()
             && !(tchgData & CHG_DELETED_d)
             && (tchgData & CHG_DATA_d)
             &&  (GetfType() == ift_FILE)) {

            SetInodeChgFlag(tchgData);
            ToMigCand();
            ResetDataInPacker(); // data is no more in packer


            log_DBG_m(dbg_LOW, "Dirty file was not deleted from active list. INO: "
                    << IVD_PRINT_ID_FS(GetInode())
                    << " FID: " << GetFileID()
                    << "Name: '" << GetFName() << "'"
                    << ", OldName: '" << GetOldFName() << "'")
            return false; // file was not migrated
        }

        a_trans.StartTransaction();

        RemoveFromActiveList(a_trans);

        if (tchgData & CHG_DELETED_d) {
            RemoveNameFromHSMDB(a_trans);
        }
        else {
             // FIX bug 860
            if (GetfType() == ift_DIR) {
                // if entry is directory then store fileID vs. HSMDB directory tree index relationship
                if (!m_file2hsmIDset) {
                    hdb_file2hdbID_t file2hdbID(m_nameOwnIdx, m_relCandCircList, m_dirTreeIdx); // default constructor fill it with zerroes
                    if (hsm_CheckFile2hsmdbRec(GetFileID(), this)) {
                        // if directory is already updated in file2hdbID then continue.
                        // Update the record
                    }
                    g_File2hdbID_p->WriteRec(GetFileID(), &file2hdbID, 1, &a_trans);
                    m_file2hsmIDset = true;
                }
            } else if (  GetFileSize() >  0 // add to retaintion list
                      && GetfType() == ift_FILE ) {

                if (m_relCandIdx == 0) {  //
                    if (!hsm_CheckFile2hsmdbRec(GetFileID(), this)) {
                        // file is not added if it is already on file2hdbID.
                        g_hsm_relcList_p->Append( this,
                                                  true,
                                                  a_trans);
                    }
                }
                else {
                    log_DBG_m(dbg_NORM, "File '" << GetFName()
                            << "' is already on truc list " << m_relCandCircList
                            << "  idx " << m_relCandIdx);
                }
            }
            else {
                    log_DBG_m(dbg_DETAIL, "File '" << GetFName()
                            << "' is not put to release list. "
                            << "  Size  " << GetFileSize()
                            << "  Type " << GetfType()
                            << "  IsDataInPacker " << IsDataInPacker());
            }
        }

        a_trans.EndTransaction();

        // data is no more in packer, it's migrated now
        ResetDataInPacker();
    }

    // get FH from cache if its
    if (g_hsm_FHCache_p->RemoveLastButOne(this)) {
        // remove from job list, do not set IDXes cause don't exist any more
        g_hsm_preJobList_p->ReleaseElement(m_jobIdx, m_jobElemIdx);
    }
    else {
        // remove from job list
        g_hsm_preJobList_p->ReleaseElement(m_jobIdx, m_jobElemIdx);
        m_jobIdx = m_jobElemIdx = -1;
        m_list   = eNoList;
    }
    return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void hsm_FileHeader::DecInodeRef (  ) 

Definition at line 1439 of file hsm_FileHeader.cpp.

References hsm_InoObj::DecrRef(), log_FUNC_m, m_inodeObj, and NULL.

Here is the call graph for this function:

void hsm_FileHeader::DecMemberRef (  ) 

Definition at line 1412 of file hsm_FileHeader.cpp.

References hsm_TimedList::Append(), dbg_DETAIL, dbg_NORM, g_hsm_dirWaitList_p, g_hsm_fhLock, GetfType(), GetInode(), ift_DIR, IVD_PRINT_ID_FS, log_DBG_m, log_FUNC_m, hsm_ListPos::m_dirListPos, m_dirMemberRef, m_objRef, and hsm_TimedList::SpliceToEnd().

Referenced by ~hsm_FileHeader().

                                  {
    log_FUNC_m(DecMemberRef);
    ivd_GenInode_t inode = GetInode();
    log_DBG_m(dbg_DETAIL, "INO " << IVD_PRINT_ID_FS(inode)
                       << "  objRef " << m_objRef);
    g_hsm_fhLock.LockByID(inode);

    m_dirMemberRef--;
    log_DBG_m(dbg_DETAIL, " Member reference, DEC " << m_dirMemberRef);

    if (   GetfType()     == ift_DIR
        && m_dirMemberRef == 0
        && m_objRef       == 1      ) { // only referenced by cache
        if (m_dirListPos != hsm_FHtimed_li()) {
            log_DBG_m(dbg_NORM, "Dir is splice to end of list." << IVD_PRINT_ID_FS(GetInode()));
            g_hsm_dirWaitList_p->SpliceToEnd(m_dirListPos);
        }
        else {
            log_DBG_m(dbg_NORM, "Dir is append to end of list."<< IVD_PRINT_ID_FS(GetInode()));
            m_dirListPos = g_hsm_dirWaitList_p->Append(this);
        }
    }
    g_hsm_fhLock.UnLockByID(inode);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void hsm_FileHeader::DecrRef (  ) 

method to decrement reference to this object.

This method is used for deleting the object from memory. It should be deleted just in case that no List record is referenced to it.

Definition at line 1463 of file hsm_FileHeader.cpp.

References dbg_DETAIL, dbg_NORM, GetInode(), ie_FATAL_ERROR, IVD_PRINT_ID_FS, log_DBG_m, log_FUNC_m, m_dirMemberRef, and m_objRef.

Referenced by i_HSM_i::ActivateFiles(), hsm_ActiveFH::ActiveToList(), TreeWalk::CheckDir(), fs_api::DismissFH(), fs_api::EventDelete(), fs_api::EventMove(), fs_api::GetDirFH(), hsmGetDirFH(), hsmGetFH(), InitActive(), hsm_ActiveFH::OrphanedToMigList(), hsm_JobElemVecMgr::ReleaseElementNoLock(), hsm_FHmigc::Remove(), hsm_FHADPRecall::Remove(), i_HSM_i::TrigEfficientRecall(), and hsm_FHrelc::Truncate().

                            {
    log_FUNC_m(DecrRef);

    if (m_objRef <= 0) {
        ostringstream sstr;
        sstr << "Cannot dereference FH object. Reference is already 0 INO " << IVD_PRINT_ID_FS(GetInode());
        throw ivd_InternalError(ie_FATAL_ERROR, sstr.str(), true);
    }
    m_objRef--;

    log_DBG_m(dbg_DETAIL, "Dec objRef = " << m_objRef << ". INO " << IVD_PRINT_ID_FS(GetInode()));
    if (  m_objRef       == 0
       && m_dirMemberRef == 0) {
        log_DBG_m(dbg_NORM, "Ref is 0. FH is going to delete." << *this);
        delete this;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void hsm_FileHeader::DecrRef (  ) 
void hsm_FileHeader::DirtyToMigCnd (  ) 

Definition at line 976 of file hsm_FileHeader.cpp.

References cmn_Num2Str(), eDirtyList, ie_HSM_INVLIST, log_FUNC_m, m_list, and ToMigCand().

Referenced by hsm_FHdirty::TaskTime().

                                   {
    log_FUNC_m(DirtyToMigCnd);

    if (m_list == eDirtyList) {
        ToMigCand();
    }
    else {
        log_FUNC_m(MoveToMigCnd);
        throw ivd_InternalError(ie_HSM_INVLIST,
            "FH must be on dirty or noone list. Current list = " + cmn_Num2Str(m_list) , true);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void hsm_FileHeader::DoDecrRef (  )  [private]

Decrement reference without locking.

cmn_Path hsm_FileHeader::DoMakePath ( void   )  [private]

Create full path without locking.

void hsm_FileHeader::DumpListEl ( ostringstream &  sstr  ) 

Definition at line 2095 of file hsm_FileHeader.cpp.

References GetChgFlag(), GetFileID(), GetInode(), GetOldFullPath(), IVD_PRINT_ID_FS, m_oldFName, and MakePath().

Referenced by hsm_FHmigc::DumpList(), and hsm_FHdirty::DumpList().

                                                   {
    sstr << "0x" << hex << setw(4) << setfill('0') << GetChgFlag() << setfill(' ') << dec
         << ", " << setw(9) << GetFileID()
         << ", " << IVD_PRINT_ID_FS(GetInode())
         << ", '" << MakePath() << "',";

    if ( m_oldFName.length() ) {
        sstr << " '" << GetOldFullPath() << "'";
    }
    sstr << endl;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void hsm_FileHeader::DumpStatus ( ostringstream &  sstr  )  [static]

Definition at line 81 of file hsm_FileHeader.cpp.

References fhObjCount_g.

Referenced by i_HSM_i::ShowStatus().

                                                   {
    sstr << "Number of FH in memory : " << fhObjCount_g << endl;
}

Here is the caller graph for this function:

void hsm_FileHeader::Event ( fs_api::Event_e  a_eventType,
fio_Transaction trans,
cmn_Path movedFrom = NULL 
)

Definition at line 742 of file hsm_FileHeader.cpp.

References assert, ClientConf_t::CfgMigrateWithCollocation, CHG_ATTR_d, CHG_CREATE_d, CHG_DATA_d, CHG_DELETED_d, CHG_NAMEOWN_d, cmn_Num2Str(), dbg_DETAIL, dbg_NORM, fs_api::eChgAttr, fs_api::eChgData, fs_api::eChgNameOwn, fs_api::eCreate, fs_api::eDelFile, fio_Transaction::EndTransaction(), eNoList, fs_api::eOpen, fs_api::eRelease, file, g_clientConf_p, g_fs_api_p, g_fsLog, g_hsm_activeList_p, g_hsm_FHCache_p, g_hsm_relcList_p, g_mig, hsm_MigByAPI::GetAPIMode(), GetFileID(), GetFileType(), ivd_BaseException::GetFriendly(), GetfType(), GetFullPath(), GetInode(), GetOldFullPath(), ivd_FS_File::GetProperties(), ie_ARGUMENT_MISSING, ie_HSM_COLLOCATION, ie_NOTYPE, ift_FILE, InodeChgGoToDirty(), ivd_Error, IVD_PRINT_ID_FS, log_DBG_m, log_FUNC_m, m_activeIdx, ivd_FS_FileProperty_t::m_dirtyFlag, m_firstMigPackDone, m_inodeObj, hsm_InoObj::m_lastDataUpdataInDB, m_list, m_nameOwnIdx, m_objRef, m_oldFHOwner, m_oldFName, hsm_ListPos::m_relCandIdx, MakePath(), NameOwnChgGoToDirty(), NewName(), NewOwner(), NULL, hsm_ActiveFH::Release(), hsm_FHcache::Remove(), hsm_ListPos::RemoveFromList(), RemoveFromRelCandList(), SetFHChgFlag(), SetInodeChgFlag(), hsm_FHrelc::SpaceCheck(), fio_Transaction::StartTransaction(), StoreActiveRec(), StoreNameOwnRec(), StoreOldNameOwnRec(), UnSetInodeChgFlag(), and log_ivdfs::Write().

Referenced by fs_api::AddGenericEvent(), fs_api::EventDelete(), fs_api::EventMove(), fs_api::GetDirFH(), and hsm_FHmigc::SendToPM().

                                                {
    log_FUNC_m(Event);
    switch (a_eventType) {
    case fs_api::eChgData: {
        log_DBG_m(dbg_NORM, "Event: ChgData INO " << IVD_PRINT_ID_FS(GetInode()));
        // SpaceCheck wakeup release thread if is a sleep
        g_hsm_relcList_p->SpaceCheck();

        SetInodeChgFlag(CHG_DATA_d);
        InodeChgGoToDirty();

        ivd_Time32_t currentTime(time(NULL));
        // update DB every 300 seconds
        // prevent large files to be to long on the same position in circular list
        if (m_inodeObj->m_lastDataUpdataInDB < currentTime - 300) {
            log_DBG_m(dbg_NORM, "Event: ChgData path=" << MakePath());
            // m_lastDataUpdataInDB is reset when RemoveFromActiveList() method is called
            m_inodeObj->m_lastDataUpdataInDB = currentTime;

            trans.StartTransaction();
            if (m_nameOwnIdx == 0) {
                StoreNameOwnRec(trans);
            }
            StoreActiveRec(trans);
            if (m_relCandIdx != 0) {  // remove it form release candidate list
                RemoveFromRelCandList(trans);
            }
            trans.EndTransaction();
        }
        }
        break;
    case fs_api::eCreate: {
            log_DBG_m(dbg_NORM, "Event: Create INO " << IVD_PRINT_ID_FS(GetInode())
                             << " path=" << MakePath());
            if ((g_mig.GetAPIMode()) && (GetFileType() == ift_FILE)) {
                log_DBG_m(dbg_NORM, "Recall only mode: Just log file creation.");
                g_fsLog.Write(GetInode(), GetFileID(), 0, MakePath(), "", CHG_CREATE_d);
                throw ivd_Error(ie_HSM_COLLOCATION, "Skipping Create event");
                break;
            }
            // SpaceCheck wakeup release thread if is a sleep
            g_hsm_relcList_p->SpaceCheck();

            // IMPROVEMENT  almost twice faster
            // set as DATA was changed if not size will be 0 and no data mig. occure
            // No DB update when data change event come already done.
            // fix bug 671
            if (GetfType() == ift_FILE) {
                SetFHChgFlag(CHG_CREATE_d | CHG_DATA_d);
            }else {
                SetFHChgFlag(CHG_CREATE_d);
            }
            g_fsLog.Write(GetInode(), GetFileID(), 0, MakePath(), "", CHG_CREATE_d);
            // end fix bug
            m_inodeObj->m_lastDataUpdataInDB = time(NULL);

            NameOwnChgGoToDirty();
            trans.StartTransaction();
            StoreNameOwnRec(trans);
            StoreActiveRec(trans);
            if (m_relCandIdx != 0) {  // remove it form release candidate list
                RemoveFromRelCandList(trans);
            }
            trans.EndTransaction();
        }
        break;
    case fs_api::eChgNameOwn: {
            log_DBG_m(dbg_NORM, "Event: ChgNameOwn INO " << IVD_PRINT_ID_FS(GetInode()));
            SetFHChgFlag(CHG_NAMEOWN_d);

            if (g_clientConf_p->CfgMigrateWithCollocation) {
                bool isDirty(false);
                try {
                    ivd_FS_FileProperty_t fileProp;

                    ivd_FS_File file(*g_fs_api_p, GetInode());
                    file.GetProperties(fileProp);

                    isDirty = fileProp.m_dirtyFlag;
                }
                catch (ivd_Exception &e) {
                    log_DBG_m(dbg_DETAIL, "Cannot get file (" << GetFullPath() << ") state. Error: "
                            << e.GetFriendly() << ".");
                    isDirty = true;
                }
                if (isDirty) {
                    SetFHChgFlag(CHG_DATA_d);
                }
            }

            if (movedFrom == NULL) {
                ostringstream sstr;
                sstr << "Old path is expected at ChgNameOwn event. INO " << IVD_PRINT_ID_FS(GetInode());
                throw ivd_InternalError(ie_ARGUMENT_MISSING, sstr.str(), true);
            }

            g_fsLog.Write(GetInode(), GetFileID(), 0, MakePath(), *movedFrom, CHG_NAMEOWN_d);

            NameOwnChgGoToDirty();
            trans.StartTransaction();
            StoreNameOwnRec(trans);
            if (   m_oldFName.length() != 0
                || m_oldFHOwner        != 0) {
                StoreOldNameOwnRec(trans);
            }
            StoreActiveRec(trans);
            if (m_relCandIdx != 0) {  // remove it form release candidate list
                RemoveFromRelCandList(trans);
            }
            trans.EndTransaction();
        }
        break;
    case fs_api::eChgAttr: {
            log_DBG_m(dbg_NORM, "Event: ChgAttr INO " << IVD_PRINT_ID_FS(GetInode())
                             << " path=" << MakePath());
            SetInodeChgFlag(CHG_ATTR_d);
            NameOwnChgGoToDirty();
            trans.StartTransaction();
            if (m_nameOwnIdx == 0) {
                StoreNameOwnRec(trans);
            }
            StoreActiveRec(trans);
            if (m_relCandIdx != 0) {  // remove it form release candidate list
                RemoveFromRelCandList(trans);
            }
            trans.EndTransaction();
        }
        break;
    case fs_api::eDelFile:
        log_DBG_m(dbg_DETAIL, "Event: DelFile INO " << IVD_PRINT_ID_FS(GetInode())
                         << " old path=" << GetOldFullPath()
                         << *this);
            g_fsLog.Write(GetInode(), GetFileID(), 0, "", *movedFrom, CHG_DELETED_d);
        if (!m_firstMigPackDone) {
            log_DBG_m(dbg_DETAIL, "  File is deleted and will be deleted from Cache too. File ID = 0");
//            RemoveFromHSM();
            RemoveFromList(this);

            trans.StartTransaction();
            if (m_activeIdx > 0) {
                g_hsm_activeList_p->Release(this,trans);
            }
            trans.EndTransaction();

            g_hsm_FHCache_p->Remove(this);
            return;
        }
        else {
            NewName(string(""));
            NewOwner(NULL);
            NameOwnChgGoToDirty();
            // to be proper removed from previous list specialy migCand
            // where size of file need to be substracted
            // set only deleted flag all other must be cleaned
            UnSetInodeChgFlag(0xFFFF);

            // fix bug 481  deletted files are not migratted.
            SetInodeChgFlag(CHG_DELETED_d);
            SetFHChgFlag(CHG_DELETED_d);

            trans.StartTransaction();
            StoreNameOwnRec(trans);
            StoreOldNameOwnRec(trans);
            StoreActiveRec(trans);
            if (m_relCandIdx != 0) {  // remove it form release candidate list
                RemoveFromRelCandList(trans);
            }
            trans.EndTransaction();
        }
        break;
    case fs_api::eRelease:
        log_DBG_m(dbg_NORM, "Event: Release INO " << IVD_PRINT_ID_FS(GetInode()));
        if (m_list == eNoList) { // close file and is on no lists then remove it
            // reference must be 1 at this point
            assert(m_objRef == 1);
            g_hsm_FHCache_p->Remove(this);
        }
        break;
    case fs_api::eOpen:
        log_DBG_m(dbg_NORM, "Event: Open INO " << IVD_PRINT_ID_FS(GetInode()));
        break;
    default :
        throw ivd_InternalError(ie_NOTYPE,
            "Wrong list type in FH hsm_List_e = " + cmn_Num2Str(m_list) , true);
        break;
    };
}

Here is the call graph for this function:

Here is the caller graph for this function:

void hsm_FileHeader::EventOffline ( ivd_FS_Event a_event  ) 

Definition at line 1495 of file hsm_FileHeader.cpp.

References ivd_FS_File::AddSyncEvent(), hsm_FHADPRecall::Append(), ivd_FS_File::Close(), dbg_DETAIL, dbg_LOW, ivd_FS_File::e_Cache, fio_Transaction::EndTransaction(), evt_ERROR, file, i_Recall_t::fileID, i_Recall_t::fileIdx, i_Recall_t::fileSize, g_cmn, g_fs_api_p, g_hsm_FHADPRecall_p, g_hsm_preJobList_p, g_hsm_relcList_p, g_hsmDB_p, g_iPM, ivd_FS_Event::GetCause(), ivd_FS_Event::GetChunkOff(), ivd_FS_Event::GetChunkSize(), ivd_FS_Event::GetFileID(), GetFileSize(), ivd_BaseException::GetFriendly(), GetInode(), hsm_JobListMgr::GetJobIdx(), ivd_FS_Event::GetPath(), ivd_FS_File::GetProperties(), ivd_FileSystemAPI::GetRootPath(), fio_DataBase::GetTransObj(), hjs_RECALL, hsm_JobListMgr::Insert(), ipc_EXEC_m, hsm_FHADPRecall::IsAlternateDataPathSet(), ivd_FS_ERR_Reply, ivd_FS_OK_Reply, log_DBG_m, log_ERR_m, log_FUNC_m, log_WriteEvent(), ivd_FS_FileProperty_t::m_fileID, ivd_FS_FileProperty_t::m_fileSize, m_fName, hsm_RecallInfoGrp::m_fsFile, ivd_FS_FileProperty_t::m_Inode, hsm_RecallInfoGrp::m_jobElemIdx, hsm_RecallInfoGrp::m_jobIdx, ivd_Product::m_nameShort, ivd_FS_FileProperty_t::m_offlineFlag, hsm_ListPos::m_relCandIdx, m_reqHeader_p, MakePath(), i_Recall_t::migrationID, NULL, ivd_FS_File::Open(), cmn_Global::prod, fio_DataBase::ReleaseTransObj(), RemoveFromRelCandList(), ivd_FS_Event::ReplySyncEvent(), SendReply(), ivd_FS_File::SetDataOnline(), SetFileSize(), hsm_JobListMgr::SetJobStatus(), hsm_JobListMgr::SetMigJobID(), SetOffline(), hsm_FHrelc::SpaceCheck(), and fio_Transaction::StartTransaction().

Referenced by EventOffline(), and i_HSM_i::TrigEfficientRecall().

                                                      {
    log_FUNC_m(EventOffline);

   ivd_FS_FileProperty_t fileProp;
   if (m_reqHeader_p == NULL) {
        ivd_FS_File file(*g_fs_api_p, GetInode()); //TODO , GetFileID());

        cmn_Path fileName = g_fs_api_p->GetRootPath() + a_event.GetPath();
        ivd_FS_File cacheFile(*g_fs_api_p, fileName);
        try {
            //HPUX - The file needs to be opened (to be in the kernel cache)
            cacheFile.Open(ivd_FS_File::e_Cache);
            file.GetProperties(fileProp);

            if (!fileProp.m_offlineFlag) {
                log_DBG_m(dbg_DETAIL, "File is already recalled.");
                if (a_event.GetCause() == HSM_CAUSE_OFFLINE) {
                    a_event.ReplySyncEvent(ivd_FS_OK_Reply);
                }
                return;
            }
            if (fileProp.m_fileSize == 0) {
                log_DBG_m(dbg_LOW, "File (id:" << fileProp.m_fileID <<
                    ", Inode:" << fileProp.m_Inode <<
                    " .size is 0 no recall needed. ");
                // Overwrite on Windows triggers recall with fileSize=0
                // bug 3780
                // WORKAROUND: Set data online with size 0 and reply

                //set file online

                file.SetDataOnline(0, 0);

                a_event.ReplySyncEvent(ivd_FS_OK_Reply);
                return;
            }
            //HPUX CLose file
            cacheFile.Close();
        }
        catch (ivd_SysError &ise) {  // can't
            log_DBG_m(dbg_DETAIL, "File is deleted.");
            if (a_event.GetCause() == HSM_CAUSE_OFFLINE) {
                a_event.ReplySyncEvent(ivd_FS_ERR_Reply);
            }
            //HPUX CLose file
            cacheFile.Close();
        }

        if (   a_event.GetChunkOff()  == 0
            && a_event.GetChunkSize() == 0) { // recall because of truncate to 0
            SetOffline(false);
            if ( a_event.GetCause() == HSM_CAUSE_OFFLINE) {
                a_event.ReplySyncEvent(ivd_FS_OK_Reply);
            }
            log_DBG_m(dbg_DETAIL, "ReWrite offline file.");
            return;
        }

        m_reqHeader_p = new hsm_RecallInfoGrp(file, fileProp.m_fileSize);

        if ( a_event.GetCause() != HSM_CAUSE_RECALL) {
            m_reqHeader_p->m_fsFile.AddSyncEvent(a_event);
        }
    }
    else {
        if ( a_event.GetCause() != HSM_CAUSE_RECALL) {
            m_reqHeader_p->m_fsFile.AddSyncEvent(a_event);
        }
        log_DBG_m (dbg_DETAIL, "  RECALL of file: " << m_fName << " already in progress");
        return;
    }
// end


    if (a_event.GetFileID() == 0) {
        if (g_hsm_FHADPRecall_p->IsAlternateDataPathSet()) {
            g_hsm_FHADPRecall_p->Append(this);
            return;
        }
        else {
            ostringstream sstr;
            sstr << "Can not recall. No fileID. Error or no alternate data path set. File: '"
                << MakePath() << "'.";
            log_WriteEvent(evt_ERROR, sstr.str());
            SendReply(ivd_FS_ERR_Reply);
            return;
        }
    }

    m_reqHeader_p->m_jobIdx = g_hsm_preJobList_p->GetJobIdx(1);

    g_hsm_preJobList_p->SetJobStatus(m_reqHeader_p->m_jobIdx, hjs_RECALL);

    m_reqHeader_p->m_jobElemIdx = g_hsm_preJobList_p->Insert(m_reqHeader_p->m_jobIdx, this);


    try {
        SetFileSize(fileProp.m_fileSize);

        struct i_Recall_t recallStr;
        recallStr.fileID        = a_event.GetFileID();
        recallStr.migrationID   = 0;
        recallStr.fileSize      = GetFileSize();
        recallStr.fileIdx       = m_reqHeader_p->m_jobElemIdx;
        log_DBG_m (dbg_DETAIL, "  RECALL of file: " << m_fName
                            << " with FileID " << recallStr.fileID
                            << " file size " << recallStr.fileSize
                            << " cause: " << (int)a_event.GetCause());

        if (m_relCandIdx != 0) {  // remove it form release candidate list
            fio_Transaction &trans = *g_hsmDB_p->GetTransObj();
            trans.StartTransaction();
            RemoveFromRelCandList(trans);
            trans.EndTransaction();
            g_hsmDB_p->ReleaseTransObj(trans);
        }
        g_hsm_relcList_p->SpaceCheck();
        ipc_EXEC_m(
            i_JobID_t hsmJobIndexID = g_iPM->Recall(recallStr);
            g_hsm_preJobList_p->SetJobStatus(m_reqHeader_p->m_jobIdx, hjs_RECALL);
            g_hsm_preJobList_p->SetMigJobID(m_reqHeader_p->m_jobIdx, hsmJobIndexID, 0);
        );
    }
    catch (ivd_Exception &ie) {
        log_ERR_m("PM->Recall() failed: " + ie.GetFriendly());
        ostringstream sstr;
        sstr << "Failed to start recall on " << g_cmn.prod.m_nameShort
             << "-PM (" << ie.GetFriendly() << ").";
        log_WriteEvent(evt_ERROR, sstr.str());
        SendReply(ivd_FS_ERR_Reply);
    }
    catch (...){
        log_ERR_m("PM->Recall() failed: unknown exception");
        log_WriteEvent(evt_ERROR, "Failed to start recall on "
                                  + g_cmn.prod.m_nameShort + "-PM.");
        SendReply(ivd_FS_ERR_Reply);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool hsm_FileHeader::EventOffline ( UInt32_t  a_jobIdx,
i_Recall_t a_recallStr,
bool  a_migrateAfterRecall 
)

Add FH to recall job with index a_jobIdx.

Definition at line 1636 of file hsm_FileHeader.cpp.

References ivd_FS_File::AddSyncEvent(), dbg_DETAIL, dbg_LOW, ivd_FS_File::e_Cache, fio_Transaction::EndTransaction(), EventOffline(), file, i_Recall_t::fileID, i_Recall_t::fileIdx, i_Recall_t::fileSize, g_fs_api_p, g_hsm_FHCache_p, g_hsm_preJobList_p, g_hsm_relcList_p, g_hsmDB_p, GetFileID(), GetFileSize(), GetInode(), ivd_FS_File::GetProperties(), ivd_FileSystemAPI::GetRootPath(), fio_DataBase::GetTransObj(), HSM_CAUSE_MIGRATE, hsm_JobListMgr::Insert(), log_DBG_m, log_FUNC_m, ivd_FS_FileProperty_t::m_fileID, ivd_FS_FileProperty_t::m_fileSize, m_fName, hsm_RecallInfoGrp::m_fsFile, ivd_FS_FileProperty_t::m_Inode, hsm_RecallInfoGrp::m_jobElemIdx, hsm_RecallInfoGrp::m_jobIdx, ivd_FS_FileProperty_t::m_offlineFlag, hsm_ListPos::m_relCandIdx, m_reqHeader_p, MakePath(), i_Recall_t::migrationID, NULL, fio_DataBase::ReleaseTransObj(), RemoveFromRelCandList(), hsm_FHcache::RemoveLastButOne(), ivd_FS_File::SetDataOnline(), hsm_FHrelc::SpaceCheck(), and fio_Transaction::StartTransaction().

                                                                    {
    log_FUNC_m(EventOffline(jobIdx));

    a_recallStr.fileID = 0; // if failed then fileID is not set.

    if (m_reqHeader_p != NULL) { //
        log_DBG_m (dbg_DETAIL, "Manual RECALL of file: " << m_fName << ", but recall already in progress.");
        return false;
    }
    else {
        ivd_FS_FileProperty_t fileProp;
        // create file object to be stored in m_reqHeader
        ivd_FS_File file(*g_fs_api_p, GetInode(), GetFileID());
        try {
            // temporary fileobject, just for asure the file dentry in filter.
            ivd_FS_File fileTemp(*g_fs_api_p, g_fs_api_p->GetRootPath() + MakePath());
            //HPUX - The file needs to be opened ( to be in the kernel cache )
            fileTemp.Open(ivd_FS_File::e_Cache);
            // file object has to be used for get propertites because
            // also its properties are set
            file.GetProperties(fileProp);
            fileTemp.Close();
            if (!fileProp.m_offlineFlag) {
                log_DBG_m(dbg_DETAIL, "File is already recalled.");
                g_hsm_FHCache_p->RemoveLastButOne(this);
                return false;
            }
            if (fileProp.m_fileSize == 0) {
                log_DBG_m(dbg_LOW, "File (id:" << fileProp.m_fileID <<
                    ", Inode:" << fileProp.m_Inode <<
                    " .size is 0 no recall needed. ");
                //set file online
                file.SetDataOnline(0, 0);
                g_hsm_FHCache_p->RemoveLastButOne(this);
                return false;
            }
        }
        catch (ivd_SysError &ise) {  // can't
            log_DBG_m(dbg_DETAIL, "File is deletted.");
            g_hsm_FHCache_p->RemoveLastButOne(this);
            return false;
        }

        m_reqHeader_p = new hsm_RecallInfoGrp(file, fileProp.m_fileSize);
        if (a_migrateAfterRecall) {
            ivd_FS_Event event;
            event.SetCause(HSM_CAUSE_MIGRATE);
            m_reqHeader_p->m_fsFile.AddSyncEvent(event);
        }
    }

    m_reqHeader_p->m_jobIdx = a_jobIdx;

    m_reqHeader_p->m_jobElemIdx = g_hsm_preJobList_p->Insert(a_jobIdx, this);

    a_recallStr.fileID        = GetFileID();
    a_recallStr.migrationID   = 0;
    a_recallStr.fileSize      = GetFileSize();
    a_recallStr.fileIdx       = m_reqHeader_p->m_jobElemIdx;

    if (m_relCandIdx != 0) {  // remove it form release candidate list
        fio_Transaction &trans = *g_hsmDB_p->GetTransObj();
        trans.StartTransaction();
        RemoveFromRelCandList(trans);
        trans.EndTransaction();
        g_hsmDB_p->ReleaseTransObj(trans);
    }
    g_hsm_relcList_p->SpaceCheck();

    return true;
}

Here is the call graph for this function:

void hsm_FileHeader::FileToSeqElem ( i_JobRequest_t migElem  ) 

Definition at line 1094 of file hsm_FileHeader.cpp.

References dbg_NORM, i_JobRequest_t::fileIdx, i_JobRequest_t::fSize, hsm_InoObj::GetFileSize(), GetFileSizeForMig(), GetInode(), hsm_InoObj::GetInodeChgFlag(), GetOldFullPath(), IVD_PRINT_ID_FS, log_DBG_m, log_FUNC_m, m_inodeObj, hsm_ListPos::m_jobElemIdx, and MakePath().

Referenced by hsm_JobElemVecMgr::JobToSequence(), and MigPreJobToPM().

                                                           {
    log_FUNC_m(FileToSeqElem);
    log_DBG_m(dbg_NORM, "FileToPM: INO " << IVD_PRINT_ID_FS(GetInode())
            << " size=" << m_inodeObj->GetFileSize()
            << " chgFlag=0x" << hex << m_inodeObj->GetInodeChgFlag()
            << " path " << MakePath()
            << " old path " << GetOldFullPath());

    migElem.fSize     = GetFileSizeForMig();
    migElem.fileIdx   = m_jobElemIdx;
}

Here is the call graph for this function:

Here is the caller graph for this function:

ivd_RecordIDX_t hsm_FileHeader::GetActiveIdx (  )  [inline]

Definition at line 218 of file client/hsmlist/hsm_FileHeader.h.

References m_activeIdx.

Referenced by hsm_ActiveFH::Release(), and hsm_ActiveFH::Update().

{ return m_activeIdx;};

Here is the caller graph for this function:

hsm_ChgFlag_t hsm_FileHeader::GetChgFlag ( void   )  const

Definition at line 678 of file hsm_FileHeader.cpp.

References hsm_InoObj::GetInodeChgFlag(), log_FUNC_m, m_fhChgFlag, m_inodeObj, and NULL.

Referenced by hsm_ActiveFH::Append(), CompleteMigIsDone(), DumpListEl(), MigrationIsDone(), i_HSM_i::PackFile(), and hsm_ActiveFH::Update().

                                                   {
    log_FUNC_m(GetChgFlag);
    if (m_inodeObj != NULL) {
        return m_inodeObj->GetInodeChgFlag() | m_fhChgFlag;
    }
    else {
        return m_fhChgFlag;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

ivd_Time32_t hsm_FileHeader::GetChgTime ( void   )  const [inline]

Definition at line 144 of file include/ivd/hsm_FileHeader.h.

References m_chgTime.

{ return m_chgTime   ;};

UInt16_t hsm_FileHeader::GetChnData ( void   )  const
hsm_DataMigStat_e hsm_FileHeader::GetDataMigStat (  )  [inline]

Definition at line 278 of file client/hsmlist/hsm_FileHeader.h.

References m_dataMigStat.

Referenced by fs_api::FindAndPrepareFH(), and i_HSM_i::PackFile().

{return m_dataMigStat;};

Here is the caller graph for this function:

ivd_RecordIDX_t hsm_FileHeader::GetDirTreeIdx (  )  [inline]

Definition at line 209 of file client/hsmlist/hsm_FileHeader.h.

References m_dirTreeIdx.

Referenced by GetOwnDirTreeIdx().

{ return m_dirTreeIdx;};

Here is the caller graph for this function:

ivd_FileID_t hsm_FileHeader::GetFileID ( void   )  const
ivd_FileID_t hsm_FileHeader::GetFileID ( void   )  const
ivd_FileSize_t hsm_FileHeader::GetFileSize ( void   )  const
ivd_FileSize_t hsm_FileHeader::GetFileSize ( void   )  const

Method safely return file size from i-node object (if object IS_NULL return 0).

Definition at line 582 of file hsm_FileHeader.cpp.

References dbg_DETAIL, hsm_InoObj::GetFileSize(), log_DBG_m, log_FUNC_m, m_inodeObj, and NULL.

Referenced by AddToReleaseCanList(), hsm_FHrelc::Append(), hsm_ReleaseCandRec::Append(), hsm_ActiveFH::Append(), CompleteMigIsDone(), EventOffline(), Recalled(), hsm_FHrelc::Truncate(), and hsm_ActiveFH::Update().

                                                     {
    log_FUNC_m(GetFileSize);
    if (m_inodeObj != NULL) {
        return m_inodeObj->GetFileSize();
    }
    else {
        log_FUNC_m(GetFileSize);
        log_DBG_m(dbg_DETAIL, "  GetFileSize FAILED: Inode object IS_NULL");
        return 0;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

ivd_FileSize_t hsm_FileHeader::GetFileSizeForMig ( void   )  const

Definition at line 596 of file hsm_FileHeader.cpp.

References CHG_DATA_d, dbg_DETAIL, hsm_InoObj::GetFileSize(), hsm_InoObj::GetInodeChgFlag(), log_DBG_m, log_FUNC_m, m_inodeObj, and NULL.

Referenced by hsm_FHmigc::Append(), FileToSeqElem(), hsm_FHmigc::Migrate(), hsm_FHmigc::MigrateParents(), and hsm_FHmigc::Remove().

                                                           {
    log_FUNC_m(GetFileSizeForMig);
    if (m_inodeObj != NULL) {
        if ((m_inodeObj->GetInodeChgFlag() & CHG_DATA_d) == CHG_DATA_d) {
            ivd_FileSize_t tfSize = m_inodeObj->GetFileSize();
            if (tfSize == 0) {
                return HSM_FILE_HEADER_SIZE;
            }
            else {
                return tfSize;
            }
        }
        else {
            return HSM_FILE_HEADER_SIZE;
        }
    }
    else{
        log_FUNC_m(GetFileSizeForMig);
        log_DBG_m(dbg_DETAIL, "  GetFileSizeForMig FAILED: Inode object IS_NULL");
        return 0;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

ivd_FileType_e hsm_FileHeader::GetFileType ( void   )  const

Definition at line 555 of file hsm_FileHeader.cpp.

References hsm_InoObj::GetfType(), log_FUNC_m, m_inodeObj, and NULL.

Referenced by Event(), and hsm_FHmigc::Migrate().

                                                     {
    log_FUNC_m(GetFileType);
    if (m_inodeObj == NULL) {
        return ift_UNKNOWN;
    }
    else {
        return m_inodeObj->GetfType();
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

string hsm_FileHeader::GetFName ( void   )  const [inline]
string hsm_FileHeader::GetFName ( void   )  const [inline]

Definition at line 138 of file include/ivd/hsm_FileHeader.h.

References m_fName.

{ return m_fName     ;};

hsm_FileHeader* hsm_FileHeader::GetFOwner ( void   )  const [inline]

Definition at line 227 of file client/hsmlist/hsm_FileHeader.h.

References m_FHOwner.

Referenced by hsm_FHmigc::Migrate(), hsm_FHmigc::MigrateParents(), and i_HSM_i::PackFile().

{ return m_FHOwner   ;};

Here is the caller graph for this function:

hsm_FileHeader* hsm_FileHeader::GetFOwner ( void   )  const [inline]

Definition at line 141 of file include/ivd/hsm_FileHeader.h.

References m_FHOwner.

{ return m_FHOwner   ;};

UInt64_t hsm_FileHeader::GetFOwnerInode ( void   )  const
ivd_FileType_e hsm_FileHeader::GetfType (  )  const [inline]

Definition at line 230 of file client/hsmlist/hsm_FileHeader.h.

References hsm_InoObj::GetfType(), m_inodeObj, and NULL.

Referenced by AddToReleaseCanList(), hsm_FHrelc::Append(), hsm_ReleaseCandRec::Append(), hsm_ActiveFH::Append(), CompleteMigIsDone(), DecMemberRef(), Event(), IncMemberRef(), InitFromDB(), MakeStat(), operator==(), ToMigCand(), and hsm_ActiveFH::Update().

                                     { return m_inodeObj != NULL
                                            ? m_inodeObj->GetfType()
                                            : ift_UNKNOWN;
    };

Here is the call graph for this function:

Here is the caller graph for this function:

ivd_FileType_e hsm_FileHeader::GetfType ( void   )  const [inline]

Definition at line 145 of file include/ivd/hsm_FileHeader.h.

References m_fType.

{ return m_fType     ;}; 

cmn_Path hsm_FileHeader::GetFullPath (  ) 

return empty path if name not exist

Definition at line 712 of file hsm_FileHeader.cpp.

References log_FUNC_m, m_fName, and MakePath().

Referenced by fs_api::AddGenericEvent(), Event(), fs_api::GetDirFH(), GetGidCidInfo(), hsm_FHmigc::Migrate(), hsm_FHmigc::MigrateParents(), operator<<(), i_HSM_i::PackFile(), and QueueHL7Message().

                                     {
    log_FUNC_m(GetFullPath);
    if (  m_fName.length() != 0) {
        return MakePath();
    }
    else {
        return cmn_Path("");
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool hsm_FileHeader::GetGidCidInfo ( string &  a_gid,
string &  a_cid,
string &  a_basePath,
string &  a_fileName 
)

Definition at line 2136 of file hsm_FileHeader.cpp.

References dbg_DETAIL, g_fs_api_p, GetFullPath(), ivd_FileSystemAPI::GetRootPath(), log_DBG_m, log_FUNC_m, path, PATH_SEPARATOR, and cmn_Path::Split().

Referenced by QueueHL7Message().

                                                       {
    log_FUNC_m(GetGidCidInfo);

    cmn_Path pathAfterBasePath;
    cmn_Path path = GetFullPath();
    cmn_Path basePath;
    path.Split(0, basePath, pathAfterBasePath);
    size_t pos(basePath.find("-"));
    if (pos != string::npos) {
        a_gid = basePath.substr(0,pos);
        a_cid = basePath.substr(pos+1, basePath.length());
        a_basePath = g_fs_api_p->GetRootPath() + basePath;
        a_basePath.append(string(1, PATH_SEPARATOR));
        a_fileName = pathAfterBasePath;
        log_DBG_m(dbg_DETAIL, "GID=" << a_gid << " CID=" << a_cid << " BasePath="
                              << a_basePath << " file=" << a_fileName);
        return true;
    }
    return false;
}

Here is the call graph for this function:

Here is the caller graph for this function:

UInt64_t hsm_FileHeader::GetInode ( void   )  const
UInt64_t hsm_FileHeader::GetInode ( void   )  const
hsm_InoObj* hsm_FileHeader::GetInoObj ( void   )  const [inline]

Definition at line 226 of file client/hsmlist/hsm_FileHeader.h.

References m_inodeObj.

{ return m_inodeObj  ;};

hsm_InoObj* hsm_FileHeader::GetInoObj ( void   )  const [inline]

Definition at line 140 of file include/ivd/hsm_FileHeader.h.

References m_inodeObj.

{ return m_inodeObj  ;};

void hsm_FileHeader::GetJob ( UInt32_t a_jobNumber,
UInt32_t a_jobIdx 
) const [inline]

Get job and job index.

Definition at line 151 of file include/ivd/hsm_FileHeader.h.

References m_jobIdx, and m_jobNumber.

                                                                                   { 
                                  a_jobNumber = m_jobNumber; 
                                  a_jobIdx    = m_jobIdx;
    }; 

ivd_MigrationID_t hsm_FileHeader::GetJobMigID (  ) 

Definition at line 1483 of file hsm_FileHeader.cpp.

References g_hsm_preJobList_p, hsm_JobListMgr::GetMigrationID(), log_FUNC_m, and m_jobIdx.

                                              {
    log_FUNC_m(GetJobMigID);
    if (m_jobIdx == -1) {
        return 0;  // FH is not in job list
    }
    else {
        return g_hsm_preJobList_p->GetMigrationID(m_jobIdx);
    }
}

Here is the call graph for this function:

hsm_List_e hsm_FileHeader::GetList ( void   )  const [inline]

Get list where FH is.

Reimplemented from hsm_ListPos.

Definition at line 132 of file include/ivd/hsm_FileHeader.h.

References m_list.

Referenced by fs_api::GetDirFH(), hsm_FHmigc::MigrateParents(), hsm_ActiveFH::OrphanedToMigList(), and i_HSM_i::PackFile().

{ return m_list      ;};

Here is the caller graph for this function:

ivd_Time32_t hsm_FileHeader::GetListIdx ( void   )  const [inline]

Get index on a list (for Dirty and MigCnd list).

Definition at line 134 of file include/ivd/hsm_FileHeader.h.

References m_listIdx.

{ return m_listIdx   ;};

ivd_Time32_t hsm_FileHeader::GetMigAllowedTime (  )  [inline]

Definition at line 263 of file client/hsmlist/hsm_FileHeader.h.

References hsm_InoObj::GetMigAllowedTime(), m_inodeObj, and NULL.

Referenced by i_HSM_i::PackFile().

                                     {return m_inodeObj != NULL
                                    ? m_inodeObj->GetMigAllowedTime()
                                    : 0;
    };

Here is the call graph for this function:

Here is the caller graph for this function:

ivd_RecordIDX_t hsm_FileHeader::GetNameOwnIdx (  )  [inline]

Definition at line 187 of file client/hsmlist/hsm_FileHeader.h.

References m_nameOwnIdx.

Referenced by hsm_FHrelc::Append(), hsm_ReleaseCandRec::Append(), hsm_ActiveFH::Append(), GetOwnersNameOwnIdx(), GetOwnersOldNameOwnIdx(), and hsm_ActiveFH::Update().

{ return m_nameOwnIdx;};

Here is the caller graph for this function:

bool hsm_FileHeader::GetOffline ( void   )  const

Definition at line 567 of file hsm_FileHeader.cpp.

References hsm_InoObj::GetOffline(), log_FUNC_m, m_inodeObj, and NULL.

                                           {
    log_FUNC_m(GetOffline);
    if ( m_inodeObj == NULL){
        return false;
    }
    else {
        return m_inodeObj->GetOffline();
    }
}

Here is the call graph for this function:

string hsm_FileHeader::GetOldFName ( void   )  const [inline]

Definition at line 225 of file client/hsmlist/hsm_FileHeader.h.

References m_oldFName.

Referenced by CompleteMigIsDone().

{ return m_oldFName  ;};

Here is the caller graph for this function:

string hsm_FileHeader::GetOldFName ( void   )  const [inline]

Definition at line 139 of file include/ivd/hsm_FileHeader.h.

References m_oldFName.

{ return m_oldFName  ;};

hsm_FileHeader* hsm_FileHeader::GetOldFOwner ( void   )  const [inline]

Definition at line 228 of file client/hsmlist/hsm_FileHeader.h.

References m_oldFHOwner.

{ return m_oldFHOwner;};

hsm_FileHeader* hsm_FileHeader::GetOldFOwner ( void   )  const [inline]

Definition at line 143 of file include/ivd/hsm_FileHeader.h.

References m_oldFHOwner.

{ return m_oldFHOwner;};

cmn_Path hsm_FileHeader::GetOldFullPath (  ) 

return empty path if old name not exist

Definition at line 724 of file hsm_FileHeader.cpp.

References log_FUNC_m, m_oldFHOwner, m_oldFName, MakePath(), and NULL.

Referenced by DumpListEl(), Event(), fs_api::EventMove(), FileToSeqElem(), MigCanToPreJob(), hsm_FHmigc::Migrate(), MigrationIsDone(), operator<<(), i_HSM_i::PackFile(), and ToMigCand().

                                        {
    log_FUNC_m(GetOldFullPath);
    if (m_oldFName.length() != 0) {
        if (m_oldFHOwner != NULL) {
            return m_oldFHOwner->MakePath() + m_oldFName;
        }
        else {
            return cmn_Path(m_oldFName);
        }
    }
    else {
        return cmn_Path("");
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

ivd_RecordIDX_t hsm_FileHeader::GetOldNameOwnIdx (  )  [inline]

Definition at line 188 of file client/hsmlist/hsm_FileHeader.h.

References m_oldNameOwnIdx.

Referenced by hsm_ActiveFH::Append(), and hsm_ActiveFH::Update().

{ return m_oldNameOwnIdx;};

Here is the caller graph for this function:

UInt64_t hsm_FileHeader::GetOldOwnerInode ( void   )  const

Definition at line 507 of file hsm_FileHeader.cpp.

References GetInode(), log_FUNC_m, m_oldFHOwner, and NULL.

Referenced by NewOwner().

                                                      {
    log_FUNC_m(GetOldOwnerInode);
    if (m_oldFHOwner == NULL) {
        return 0;
    }
    else {
        return m_oldFHOwner->GetInode();
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

ivd_FileID_t hsm_FileHeader::GetOldOwnFileID ( void   )  const

Definition at line 543 of file hsm_FileHeader.cpp.

References GetFileID(), log_FUNC_m, m_oldFHOwner, and NULL.

Referenced by i_HSM_i::PackFile().

                                                       {
    log_FUNC_m(GetOldOwnFileID);
    if (m_oldFHOwner == NULL) {
        return 0;
    }
    else {
        return m_oldFHOwner->GetFileID();
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

ivd_RecordIDX_t hsm_FileHeader::GetOwnDirTreeIdx (  ) 

Definition at line 2005 of file hsm_FileHeader.cpp.

References GetDirTreeIdx(), log_FUNC_m, m_FHOwner, and NULL.

Referenced by StoreNameOwnRec(), and StoreOldNameOwnRec().

                                                 {
    log_FUNC_m(GetOwnDirTreeIdx);
    if (m_FHOwner == NULL) {
        return 0;
    }
    else {
        return m_FHOwner->GetDirTreeIdx();
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

UInt64_t hsm_FileHeader::GetOwnerInode ( void   )  const

Definition at line 495 of file hsm_FileHeader.cpp.

References GetInode(), log_FUNC_m, m_FHOwner, and NULL.

Referenced by NewOwner().

                                                   {
    log_FUNC_m(GetOwnerInode);
    if (m_FHOwner == NULL) {
        return 0;
    }
    else {
        return m_FHOwner->GetInode();
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

ivd_RecordIDX_t hsm_FileHeader::GetOwnersNameOwnIdx (  ) 

Definition at line 2017 of file hsm_FileHeader.cpp.

References GetNameOwnIdx(), log_FUNC_m, m_FHOwner, and NULL.

                                                    {
    log_FUNC_m(GetOwnersNameOwnIdx);
    if (m_FHOwner == NULL) {
        return 0;
    }
    else {
        return m_FHOwner->GetNameOwnIdx();
    }
}

Here is the call graph for this function:

ivd_RecordIDX_t hsm_FileHeader::GetOwnersOldNameOwnIdx (  ) 

Definition at line 2029 of file hsm_FileHeader.cpp.

References GetNameOwnIdx(), log_FUNC_m, m_oldFHOwner, and NULL.

                                                       {
    log_FUNC_m(GetOwnersOldNameOwnIdx);
    if (m_oldFHOwner == NULL) {
        return 0;
    }
    else {
        return m_oldFHOwner->GetNameOwnIdx();
    }
}

Here is the call graph for this function:

ivd_FileID_t hsm_FileHeader::GetOwnFileID ( void   )  const

Definition at line 531 of file hsm_FileHeader.cpp.

References GetFileID(), log_FUNC_m, m_FHOwner, and NULL.

Referenced by i_HSM_i::PackFile().

                                                    {
    log_FUNC_m(GetOwnFileID);
    if (m_FHOwner == NULL) {
        return 0;
    }
    else {
        return m_FHOwner->GetFileID();
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

ivd_FS_File* hsm_FileHeader::GetRecallFile (  )  [inline]

Definition at line 244 of file client/hsmlist/hsm_FileHeader.h.

References hsm_RecallInfoGrp::m_fsFile, m_reqHeader_p, and NULL.

                                 {
        return m_reqHeader_p != NULL
            ? &m_reqHeader_p->m_fsFile
            : NULL;
    };

hsm_RecallInfoGrp* hsm_FileHeader::GetRecallInfoGrp (  )  [inline]

Definition at line 250 of file client/hsmlist/hsm_FileHeader.h.

References m_reqHeader_p.

Referenced by hsm_Recall::IsFileFromDFforRecall().

{ return m_reqHeader_p; };

Here is the caller graph for this function:

string hsm_FileHeader::GetRecallIntoName ( void   )  [inline]

Definition at line 238 of file client/hsmlist/hsm_FileHeader.h.

References ivd_FS_File::GetFullPathRef(), hsm_RecallInfoGrp::m_fsFile, m_reqHeader_p, and NULL.

Referenced by i_HSM_i::Recall().

                                   {
        return m_reqHeader_p != NULL
            ? (string)m_reqHeader_p->m_fsFile.GetFullPathRef()
            : string();
    };

Here is the call graph for this function:

Here is the caller graph for this function:

Int32_t hsm_FileHeader::GetRecallJobIdx (  )  const [inline]

Definition at line 211 of file client/hsmlist/hsm_FileHeader.h.

References hsm_RecallInfoGrp::m_jobIdx, m_reqHeader_p, and NULL.

Referenced by hsm_Recall::ProcRecBSStart(), hsm_Recall::ProcRecEmbData(), and hsm_Recall::ProcRecRawData().

                                             {
        return   m_reqHeader_p != NULL
                 ? m_reqHeader_p->m_jobIdx
                 : -1;
    };

Here is the caller graph for this function:

ivd_RecordIDX_t hsm_FileHeader::GetRecIdx ( void   )  const [inline]

Definition at line 137 of file include/ivd/hsm_FileHeader.h.

References m_idxFH.

{ return m_idxFH     ;};

UInt32_t hsm_FileHeader::GetRef ( void   )  const [inline]

be careful of using GetRef, it's not locked and now is use only in cache and JobComplete that are locked or lock fileID

Definition at line 236 of file client/hsmlist/hsm_FileHeader.h.

References m_dirMemberRef, and m_objRef.

Referenced by hsm_TimedList::Append(), and hsm_FHpVecMgr::RemoveLastButOne().

{ return m_objRef + m_dirMemberRef;};

Here is the caller graph for this function:

UInt32_t hsm_FileHeader::GetRef ( void   )  const [inline]

Return Reference counter of this FH.

Definition at line 148 of file include/ivd/hsm_FileHeader.h.

References m_objRef.

{ return m_objRef    ;};

UInt32_t hsm_FileHeader::GetShortInode (  )  const [inline]

Definition at line 202 of file client/hsmlist/hsm_FileHeader.h.

References hsm_InoObj::GetShortInode(), m_inodeObj, and NULL.

Referenced by hsm_FHcache::Insert(), hsm_FHcache::Remove(), and hsm_FHcache::RemoveLastButOne().

                                              {
        return  m_inodeObj == NULL
                ? 0
                : m_inodeObj->GetShortInode();
    };

Here is the call graph for this function:

Here is the caller graph for this function:

void hsm_FileHeader::GetValues ( UInt64_t a_inode,
string &  a_fName,
UInt64_t a_fOwner 
) const
void hsm_FileHeader::IncMemberRef (  ) 
void hsm_FileHeader::IncrRef (  ) 
void hsm_FileHeader::IncrRef (  ) 

method to increment reference to this object to know how many List records are referenced to it

Definition at line 1451 of file hsm_FileHeader.cpp.

References dbg_DETAIL, GetInode(), IVD_PRINT_ID_FS, log_DBG_m, log_FUNC_m, and m_objRef.

Referenced by hsm_TimedList::Append(), hsm_FHmigc::Append(), hsm_FHlist::Append(), hsm_FHADPRecall::Append(), hsm_JobElemVecMgr::Insert(), hsm_FHpVecMgr::Insert(), SetOldOwnFHObj(), and SetOwnFHObj().

                            {
    log_FUNC_m(IncrRef);
    m_objRef++;
    log_DBG_m(dbg_DETAIL, "Inc objRef = " << m_objRef << ". INO " << IVD_PRINT_ID_FS(GetInode()));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void hsm_FileHeader::InitActive ( ivd_RecordIDX_t  a_activeIdx,
hdb_Active_t a_activeRec,
bool  a_trigMig = false 
)

InitActiv is used only at startup to construct FH method is called by constructor of FH and directly if FH olready exist in cache NOTE only directory type FH can exist in cache.

resolve FH owner using dirNode record got from DB

Definition at line 290 of file hsm_FileHeader.cpp.

References CHG_DELETED_d, hdb_Active_t::chgFlags, ivd_FS_File::Close(), dbg_DETAIL, DecrRef(), ivd_FS_File::e_Cache, fio_Transaction::EndTransaction(), file, hdb_Active_t::fileID, hdb_Active_t::fType, g_fs_api_p, g_hsm_activeList_p, g_hsmDB_p, hdb_Active_t::generalInode, GetFileID(), ivd_FS_File::GetProperties(), ivd_FileSystemAPI::GetRootPath(), fio_DataBase::GetTransObj(), hdbReadNameOwnRec(), hsmGetDirFH(), IncMemberRef(), ivd_NULLCHK_m, IVD_PRINT_ID_FS, log_DBG_m, log_FUNC_m, m_activeIdx, ivd_FS_FileProperty_t::m_chunkSize, ivd_FS_FileProperty_t::m_dirtyFlag, m_FHOwner, ivd_FS_FileProperty_t::m_fileID, ivd_FS_FileProperty_t::m_fileSize, m_firstMigPackDone, m_fName, ivd_FS_FileProperty_t::m_Inode, m_inodeObj, m_nameOwnerChg, m_nameOwnIdx, ivd_FS_FileProperty_t::m_offlineFlag, m_oldFHOwner, m_oldFName, m_oldNameOwnIdx, ivd_FS_FileProperty_t::m_type, MakePath(), NameOwnChgGoToDirty(), hdb_DirNode_t::nameOwnIdx, NULL, ivd_FS_File::Open(), hsm_ActiveFH::Release(), fio_DataBase::ReleaseTransObj(), s_className, SetDirTreeIdx(), SetFHChgFlag(), SetInodeChgFlag(), fio_Transaction::StartTransaction(), ToMigCand(), UnSetInodeChgFlag(), and hsm_ActiveFH::Update().

Referenced by hsm_ActiveFH::ActiveToList(), and hsm_FileHeader().

                                                            {
    log_FUNC_m(InitActive);


    hdb_DirNode_t dir; // default const. it filled with zeroes
    ivd_RecordIDX_t dirTreeIdx = 0;
    hdbReadNameOwnRec(m_nameOwnIdx, dirTreeIdx, m_fName, dir);

    if (dir.nameOwnIdx != 0) { // file is not on mount point
        if (m_FHOwner == NULL) {
            m_FHOwner = hsmGetDirFH(dir);
            if (m_FHOwner != NULL) {
                m_FHOwner->DecrRef(); // now is used by this FH
            }
        }
        if (m_FHOwner != NULL) {
            m_FHOwner->SetDirTreeIdx(dirTreeIdx);
            m_FHOwner->IncMemberRef();
        }
    }

    hdb_DirNode_t oldDir;
    ivd_RecordIDX_t oldDirTreeIdx = 0;
    hdbReadNameOwnRec(m_oldNameOwnIdx, oldDirTreeIdx, m_oldFName, oldDir);

    if (oldDir.nameOwnIdx != 0) { // file is not on mount point
        if (m_oldFHOwner == NULL) {
            m_oldFHOwner = hsmGetDirFH(oldDir);
            if (m_oldFHOwner != NULL) {
                m_oldFHOwner->DecrRef(); // now is used by this FH
            }
        }
        if (m_oldFHOwner != NULL) {
            m_oldFHOwner->SetDirTreeIdx(oldDirTreeIdx);
            m_oldFHOwner->IncMemberRef();
        }
    }

    // if both idx are set then change nameOwner was perform
    m_nameOwnerChg  = m_nameOwnIdx != 0 && m_oldNameOwnIdx != 0;

    if (m_inodeObj == NULL) {

        ivd_FS_FileProperty_t fileProp;
        ivd_FS_File file(*g_fs_api_p, a_activeRec.generalInode, a_activeRec.fileID);
        try {
            //HPUX - The file needs to be opened ( to be in the kernel cache )
            file.Open(ivd_FS_File::e_Cache, g_fs_api_p->GetRootPath() + MakePath());
            file.GetProperties(fileProp);
            file.Close();
        }
        catch (ivd_SysError) {  // can't-
            log_DBG_m(dbg_DETAIL, "File is deletted.");

            a_activeRec.chgFlags |= CHG_DELETED_d;

            fileProp.m_type   = a_activeRec.fType;
            fileProp.m_Inode  = a_activeRec.generalInode;
            fileProp.m_fileID = a_activeRec.fileID;
            fileProp.m_chunkSize   = 0;
            fileProp.m_fileSize    = 0;
            fileProp.m_offlineFlag = false;
            fileProp.m_dirtyFlag   = false;
        }

        log_DBG_m(dbg_DETAIL, " CREATE InodeObj.");
        m_inodeObj = new hsm_InoObj(fileProp, a_activeRec.chgFlags);
        ivd_NULLCHK_m(m_inodeObj, hsm_InoObj::s_className);

    }
    else {
        log_DBG_m(dbg_DETAIL, " UPDATE InodeObj.");
        SetInodeChgFlag(a_activeRec.chgFlags);
    }
    log_DBG_m(dbg_DETAIL, "ActiveRec.chgFlag = " << hex << a_activeRec.chgFlags << dec
                       << "  INO " << IVD_PRINT_ID_FS(a_activeRec.generalInode)
                       << "  FileID = " << a_activeRec.fileID);

    if (a_activeRec.chgFlags & CHG_DELETED_d) {
        UnSetInodeChgFlag(0xFFFF);
        SetInodeChgFlag(CHG_DELETED_d);
        SetFHChgFlag(CHG_DELETED_d);
    }
    else {
        SetFHChgFlag(a_activeRec.chgFlags);
    }
    // can't be sure how to set m_firstMigPackDone member, so check with fileID is best
    // sometimes will lie that has been sometimes migrated.
    // this mean that some events like rename and delete will be
    // migratted even is not neccesary
    m_firstMigPackDone = GetFileID() != 0;

    if (m_activeIdx != 0) { // remove old before update new
        fio_Transaction &trans = *g_hsmDB_p->GetTransObj();
        trans.StartTransaction();
        // remove old active record
        g_hsm_activeList_p->Release(this,trans);
        m_activeIdx = a_activeIdx;
        // update on last active record if last event not delete
        if (!(a_activeRec.chgFlags & CHG_DELETED_d)) {
            g_hsm_activeList_p->Update(this,trans);
        }
        trans.EndTransaction();
        g_hsmDB_p->ReleaseTransObj(trans);
    }
    else {
        m_activeIdx = a_activeIdx;
    }

    if (a_trigMig) {
        ToMigCand();
    }
    else {
        NameOwnChgGoToDirty();
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void hsm_FileHeader::InitFromDB (  ) 

Read fileID2HSMID record and set some members.

Definition at line 412 of file hsm_FileHeader.cpp.

References hdb_file2hdbID_t::circList, clNoList, hdb_file2hdbID_t::dirTreeIdx, g_File2hdbID_p, GetFileID(), GetfType(), ift_DIR, log_FUNC_m, m_dirTreeIdx, m_file2hsmIDset, m_firstMigPackDone, m_nameOwnIdx, hsm_ListPos::m_relCandCircList, hsm_ListPos::m_relCandIdx, hdb_file2hdbID_t::nameOwnIdx, fio_RelFile::ReadRec(), and hdb_file2hdbID_t::relCandIdx.

Referenced by hsm_FileHeader().

                               {
    log_FUNC_m(InitFromDB);
    ivd_FileID_t fileID =  GetFileID();
    if (  fileID != 0 ) {    // try to get m_nameOwnIdx from DB
        m_firstMigPackDone = true;
        hdb_file2hdbID_t file2hdbID;
        g_File2hdbID_p->ReadRec(fileID, &file2hdbID);
        if (file2hdbID.circList != clNoList) {
            m_nameOwnIdx = file2hdbID.nameOwnIdx;
            m_relCandCircList   = file2hdbID.circList;
            if (GetfType() == ift_DIR) {
                m_dirTreeIdx = file2hdbID.dirTreeIdx;
            }
            else {
                m_relCandIdx = file2hdbID.relCandIdx;
            }
            // files are removed from nameOwner and fil2hsmID tables after truncation,
            // but directories are not
            if (m_nameOwnIdx > 0) {
                m_file2hsmIDset = true;
            }
        }
        // if got idx from DB then file is in release candidate list
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void hsm_FileHeader::InodeChgGoToDirty (  ) 

Definition at line 966 of file hsm_FileHeader.cpp.

References g_hsm_dirtyList_p, hsm_TimedList::GetLeastWaitTime(), log_FUNC_m, m_inodeObj, hsm_ListPos::ObjChgGoToDirty(), and hsm_InoObj::SetMigAllowedTime().

Referenced by Event().

Here is the call graph for this function:

Here is the caller graph for this function:

bool hsm_FileHeader::IsDataInPacker (  )  [inline]

Definition at line 258 of file client/hsmlist/hsm_FileHeader.h.

References hsm_InoObj::IsDataInPacker(), m_inodeObj, and NULL.

Referenced by CompleteMigIsDone().

                           { return m_inodeObj != NULL
                                    ? m_inodeObj->IsDataInPacker()
                                    : false;
    };

Here is the call graph for this function:

Here is the caller graph for this function:

bool hsm_FileHeader::IsDeleted (  ) 

Definition at line 454 of file hsm_FileHeader.cpp.

References hsm_InoObj::IsDeleted(), log_FUNC_m, m_inodeObj, and NULL.

Referenced by MakeStat(), hsm_FHmigc::Migrate(), hsm_Recall::RecallOfFileCanceled(), and TruncateFile().

                               {
    log_FUNC_m(IsDeleted);
    if (m_inodeObj != NULL) {
        return m_inodeObj->IsDeleted();
    }
    else {
        return false; // deleted file must have phantom inode object, so this is not deleted
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool hsm_FileHeader::IsDirty (  ) 

Definition at line 466 of file hsm_FileHeader.cpp.

References hsm_InoObj::IsDirty(), log_FUNC_m, m_inodeObj, and NULL.

                             {
    log_FUNC_m(IsDirty);
    if (m_inodeObj != NULL) {
        return m_inodeObj->IsDirty();
    }
    else {
        return false; // deleted file must have fantom inode object, so this is not deletted
    }
}

Here is the call graph for this function:

bool hsm_FileHeader::IsEqual ( const hsm_FileHeader a_FileHeader  )  const
cmn_Path hsm_FileHeader::MakePath ( void   ) 
cmn_Path hsm_FileHeader::MakePath (  ) 
void hsm_FileHeader::MakeStat ( ivd_FileInfo_t &  a_fInfo  ) 
void hsm_FileHeader::MakeStat ( ivd_FileInfo_t &  a_fInfo  ) 

NOTE MekeStat must be used inside try block and catch for catch(ivd_SysError &ise) exception.

Definition at line 1817 of file hsm_FileHeader.cpp.

References dbg_NORM, g_fs_api_p, GetfType(), GetInode(), ivd_FileSystemAPI::GetRootPath(), IsDeleted(), IVD_PRINT_ID_FS, log_DBG_m, log_FUNC_m, MakePath(), cmn_File::SetFullPath(), and cmn_File::StatF().

Referenced by i_HSM_i::PackFile().

                                                     {
    log_FUNC_m(MakeStat);
    if (IsDeleted()) {
        // file is deleted -> cannot get attributes
        memset(&a_fInfo, 0, sizeof(a_fInfo));
        a_fInfo.type   = GetfType();
        a_fInfo.idOnFS = GetInode();
    }
    else {
        cmn_File acctFile;
        acctFile.SetFullPath(g_fs_api_p->GetRootPath() + MakePath());
        try {
            log_DBG_m(dbg_NORM, "StatF of INO " << IVD_PRINT_ID_FS(GetInode()));
            acctFile.StatF(a_fInfo);
        }
        catch (ivd_SysError &ise) {
            log_DBG_m(dbg_NORM, "StatF failed. INO " << IVD_PRINT_ID_FS(GetInode()));
            throw;
        }
        // With STAT command it is not possible to get UInt64_t type of inode.
        // UInt64 type of inode is known just in HSM.
        a_fInfo.idOnFS = GetInode();

    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void hsm_FileHeader::MigCanToPreJob ( Int32_t  a_preJobIdx  ) 

Definition at line 1056 of file hsm_FileHeader.cpp.

References cmn_Num2Str(), dbg_NORM, eMigCndList, g_hsm_preJobList_p, hsm_InoObj::GetFileSize(), GetInode(), hsm_InoObj::GetInodeChgFlag(), GetOldFullPath(), ie_HSM_INVLIST, hsm_JobListMgr::Insert(), IVD_PRINT_ID_FS, log_DBG_m, log_FUNC_m, m_inodeObj, hsm_ListPos::m_jobElemIdx, m_jobIdx, m_list, m_nameOwnerChg, MakePath(), and hsm_ListPos::RemoveFromList().

Referenced by hsm_FHmigc::Migrate(), and hsm_FHmigc::MigrateParents().

                                                    {
    log_FUNC_m(MigCanToPreJob);
/*    log_DBG_m(dbg_DETAIL, "Mig2preJob dir entry '" << (m_fName == "" ? m_oldFName : m_fName) <<
                          "' with INO " <<
                          IVD_PRINT_ID_FS(GetInode()) <<
                          " FileID " << GetFileID() << " Type " << GetfType());
*/
    if (   m_list == eMigCndList) {
        log_DBG_m(dbg_NORM, "MigCanToPreJob: INO " << IVD_PRINT_ID_FS(GetInode())
            << " size=" << m_inodeObj->GetFileSize()
            << " chgFlag=0x" << hex << m_inodeObj->GetInodeChgFlag()
            << " path " << MakePath()
            << " old path " << GetOldFullPath());
//NEW       || (m_list == ePreJobList && m_reqHeader_p != NULL) { // in case of recall
        // do not put in list if is there because of change name/owner and is not jet migrated
        if ( !m_nameOwnerChg
           || m_jobIdx == -1) { // if job index exist then is already there
            m_jobElemIdx = g_hsm_preJobList_p->Insert(a_jobIdx, this);
            m_jobIdx     = a_jobIdx;
        }
        RemoveFromList(this);// remove after insert because of reference counter
        m_list = ePreJobList;
    }
    else {
        throw ivd_InternalError(ie_HSM_INVLIST,
            "FH must be on mig can list. Current list = " + cmn_Num2Str(m_list) , true);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void hsm_FileHeader::MigPreJobToPM ( i_JobRequest_t migElem  ) 

Definition at line 1086 of file hsm_FileHeader.cpp.

References FileToSeqElem(), log_FUNC_m, and m_list.

Referenced by hsm_FHmigc::SendToPM().

                                                          {
    log_FUNC_m(MigPreJobToPM);

    FileToSeqElem(migElem);
    m_list = eJobList;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void hsm_FileHeader::MigrationIsDone (  ) 

this method is called soon after all data is sent to packer

Definition at line 1108 of file hsm_FileHeader.cpp.

References CHG_CHGFILE_d, dbg_NORM, fio_Transaction::EndTransaction(), g_fsLog, g_hsm_activeList_p, g_hsmDB_p, GetChgFlag(), GetFileID(), hsm_InoObj::GetFileSize(), GetInode(), GetOldFullPath(), fio_DataBase::GetTransObj(), IVD_PRINT_ID_FS, log_DBG_m, log_FUNC_m, m_firstMigPackDone, m_inodeObj, m_nameOwnerChg, hsm_ListPos::m_packedInDF, MakePath(), fio_DataBase::ReleaseTransObj(), fio_Transaction::StartTransaction(), hsm_ActiveFH::Update(), and log_ivdfs::Write().

Referenced by i_HSM_i::DoMigrationJob().

                                     {
    log_FUNC_m(MigrationIsDone);
    // fix bug 871, do not un set data change bit
    // this was done because of hard-links to prevent migration of already migratted file,
    // but they are not implemented yet.
//    if (IsDataInPacker()) {
//        UnSetInodeChgFlag(CHG_DATA_d);
//    }
    /* Only change file is logged here.
       Changes regarding name are logged in fs_api class implemented into hsm_fs_api.ccp file.
       Explanation:
       Method  MigrationIsDone() could be called more times for same file and same event
       In case of rename event we got unconsistent log, because two rename logs will be written.
    */

    hsm_ChgFlag_t chgFlags = GetChgFlag();
    if (chgFlags & CHG_CHGFILE_d) {
       g_fsLog.Write(GetInode(), GetFileID(), 0, MakePath(), GetOldFullPath(), chgFlags & CHG_CHGFILE_d);
    }

    // Created files has not set fileID in DB,
    // update it now.
    if (m_firstMigPackDone) {
        log_DBG_m(dbg_NORM, "New file is migrated first time. Update fileID into HSMDB."
                         << " INO " << IVD_PRINT_ID_FS(GetInode()));
        fio_Transaction &trans = *g_hsmDB_p->GetTransObj();
        trans.StartTransaction();
        // update on last active record
        // It is good to set reserved fileID also in HSMDB
        // In case when file is deleted then HSM it knows to which fileID belongs.
        g_hsm_activeList_p->Update(this,trans);
        trans.EndTransaction();
        g_hsmDB_p->ReleaseTransObj(trans);
    }

    m_nameOwnerChg     = false;
    m_firstMigPackDone = true;
    m_packedInDF       = true;
    log_DBG_m(dbg_NORM, "MigrationIsDone: INO " << IVD_PRINT_ID_FS(GetInode())
            << ", size=" << m_inodeObj->GetFileSize()
            << ", chgFlag=0x" << hex << chgFlags
            << ", path " << MakePath()
            << ", old path " << GetOldFullPath());
}

Here is the call graph for this function:

Here is the caller graph for this function:

void hsm_FileHeader::NameOwnChgGoToDirty (  ) 

Definition at line 953 of file hsm_FileHeader.cpp.

References eNoList, ePreJobList, log_FUNC_m, m_list, and hsm_ListPos::ObjChgGoToDirty().

Referenced by Event(), and InitActive().

                                         {
    log_FUNC_m(NameOwnChgGoToDirty);

    // If object is not yet on any lists then move it on dirty
    // If file is not yet on job list then is not need to move it on the end
    // of the dirty list.
    if (m_list == eNoList || m_list > ePreJobList) {
        ObjChgGoToDirty(this);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void hsm_FileHeader::NewName ( const string &  a_name  ) 

Definition at line 1339 of file hsm_FileHeader.cpp.

References CHG_NAMEOWN_d, dbg_NORM, GetInode(), IVD_PRINT_ID_FS, log_DBG_m, log_FUNC_m, m_firstMigPackDone, m_fName, m_inodeObj, m_nameOwnerChg, m_nameOwnRW_x, m_oldFName, and hsm_InoObj::SetInodeChgFlag().

Referenced by Event(), and fs_api::EventMove().

                                                 {
    log_FUNC_m(NewName);
    cmn_WantWriteLock l(m_nameOwnRW_x);
    if (  m_firstMigPackDone  // if fresh FH then just update FH
       &&  m_oldFName.length() == 0) {
        hdb_String s(m_fName);      // swap string values and vector indeces
        m_fName    = m_oldFName;    // old name is empty, thus this clean vec idx and size
        m_oldFName = s;             //
        m_nameOwnerChg = true;
    }
    log_DBG_m(dbg_NORM, "NewName: INO " << IVD_PRINT_ID_FS(GetInode())
                        << " new name=" << a_name
                        << " current name=" << m_fName
                        << " old name=" << m_oldFName);
    m_fName     = a_name;
    m_inodeObj->SetInodeChgFlag(CHG_NAMEOWN_d);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void hsm_FileHeader::NewOwner ( hsm_FileHeader a_owner_p  ) 

Definition at line 1359 of file hsm_FileHeader.cpp.

References CHG_NAMEOWN_d, dbg_NORM, GetInode(), GetOldOwnerInode(), GetOwnerInode(), IncMemberRef(), IVD_PRINT_ID_FS, log_DBG_m, log_FUNC_m, m_FHOwner, m_firstMigPackDone, m_inodeObj, m_nameOwnerChg, m_nameOwnRW_x, m_oldFHOwner, NULL, and hsm_InoObj::SetInodeChgFlag().

Referenced by Event(), and fs_api::EventMove().

                                                       {
    log_FUNC_m(NewOwner);
    cmn_WantWriteLock l(m_nameOwnRW_x);
    if (  m_firstMigPackDone  // if fresh FH then just update FH
       &&  m_oldFHOwner == NULL) {
        m_oldFHOwner = m_FHOwner; 
        m_nameOwnerChg = true;
    }
// fix bug 478   a_owner was used to write new owner inode, but when delete occure
// new owner is NULL.
    ivd_GenInode_t newInode = a_owner_p != NULL
                            ? a_owner_p->GetInode()
                            : 0;
    log_DBG_m(dbg_NORM, "NewOwner: new ownIno=" << IVD_PRINT_ID_FS(newInode)
                        << " current ownIno=" << IVD_PRINT_ID_FS(GetOwnerInode())
                        << " old ownIno=" << IVD_PRINT_ID_FS(GetOldOwnerInode()));
    m_FHOwner   = a_owner_p;
    if (m_FHOwner != NULL) {
        m_FHOwner->IncMemberRef();
    }
    m_inodeObj->SetInodeChgFlag(CHG_NAMEOWN_d);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void hsm_FileHeader::OpenFile ( ivd_FS_File a_file,
const ivd_FS_File::ivd_FS_FileOperation_e  a_fileOp 
)

NOTE use same try catch algorith for OpenFile method as for MakeStat.

Definition at line 1846 of file hsm_FileHeader.cpp.

References dbg_NORM, g_fs_api_p, GetInode(), ivd_FileSystemAPI::GetRootPath(), IVD_PRINT_ID_FS, log_DBG_m, log_FUNC_m, MakePath(), and ivd_FS_File::Open().

Referenced by i_HSM_i::PackFile(), and TruncateFile().

                                                      {
    log_FUNC_m(OpenFile);
    try {
        a_file.Open(a_fileOp, g_fs_api_p->GetRootPath() + MakePath());
    }
    catch (ivd_SysError &ise) {
        log_DBG_m(dbg_NORM, "OpenF failed. INO " << IVD_PRINT_ID_FS(GetInode()));
        throw;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool hsm_FileHeader::operator== ( hsm_FileHeader a_fh  ) 

compare if two file headers are organicaly same have equal: name, type, inode

Definition at line 445 of file hsm_FileHeader.cpp.

References GetfType(), log_FUNC_m, m_fName, and m_inodeObj.

                                                     {
    log_FUNC_m(operator==hsm_FileHeader);
    return   (   m_fName     ==  a_fh.m_fName
             &&  GetfType()  ==  a_fh.GetfType()
             && *m_inodeObj  == *a_fh.m_inodeObj);
}

Here is the call graph for this function:

void hsm_FileHeader::QueueHL7Message ( hl7_msgType_e  a_msgType  ) 

Definition at line 2161 of file hsm_FileHeader.cpp.

References hsm_HL7MessageProxy::Append(), ClientConf_t::CfgSendHL7Messages, dbg_DETAIL, g_clientConf_p, g_hl7proxy_p, GetFullPath(), GetGidCidInfo(), ClientConf_t::GetHostnameAndPort(), log_DBG_m, log_FUNC_A_m, log_WRN_m, hsm_hl7Data_t::m_basePath, hsm_hl7Data_t::m_cid, hsm_hl7Data_t::m_fileName, hsm_hl7Data_t::m_gid, hsm_hl7Data_t::m_hostname, hsm_hl7Data_t::m_port, NULL, hsm_HL7MessageProxy::ReportInvalidHL7Configuration(), and cmn_Path::UpPath().

Referenced by CompleteMigIsDone(), and Recalled().

                                                            {

    if (g_clientConf_p->CfgSendHL7Messages) {
        log_FUNC_A_m(QueueHL7Message, a_msgType);

        cmn_Path fullPath = GetFullPath();

        hsm_hl7Data_t message;
        bool succeded = GetGidCidInfo(message.m_gid, message.m_cid, message.m_basePath, message.m_fileName);

        if (succeded) {
            g_clientConf_p->GetHostnameAndPort(fullPath, message);
            if ((message.m_hostname.empty()) || (message.m_port.empty())) {
                string gidCid = message.m_gid + "-" + message.m_cid;
                g_hl7proxy_p->ReportInvalidHL7Configuration(gidCid);
                return;
            }
            if (g_hl7proxy_p != NULL) {
                g_hl7proxy_p->Append(message, a_msgType);
            }
            else {
                log_WRN_m("Cannot queue the message, HL7 proxy is NULL!");
            }
        }
        else {
            log_DBG_m(dbg_DETAIL, "Will not send HL7 messages for non GID-CID directories: " << fullPath.UpPath());
        }
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void hsm_FileHeader::Recalled ( bool  a_succeed  ) 

this method is called after file is extracted from packer, succeed or not.

Definition at line 1711 of file hsm_FileHeader.cpp.

References hsm_FHrelc::Append(), ivd_FS_File::Close(), dbg_DETAIL, dbg_NORM, hsm_RecallInfoGrp::DumpChunks(), ivd_FS_File::e_Cache, ivd_FS_File::e_RefCount, fio_Transaction::EndTransaction(), file, g_fs_api_p, g_fsLog, g_hsm_FHCache_p, g_hsm_preJobList_p, g_hsm_relcList_p, g_hsmDB_p, hsm_InoObj::GetChnSize(), GetFileID(), GetFileSize(), GetFName(), GetInode(), ivd_FileSystemAPI::GetRootPath(), fio_DataBase::GetTransObj(), hsm_CheckFile2hsmdbRec(), ivd_FS_ERR_Reply, ivd_FS_OK_Reply, log_DBG_m, log_ERR_m, log_FUNC_m, log_WRN_m, m_fName, hsm_RecallInfoGrp::m_fsFile, m_inodeObj, hsm_RecallInfoGrp::m_jobElemIdx, hsm_RecallInfoGrp::m_jobIdx, m_nameOwnIdx, hsm_ListPos::m_relCandIdx, m_reqHeader_p, MakePath(), mt_Recall, NULL, QueueHL7Message(), hsm_JobListMgr::ReleaseElement(), fio_DataBase::ReleaseTransObj(), RemoveFromRelCandList(), hsm_FHcache::RemoveLastButOne(), SendReply(), ivd_FS_File::SetDataOnline(), ivd_FS_File::SetFullPath(), fio_Transaction::StartTransaction(), StoreNameOwnRec(), and log_ivdfs::Write().

Referenced by i_HSM_i::EfficientRecall(), hsm_Recall::FileRecalledCheck(), and i_HSM_i::Recall().

                                            {
    log_FUNC_m(Recalled);
    if (m_reqHeader_p == NULL) {
        log_ERR_m("  Recall of file " << m_fName << " has no request header set.");
        return;
    }
    UInt32_t jobIdx     = m_reqHeader_p->m_jobIdx;
    UInt32_t jobElemIdx = m_reqHeader_p->m_jobElemIdx;
    // after SendReply m_reqHeader_p is released
    if (a_succeed) {
        // SendReply need full path to open file before trig migration.
        // NOTE: File is not open for EA update, but it should be.
        // It is hard to manipulate with m_fsFile, because it is used for
        // manual recall into too. NEED redesign.
        // NOTE: concu rentmanual recall into two different places is impossible.

        m_reqHeader_p->m_fsFile.SetFullPath(g_fs_api_p->GetRootPath() + MakePath());

        ivd_FS_File file(*g_fs_api_p, g_fs_api_p->GetRootPath() + MakePath());

        // Add HL7 message to cache
        QueueHL7Message(mt_Recall);

        try {
            //HPUX - The file needs to be opened ( to be in the kernel cache )
            file.Open(ivd_FS_File::e_Cache);
            //WIN - just a dummy open used for increasing open reference counter in filter file context
            file.Open(ivd_FS_File::e_RefCount);
            m_reqHeader_p->m_fsFile.Close();
            m_reqHeader_p->m_fsFile.SetDataOnline(0, m_inodeObj->GetChnSize());
        }
        catch (ivd_SysError &ise) {
            log_DBG_m(dbg_NORM,
                "Can't set online. File is probably deleted or moved.");
            SendReply(ivd_FS_ERR_Reply);
            goto out;
        }

        ostringstream sstr;
        sstr << "Recalled. ";
        m_reqHeader_p->DumpChunks(sstr);
        g_fsLog.Write(GetInode(), GetFileID(), jobIdx, MakePath(), sstr.str().c_str());

        // NOTE! m_reqHeader_p is no more valid after SendReply() is called

        SendReply(ivd_FS_OK_Reply);
        log_DBG_m(dbg_DETAIL, "  File is SUCCESSFULY written to disk. File size = " << GetFileSize() );


        if (GetFileSize() > 0) {
            fio_Transaction &trans = *g_hsmDB_p->GetTransObj();
            trans.StartTransaction();
            if (m_relCandIdx != 0) {  // remove it form release candidate list
                RemoveFromRelCandList(trans);
            }
            else if (hsm_CheckFile2hsmdbRec(GetFileID(), this)) {
                RemoveFromRelCandList(trans);
            }

            if (m_nameOwnIdx == 0) {
                StoreNameOwnRec(trans);
            }
            // add to releaseCand list
                g_hsm_relcList_p->Append( this,
                                          false,
                                          trans);

            trans.EndTransaction();
            g_hsmDB_p->ReleaseTransObj(trans);
       }
        else {
            log_WRN_m("File size = 0. " << GetFName());
        }
    }
    else {
        SendReply(ivd_FS_ERR_Reply);
    }
out:
    // get FH from cache if its
    if (g_hsm_FHCache_p->RemoveLastButOne(this)) {
        // remove from job list, do not set IDXes cause don't exist any more
    }
    if (a_succeed) {
        // remove element with data size notification
        g_hsm_preJobList_p->ReleaseElement(jobIdx, jobElemIdx, GetFileSize());
    }
    else {
        // remove from job list
        g_hsm_preJobList_p->ReleaseElement(jobIdx, jobElemIdx);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void hsm_FileHeader::RemoveFromActiveList ( fio_Transaction a_trans  ) 

Definition at line 1951 of file hsm_FileHeader.cpp.

References dbg_DETAIL, g_hsm_activeList_p, g_NameOwner_p, log_DBG_m, log_FUNC_m, m_activeIdx, m_inodeObj, hsm_InoObj::m_lastDataUpdataInDB, m_oldFName, m_oldNameOwnIdx, hsm_ActiveFH::Release(), fio_RelFileTrans::ReleaseVectorIdx(), size, and fio_BasicString::Write2DB().

Referenced by CompleteMigIsDone().

                                                                  {
    log_FUNC_m(RemoveFromActiveList);
    if (m_activeIdx > 0) {
        m_inodeObj->m_lastDataUpdataInDB = 0;
        g_hsm_activeList_p->Release(this,a_trans);
        m_activeIdx = 0;
        if (m_oldNameOwnIdx > 0) {
            log_DBG_m(dbg_DETAIL, "Release OldNameOwnIdx " << m_oldNameOwnIdx);
            // release oldname own
            g_NameOwner_p->ReleaseVectorIdx(m_oldNameOwnIdx, 1, &a_trans);
            m_oldNameOwnIdx = 0;
        }
        ivd_RecordIDX_t idx(0);
        ivd_VectorSize_t size(0);
        m_oldFName.erase();
        m_oldFName.Write2DB(size, idx, a_trans);  // release old name
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void hsm_FileHeader::RemoveFromHSM (  ) 

Remove from HSM in case of syserror see hsm_FHdirty::TaskTime() or hsm_FileHeader::Event() NOTE!!! method doesn't remove FH from permanent release candidate list.

Definition at line 937 of file hsm_FileHeader.cpp.

References fio_Transaction::EndTransaction(), g_hsm_activeList_p, g_hsm_FHCache_p, g_hsmDB_p, fio_DataBase::GetTransObj(), m_activeIdx, hsm_ActiveFH::Release(), fio_DataBase::ReleaseTransObj(), hsm_FHcache::Remove(), hsm_ListPos::RemoveFromList(), and fio_Transaction::StartTransaction().

Referenced by hsm_FHmigc::Migrate().

Here is the call graph for this function:

Here is the caller graph for this function:

void hsm_FileHeader::RemoveFromRelCandList ( fio_Transaction a_trans  ) 

Definition at line 1942 of file hsm_FileHeader.cpp.

References g_hsm_relcList_p, log_FUNC_m, hsm_ListPos::m_relCandCircList, hsm_ListPos::m_relCandIdx, and hsm_FHrelc::Release().

Referenced by Event(), EventOffline(), Recalled(), and hsm_FHrelc::Truncate().

Here is the call graph for this function:

Here is the caller graph for this function:

void hsm_FileHeader::RemoveNameFromHSMDB ( fio_Transaction a_trans  ) 

Definition at line 1971 of file hsm_FileHeader.cpp.

References dbg_DETAIL, fio_BasicString::Dump(), g_File2hdbID_p, g_NameOwner_p, GetFileID(), log_DBG_m, log_FUNC_m, m_fName, m_nameOwnIdx, NULL, fio_RelFileTrans::ReleaseVectorIdx(), size, and fio_RelFile::WriteRec().

Referenced by CompleteMigIsDone().

                                                                 {
    log_FUNC_m(RemoveNameFromHSMDB);
    // remove it from ivd system
    if (m_nameOwnIdx > 0) {
        log_DBG_m(dbg_DETAIL, "Release NameOwnIdx " << m_nameOwnIdx);
        g_NameOwner_p->ReleaseVectorIdx(m_nameOwnIdx, 1, &a_trans);
        m_nameOwnIdx = 0;
    }
    ivd_RecordIDX_t idx(0);
    ivd_VectorSize_t size(0);
    m_fName.fio_Vector::Write2DB(NULL, size, idx, a_trans);  // release only vector from DB.
    ostringstream sstr;
    m_fName.Dump(sstr);
    log_DBG_m(dbg_DETAIL, "Release vector of file name: " << sstr.str());
    hdb_file2hdbID_t file2hdbID; // default constructor fill it with zerroes
    g_File2hdbID_p->WriteRec(GetFileID(), &file2hdbID, 1, &a_trans);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void hsm_FileHeader::ResetDataInPacker (  )  [inline]

Definition at line 254 of file client/hsmlist/hsm_FileHeader.h.

References m_inodeObj, NULL, and hsm_InoObj::ResetDataInPacker().

Referenced by CompleteMigIsDone().

Here is the call graph for this function:

Here is the caller graph for this function:

void hsm_FileHeader::SendReply ( UInt16_t  a_reply  ) 

Definition at line 1806 of file hsm_FileHeader.cpp.

References log_FUNC_m, hsm_RecallInfoGrp::m_fsFile, m_reqHeader_p, NULL, and ivd_FS_File::ReplySyncEvents().

Referenced by EventOffline(), i_HSM_i::Recall(), Recalled(), and hsm_FHADPRecall::RecallFileFromADP().

Here is the call graph for this function:

Here is the caller graph for this function:

void hsm_FileHeader::SendToPM ( UInt32_t