Re: ufs & buffer cache - request for comments

Jakub Jelinek (jj@sunsite.ms.mff.cuni.cz)
Mon, 11 Jan 1999 10:26:09 +0100 (CET)


>
> @@ -360,14 +360,20 @@
> if (result) {
> for (i = 0; i < oldcount; i++) {
> bh = bread (sb->s_dev, tmp + i, sb->s_blocksize);
> - mark_buffer_clean (bh);
> - bh->b_blocknr = result + i;
> - mark_buffer_dirty (bh, 0);
> + bh2 = getblk (sb->s_dev, result + i, sb->s_blocksize);
> + memset (bh2->b_data, 0, sb->s_blocksize);
> + swap_buffers(bh, bh2);
> + mark_buffer_dirty (bh, 1);
> + mark_buffer_uptodate (bh2, 1);
> + mark_buffer_dirty (bh2, 1);
> if (IS_SYNC(inode)) {
> ll_rw_block (WRITE, 1, &bh);
> wait_on_buffer (bh);
> + ll_rw_block (WRITE, 1, &bh2);
> + wait_on_buffer (bh2);
> }
> brelse (bh);
> + brelse (bh2);
> }

I mean you don't need to clear the old location (so the memset (bh2...) is
redundant), you don't clear blocks when you delete a file, so you don't need
to clear blocks when you move fragments.
I think mark_buffer_clean (bh) (after swap_buffers, ie. the old bh2) should
be well sufficient (and faster).

Cheers,
Jakub
___________________________________________________________________
Jakub Jelinek | jj@sunsite.mff.cuni.cz | http://sunsite.mff.cuni.cz
Administrator of SunSITE Czech Republic, MFF, Charles University
___________________________________________________________________
UltraLinux | http://ultra.linux.cz/ | http://ultra.penguin.cz/
Linux version 2.2.0-pre6 on a sparc64 machine (3958.37 BogoMips)
___________________________________________________________________

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/