public void sync() { lock (this) { if (_mywip != null) { lock (REDDY.FSIDList[m_associated_fsid]) { RedFS_Inode inowip = REDDY.FSIDList[m_associated_fsid].get_inode_file_wip("GC"); DEFS.DEBUG("SYNC", "CFile (" + m_inode + ") -mywip.size = " + _mywip.get_filesize()); REDDY.ptrRedFS.sync(_mywip); OPS.Checkin_Wip(inowip, _mywip, m_inode); _mywip.is_dirty = false; REDDY.FSIDList[m_associated_fsid].sync_internal(); REDDY.ptrRedFS.redfs_commit_fsid(REDDY.FSIDList[m_associated_fsid]); } } else { DEFS.DEBUG("FSID", "inserted/unsyncd : " + m_name); } } }
void CInode.unmount(bool inshutdown) { long curr = DateTime.Now.ToUniversalTime().Ticks; int seconds = (int)((curr - creation_time) / 10000000); DEFS.DEBUG("UNMOUNT", "CFile (" + m_inode + ") umnount : " + m_name + " inshutdown flag = " + inshutdown + " is _mywip null = " + (_mywip == null) + " secs = " + seconds); if (inshutdown == false && timeoutcheck() == false && m_state == FILE_STATE.FILE_IN_DOKAN_IO) { return; } /* * We cannot unmount a dirty wip directly, it must first be cleaned, so we * dont do this here. The next sync iteration will clean the wip, and then * we are good to unmount. If we are being shutdown, then we sync() here itself. */ if ((inshutdown == false) && ((_mywip == null)))// || _mywip.is_dirty == false)) { DEFS.ASSERT(m_state != FILE_STATE.FILE_IN_DOKAN_IO, "Cannot be dokan io when _mywip = NULL"); return; } /* * _mywip is not null and dirty, or we are shutting down. */ lock (this) { DEFS.ASSERT(m_state != FILE_STATE.FILE_ORPHANED, "We are in sync path can cannot have an orphaned file"); if (_mywip != null) { REDDY.ptrRedFS.sync(_mywip); REDDY.ptrRedFS.flush_cache(_mywip, inshutdown); } lock (REDDY.FSIDList[m_associated_fsid]) { if (_mywip != null) { RedFS_Inode inowipX = REDDY.FSIDList[m_associated_fsid].get_inode_file_wip("Umount file iwp:" + m_name); OPS.Checkin_Wip(inowipX, _mywip, m_inode); DEFS.ASSERT(m_state != FILE_STATE.FILE_DELETED, "Wrong state detected222!"); REDDY.FSIDList[m_associated_fsid].sync_internal(); REDDY.FSIDList[m_associated_fsid].set_dirty(true); _mywip = null; } m_state = FILE_STATE.FILE_UNMOUNTED; } } }