Re: [PATCH] rd: Mark ramdisk buffers heads dirty

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Nick Piggin <nickpiggin@...>
Cc: Andrew Morton <akpm@...>, Christian Borntraeger <borntraeger@...>, <linux-mm@...>, <linux-kernel@...>, Martin Schwidefsky <schwidefsky@...>, Theodore Ts'o <tytso@...>
Date: Tuesday, October 16, 2007 - 3:06 pm

Nick Piggin <nickpiggin@yahoo.com.au> writes:


So I just took a little bit of time to look at and think about
the path you are referring to, and I don't see a problem.

The rule with the buffer dirty bit is that you first clear it
and then you submit the write.  When the write request finally
makes it's way to rd.c we copy the data if necessary and call
set_page_dirty.  Which will then mark the page and the buffer
dirty again.

In essence the ramdisk code just attempts to lock buffers in
ram by setting their dirty bit, just like we do for pages
in ramfs.

The only case where I see the dirty bit getting cleared without
submitting I/O is when dirty state doesn't matter, in which
case if we get a page full buffers all of whose data we don't care
about it is legitimate to drop the page.

As for ramdisk_writepage it probably makes sense to remove it,
as the generic code paths seem to work as well or better the
writepage method is NULL.  However if we do keep it we should call
set_page_dirty there on general principles.


I thought through the logic in try_to_free_buffers and it actually
makes sense to me now.  mark_buffer_dirty sets the page dirty bit
so dirty buffers reside on dirty pages.  When we submit I/O we
aren't guaranteed to submit all of the dirty buffers for a page
at once, so we don't clear the page dirty bit.  With the result
that we can end up with pages with the dirty bit set but all of
their buffers are clean.

Since we rather deliberately allow truly clean pages to be dropped
from the ramdisk overriding try_to_free_buffer_pages looks wrong
because then except for invalidate we can not remove buffers
from truly clean pages.


I do agree that with the amount of code duplication in the buffer
cache that locking pages into the buffer cache seems very error prone,
and difficult to maintain.  So rewriting rd.c to store it's pages
elsewhere sounds very promising.

While I can see Christian's patch as fixing the symptom.  I have
a very hard time see it as correct.  If we did something more
elaborate to replace try_to_free_buffer_pages such that
we could drop buffers from clean buffer cache pages when they
became such and so were only suppressing the drop the dirty
bit logic for pages that contain data we want to keep I would be ok
with it.    Just totally skipping buffer head freeing just feels
wrong to me.

Eric


-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH resend] ramdisk: fix zeroed ramdisk pages on memory p..., Christian Borntraeger, (Mon Oct 15, 4:28 am)
Re: [PATCH resend] ramdisk: fix zeroed ramdisk pages on memo..., Eric W. Biederman, (Mon Oct 15, 11:14 pm)
Re: [PATCH resend] ramdisk: fix zeroed ramdisk pages on memo..., Eric W. Biederman, (Tue Oct 16, 12:57 am)
[patch][rfc] rewrite ramdisk, Nick Piggin, (Tue Oct 16, 3:47 am)
Re: [patch][rfc] rewrite ramdisk, Eric W. Biederman, (Wed Oct 17, 6:30 am)
Re: [patch][rfc] rewrite ramdisk, Nick Piggin, (Wed Oct 17, 8:49 am)
Re: [patch][rfc] rewrite ramdisk, Eric W. Biederman, (Wed Oct 17, 2:45 pm)
Re: [patch][rfc] rewrite ramdisk, Nick Piggin, (Wed Oct 17, 9:06 pm)
Re: [patch][rfc] rewrite ramdisk, Theodore Tso, (Tue Oct 16, 5:28 pm)
Re: [patch][rfc] rewrite ramdisk, Nick Piggin, (Tue Oct 16, 6:08 pm)
Re: [patch][rfc] rewrite ramdisk, Eric W. Biederman, (Tue Oct 16, 7:48 pm)
Re: [patch][rfc] rewrite ramdisk, Nick Piggin, (Tue Oct 16, 8:28 pm)
Re: [patch][rfc] rewrite ramdisk, Eric W. Biederman, (Tue Oct 16, 9:13 pm)
Re: [patch][rfc] rewrite ramdisk, Nick Piggin, (Tue Oct 16, 9:47 pm)
Re: [patch][rfc] rewrite ramdisk, Eric W. Biederman, (Tue Oct 16, 5:08 am)
Re: [patch][rfc] rewrite ramdisk, Jan Engelhardt, (Tue Oct 16, 3:52 am)
Re: [patch][rfc] rewrite ramdisk, Nick Piggin, (Tue Oct 16, 4:07 am)
Re: [patch][rfc] rewrite ramdisk, Jan Engelhardt, (Tue Oct 16, 4:17 am)
Re: [patch][rfc] rewrite ramdisk, Nick Piggin, (Tue Oct 16, 4:26 am)
Re: [patch][rfc] rewrite ramdisk, Jan Engelhardt, (Tue Oct 16, 4:53 am)
Re: [PATCH resend] ramdisk: fix zeroed ramdisk pages on memo..., Christian Borntraeger, (Mon Oct 15, 5:05 am)
Re: [PATCH resend] ramdisk: fix zeroed ramdisk pages on memo..., Eric W. Biederman, (Mon Oct 15, 2:38 pm)
Re: [PATCH resend] ramdisk: fix zeroed ramdisk pages on memo..., Eric W. Biederman, (Mon Oct 15, 6:37 pm)
[PATCH] rd: Preserve the dirty bit in init_page_buffers(), Eric W. Biederman, (Mon Oct 15, 6:40 pm)
Re: [PATCH] rd: Preserve the dirty bit in init_page_buffers(), Eric W. Biederman, (Tue Oct 16, 5:35 am)
[PATCH] rd: Mark ramdisk buffers heads dirty, Eric W. Biederman, (Mon Oct 15, 6:42 pm)
Re: [PATCH] rd: Mark ramdisk buffers heads dirty, Nick Piggin, (Tue Oct 16, 4:19 am)
Re: [PATCH] rd: Mark ramdisk buffers heads dirty, Eric W. Biederman, (Tue Oct 16, 3:06 pm)
Re: [PATCH] rd: Mark ramdisk buffers heads dirty, Nick Piggin, (Tue Oct 16, 6:06 pm)
Re: [PATCH] rd: Mark ramdisk buffers heads dirty, Christian Borntraeger, (Tue Oct 16, 4:48 am)
Re: [PATCH] rd: Mark ramdisk buffers heads dirty, Christian Borntraeger, (Tue Oct 16, 3:56 am)
Re: [PATCH] rd: Mark ramdisk buffers heads dirty, Christian Borntraeger, (Wed Oct 17, 12:14 pm)
Re: [PATCH] rd: Mark ramdisk buffers heads dirty, Eric W. Biederman, (Wed Oct 17, 1:57 pm)
Re: [PATCH] rd: Mark ramdisk buffers heads dirty, Christian Borntraeger, (Wed Oct 17, 5:48 pm)
Re: [PATCH] rd: Mark ramdisk buffers heads dirty, Eric W. Biederman, (Wed Oct 17, 6:22 pm)
Re: [PATCH] rd: Mark ramdisk buffers heads dirty, Christian Borntraeger, (Thu Oct 18, 5:26 am)
Re: [PATCH] rd: Mark ramdisk buffers heads dirty, Eric W. Biederman, (Fri Oct 19, 6:46 pm)
[PATCH] rd: Use a private inode for backing storage, Eric W. Biederman, (Fri Oct 19, 6:51 pm)
Re: [PATCH] rd: Use a private inode for backing storage, Nick Piggin, (Sun Oct 21, 12:28 am)
Re: [PATCH] rd: Use a private inode for backing storage, Eric W. Biederman, (Sun Oct 21, 1:10 am)
Re: [PATCH] rd: Use a private inode for backing storage, Eric W. Biederman, (Sun Oct 21, 2:48 am)
Re: [PATCH] rd: Use a private inode for backing storage, Eric W. Biederman, (Sun Oct 21, 1:56 pm)
Re: [PATCH] rd: Use a private inode for backing storage, Christian Borntraeger, (Sun Oct 21, 3:28 am)
Re: [PATCH] rd: Use a private inode for backing storage, Eric W. Biederman, (Sun Oct 21, 4:23 am)
Re: [PATCH] rd: Use a private inode for backing storage, Eric W. Biederman, (Sun Oct 21, 2:39 pm)
Re: [PATCH] rd: Mark ramdisk buffers heads dirty, Chris Mason, (Wed Oct 17, 3:14 pm)
Re: [PATCH] rd: Mark ramdisk buffers heads dirty, Eric W. Biederman, (Wed Oct 17, 4:29 pm)
Re: [PATCH] rd: Mark ramdisk buffers heads dirty, Chris Mason, (Wed Oct 17, 4:54 pm)
Re: [PATCH] rd: Mark ramdisk buffers heads dirty, Eric W. Biederman, (Wed Oct 17, 5:30 pm)
Re: [PATCH] rd: Mark ramdisk buffers heads dirty, Chris Mason, (Wed Oct 17, 6:58 pm)
Re: [PATCH] rd: Mark ramdisk buffers heads dirty, Eric W. Biederman, (Wed Oct 17, 7:28 pm)
Re: [PATCH] rd: Mark ramdisk buffers heads dirty, Chris Mason, (Wed Oct 17, 8:03 pm)
[RFC][PATCH] block: Isolate the buffer cache in it's own map..., Eric W. Biederman, (Wed Oct 17, 11:59 pm)
Re: [RFC][PATCH] block: Isolate the buffer cache in it's own..., Eric W. Biederman, (Fri Oct 19, 5:35 pm)
Re: [RFC][PATCH] block: Isolate the buffer cache in it's own..., Eric W. Biederman, (Fri Oct 19, 5:27 pm)
Re: [RFC][PATCH] block: Isolate the buffer cache in it's own..., Eric W. Biederman, (Sun Oct 21, 12:53 am)
Re: [RFC][PATCH] block: Isolate the buffer cache in it's own..., Eric W. Biederman, (Sun Oct 21, 3:09 am)
Re: [PATCH] rd: Mark ramdisk buffers heads dirty, Eric W. Biederman, (Wed Oct 17, 11:27 pm)
Re: [PATCH] rd: Mark ramdisk buffers heads dirty, Eric W. Biederman, (Tue Oct 16, 5:22 am)