示例#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);
        }
示例#2
0
        /*
         * For a given rbn, it will load the 4k page into memory and return.
         * Also updates the queue to indicate the same.
         */
        private void load_wrbufx(int rbn)
        {
            if (GLOBALQ.WRObj[rbn].incoretbuf != null)
            {
                cachehits++;
            }
            else
            {
                WRBuf tbuf = allocate(rbn);

                mfile1.Seek((long)rbn * 4096, SeekOrigin.Begin);
                mfile1.Read(tmpiodata, 0, 4096);
                CONFIG.Decrypt_Read_WRBuf(tmpiodata, tbuf.data);

                GLOBALQ.WRObj[rbn].incoretbuf = tbuf;
                refcache[cachesize++]         = tbuf;
            }

            DoSnapshotWork(rbn);

            /* After the load, see if we have to clean up */
            if (cachesize > 15 * 1024)
            {
                internal_sync_and_flush_cache_advanced();
            }
        }
示例#3
0
        private void do_regular_dirORfile_work(UpdateReqI cu, int childcnt)
        {
            Red_Buffer wb = allocate_wb(cu.blktype);

            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 RF : " + OPS.ChecksumPageWRLoader(buffer));
                DEFS.DEBUG("CNTR", "do_regular_dirORfile_work (" + cu.tfbn + ") childcnt =" + childcnt);
            }

            wb.data_to_buf(buffer);

            REDFS_BUFFER_ENCAPSULATED wbe = new REDFS_BUFFER_ENCAPSULATED(wb);

            BLK_TYPE belowtype = BLK_TYPE.IGNORE;

            switch (cu.blktype)
            {
            case BLK_TYPE.REGULAR_FILE_L1:
                belowtype = BLK_TYPE.REGULAR_FILE_L0;
                break;

            case BLK_TYPE.REGULAR_FILE_L2:
                belowtype = BLK_TYPE.REGULAR_FILE_L1;
                break;
            }

            for (int i = 0; i < 1024; i++)
            {
                int dbnt = wbe.get_child_dbn(i);
                if (dbnt <= 0)
                {
                    continue;
                }
                apply_update_internal(dbnt, belowtype, childcnt, cu.optype, true);
            }
        }