Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 Dec 2005 09:37:43 +0800
From:      Bowen Zhou <zhou.bowen@gmail.com>
To:        Andrey Simonenko <simon@comsys.ntu-kpi.kiev.ua>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Object reusement implementation in 6.0release: HELP Wanted!!!
Message-ID:  <821419ca0512081737j1e2f1186r9931b747f1dc0691@mail.gmail.com>
In-Reply-To: <20051208120001.GA921@pm513-1.comsys.ntu-kpi.kiev.ua>
References:  <821419ca0512072329q4ad120c5g367dd2192b91eccd@mail.gmail.com> <20051208120001.GA921@pm513-1.comsys.ntu-kpi.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help

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 <simon@comsys.ntu-kpi.kiev.ua> 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?
>


Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?821419ca0512081737j1e2f1186r9931b747f1dc0691>