Re: Linux-2.2.4 testpatch..

Andrea Arcangeli (andrea@e-mind.com)
Wed, 24 Mar 1999 20:53:31 +0100 (CET)


On Wed, 24 Mar 1999, Linus Torvalds wrote:

>The problem is that _while_ the buffer is on the free list, it has a
>non-zero count.

OK.

>But think about what happens if somebody needs more memory in the
>meantime. The page freeing logic will refuse to touch any buffers that are

Ahh I see the point, right. Thanks for the clear explanation.

I think a better approch is this:

Index: fs/buffer.c
===================================================================
RCS file: /var/cvs/linux/fs/buffer.c,v
retrieving revision 1.1.2.31
diff -u -r1.1.2.31 buffer.c
--- buffer.c 1999/03/24 19:46:25 1.1.2.31
+++ linux/fs/buffer.c 1999/03/24 19:48:21
@@ -1439,7 +1439,7 @@
* Can the buffer be thrown out?
*/
#define BUFFER_BUSY_BITS ((1<<BH_Dirty) | (1<<BH_Lock) | (1<<BH_Protected))
-#define buffer_busy(bh) ((bh)->b_count || ((bh)->b_state & BUFFER_BUSY_BITS))
+#define buffer_busy(bh) (((bh)->b_count || ((bh)->b_state & BUFFER_BUSY_BITS)) && (bh)->b_dev != B_FREE)

/*
* try_to_free_buffers() checks if all the buffers on this particular page

I think it's cleaner as design consider garbage everything that is on the
freelist since we reinitialize everything when we get a page from such
list.

Andrea Arcangeli

-
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/