Thanks for concerning my question.

I need to clean all the data blocks of a inode, including direct disk
blocks, indirect disk blocks and external attributes blocks.

I have tried to insert cleaning code into
ffs_blkfree(/ufs/ffs/ffs_alloc.c), but the result was not good enough.
After compiled the kernel(GENERIC) with my cleaning code and restarted
the computer, I found that some data blocks of normal files which have
not been deleted yet disappeared randomly.

The following is the code I have inserted into ffs_blkfree(including
the beginning part of the original function):

void
ffs_blkfree(ump, fs, devvp, bno, size, inum)
        struct ufsmount *ump;
        struct fs *fs;
        struct vnode *devvp;
        ufs2_daddr_t bno;
        long size;
        ino_t inum;
{
        struct cg *cgp;
        struct buf *bp;
        struct buf *bp1;
        ufs1_daddr_t fragno, cgbno;
        ufs2_daddr_t cgblkno;
        int i, cg, blk, frags, bbase;
        u_int8_t *blksfree;
        struct cdev *dev;

        /*object reuse starts here.*/
        if(bread(devvp, fsbtodb(fs, bno), size, NOCRED, &bp1)){
                brelse(bp1);
                return;
                }
        bzero(bp1->b_data, size);
        bdwrite(bp1);
        /*object reuse ends here.*/
....

I guess there are errors in either my cleaning code or the place I
inserted these code.

Any suggestion is welcome.

On 12/8/05, Andrey Simonenko <[EMAIL PROTECTED]> wrote:
> On Thu, Dec 08, 2005 at 03:29:07PM +0800, Bowen Zhou wrote:
> > hello, everyone.
> >
> > I need solutions to implement object reusement in FreeBSD6.0.
> >
> > What I want to do is to clean the content of data blocks before the
> > re-allocation of them.
> >
> > Then where (in which function ) should I insert my cleaning code in order to
> > fulfill the reusement of data blocks?
>
> About which datablock are you asking?
>
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to