/*
         * Need to look up refcount file/bitmap file.
         */
        private void clean_clog_file_P2(string input, string output)
        {
            DEFS.DEBUG("DEDUPE", "Starting clog P2");

            Item fp = new fingerprintCLOG(DEDUP_SORT_ORDER.UNDEFINED_PLACEHOLDER);

            byte[] buffer = new byte[fp.get_size()];

            FileStream fsrc  = new FileStream(input, FileMode.Open);
            FileStream fdest = new FileStream(output, FileMode.Create);

            long count = fsrc.Length / fp.get_size();
            int  final = 0;

            for (int i = 0; i < count; i++)
            {
                fsrc.Read(buffer, 0, fp.get_size());
                fp.parse_bytes(buffer, 0);

                fingerprintCLOG fpt = (fingerprintCLOG)fp;

                if (REDDY.ptrRedFS != null && REDDY.ptrRedFS.is_block_free(fpt.dbn))
                {
                    continue;
                }

                fdest.Write(buffer, 0, fp.get_size());
                final++;
            }
            fsrc.Close();
            fdest.Flush();
            fdest.Close();
            DEFS.DEBUG("DEDUPE", "Finished clog P2, count = " + count + " to " + final);
        }
        /*
         * Remove duplicate ino, fbn entries. keep the lastest one always
         */
        private void clean_clog_file_P1(string input, string output)
        {
            DEFS.DEBUG("DEDUPE", "Starting clog P1");

            Item fp       = new fingerprintCLOG(DEDUP_SORT_ORDER.UNDEFINED_PLACEHOLDER);
            int  last_ino = 0;
            int  last_fbn = 0;

            byte[] buffer = new byte[fp.get_size()];

            FileStream fsrc  = new FileStream(input, FileMode.Open);
            FileStream fdest = new FileStream(output, FileMode.Create);

            long count = fsrc.Length / fp.get_size();
            int  final = 0;

            for (int i = 0; i < count; i++)
            {
                fsrc.Read(buffer, 0, fp.get_size());
                fp.parse_bytes(buffer, 0);

                fingerprintCLOG fpt = (fingerprintCLOG)fp;
                if (fpt.inode == last_ino && fpt.fbn == last_fbn)
                {
                    continue;
                }
                fdest.Write(buffer, 0, fp.get_size());
                last_ino = fpt.inode;
                last_fbn = fpt.fbn;
                final++;
            }
            fsrc.Close();
            fdest.Flush();
            fdest.Close();
            DEFS.DEBUG("DEDUPE", "Finished clog P1, count = " + count + " to " + final);
        }