Exemplo n.º 1
0
        private void do_inode_refupdate_work(UpdateReqI cu, int childcnt)
        {
            byte[] buffer = new byte[4096];

            lock (tfile0)
            {
                tfile0.Seek((long)cu.tfbn * 4096, SeekOrigin.Begin);
                tfile0.Read(tmpiodatatfileR, 0, 4096);
                CONFIG.Decrypt_Read_WRBuf(tmpiodatatfileR, buffer);
                //DEFS.DEBUG("ENCY", "READ inoLo : " + OPS.ChecksumPageWRLoader(buffer));
                DEFS.DEBUG("CNTR", "do_inode_refupdate_work (" + cu.tfbn + ") childcnt =" + childcnt);
            }

            /*
             * Parent of inowip is always -1.
             */
            RedFS_Inode wip = new RedFS_Inode(WIP_TYPE.REGULAR_FILE, 0, -1);

            byte[] buf = new byte[128];

            for (int i = 0; i < 32; i++)
            {
                for (int t = 0; t < 128; t++)
                {
                    buf[t] = buffer[i * 128 + t];
                }
                wip.parse_bytes(buf);

                BLK_TYPE type   = BLK_TYPE.IGNORE;
                int      numidx = 0;

                switch (wip.get_inode_level())
                {
                case 0:
                    type   = BLK_TYPE.REGULAR_FILE_L0;
                    numidx = OPS.NUML0(wip.get_filesize());
                    break;

                case 1:
                    type   = BLK_TYPE.REGULAR_FILE_L1;
                    numidx = OPS.NUML1(wip.get_filesize());
                    break;

                case 2:
                    type   = BLK_TYPE.REGULAR_FILE_L2;
                    numidx = OPS.NUML2(wip.get_filesize());
                    break;
                }

                for (int x = 0; x < numidx; x++)
                {
                    int dbn = wip.get_child_dbn(x);
                    //if (dbn <= 0) continue;
                    DEFS.DEBUGCLR("^^^^^", "wip[" + x + "] " + dbn + "," + wip.get_wiptype() + "," + childcnt + " fsize = " + wip.get_filesize());
                    DEFS.DEBUGCLR("@@@", wip.get_string_rep2());
                    apply_update_internal(dbn, type, childcnt, cu.optype, true);
                }
            }
            OPS.dump_inoL0_wips(buffer);
        }
Exemplo n.º 2
0
        public void remove_ondisk_data2()
        {
            open_file(false);
            touch();

            if (m_state == FILE_STATE.FILE_DELETED)
            {
                return;
            }
            m_state = FILE_STATE.FILE_DELETED;

            DEFS.ASSERT(_mywip != null, "Cannot be null in remove() after calling open()");


            lock (this)
            {
                lock (REDDY.FSIDList[m_associated_fsid])
                {
                    DEFS.ASSERT(_mywip != null, "Unmount couldnt have worked on this");
                    RedFS_Inode inowip = REDDY.FSIDList[m_associated_fsid].get_inode_file_wip("DF:" + m_name);

                    //REDDY.ptrRedFS.sync(_mywip);
                    REDDY.ptrRedFS.flush_cache(_mywip, false);
                    REDDY.ptrRedFS.redfs_delete_wip(m_associated_fsid, _mywip, true);

                    DEFS.ASSERT(_mywip.get_filesize() == 0, "After delete, all the wip contents must be cleared off");
                    for (int i = 0; i < 16; i++)
                    {
                        DEFS.ASSERT(_mywip.get_child_dbn(i) == DBN.INVALID, "dbns are not set after delete wip " +
                                    i + "  " + _mywip.get_child_dbn(i));
                    }
                    OPS.CheckinZerodWipData(inowip, m_inode);
                    REDDY.FSIDList[m_associated_fsid].sync_internal();

                    _mywip = null;
                }
            }
            DEFS.DEBUG("IFSD", "<<<< DELETED FILE >>>> " + m_name);
        }
Exemplo n.º 3
0
        public static bool Checkout_Wip2(RedFS_Inode inowip, RedFS_Inode mywip, int m_ino)
        {
            WIP_TYPE oldtype = mywip.get_wiptype();

            for (int i = 0; i < 16; i++)
            {
                DEFS.ASSERT(mywip.get_child_dbn(i) == DBN.INVALID, "Wip cannot be valid during checkout, " +
                            i + " value = " + mywip.get_child_dbn(i));
            }
            long fileoffset = m_ino * 128;

            lock (inowip)
            {
                REDDY.ptrRedFS.redfs_read(inowip, fileoffset, mywip.data, 0, 128);
                if (oldtype != WIP_TYPE.UNDEFINED)
                {
                    mywip.set_wiptype(oldtype);
                }
            }
            DEFS.DEBUG("CO_WIP", mywip.get_string_rep2());
            return(mywip.verify_inode_number());
        }