Re: [PATCH] fs: nobh_truncate_page() fix

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Andrew Morton
Date: Monday, March 5, 2007 - 3:57 pm

On Mon, 5 Mar 2007 13:43:03 -0800 (PST)
Linus Torvalds <torvalds@linux-foundation.org> wrote:


The thing about nobh mode is that because we have no buffer_heads, we can't
track the uptodateness of sections of the page.  Hence nobh pages are
basically always uptodate.  The only place where we can tolerate partial
uptodateness is in between prepare_write and commit_write, where we omit
the initialisation of the section of the page which the caller is writing
to.

Of course, this won't perform very well with 64k pages..


nobh_prepare_write brings uptodate the sections of the page (0->from) and
(to->PAGE_CACHE_SIZE), and the nobh_prepare_write() caller brings the
(from->to) section uptodate.  So the page is uptodate at
nobh_commit_write().  It has to be, because we don't know how to bring a
non-uptodate nobh page uptodate apart from writing something to every byte
in it.


It's not really appropriate that nobh_truncate_page() call
->prepare_write() at all.  But it just happened that nobh_prepare_write()
does exactly what nobh_truncate_page() wants to do, so I just called
nobh_prepare_write() for code-sharing reasons.

Perhaps I should have called nobh_prepare_write() directly, or created some
common private function which both nobh_prepare_write() and
nobh_truncate_page() internally call.


Is OK, I think.  nobh_prepare_write() brings the outside-from-and-to
sections of the page uptodate and memset in nobh_truncate_page() brings the
rest of the page uptodate.

We bring the to->PAGE_CACHE_SIZE section uptodate twice, which could be
optimised.

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

Messages in current thread:
2.6.21-rc2-git3 Unstable for me, Will Trives, (Sun Mar 4, 9:03 pm)
Re: 2.6.21-rc2-git3 Unstable for me, Chuck Ebbert, (Mon Mar 5, 7:59 am)
Re: 2.6.21-rc2-git3 Unstable for me, Dave Kleikamp, (Mon Mar 5, 8:36 am)
Re: 2.6.21-rc2-git3 Unstable for me, Dave Kleikamp, (Mon Mar 5, 8:50 am)
[PATCH] fs: nobh_truncate_page() fix, Dave Kleikamp, (Mon Mar 5, 1:58 pm)
Re: [PATCH] fs: nobh_truncate_page() fix, Linus Torvalds, (Mon Mar 5, 2:43 pm)
Re: 2.6.21-rc2-git3 Unstable for me, Will Trives, (Mon Mar 5, 3:25 pm)
Re: [PATCH] fs: nobh_truncate_page() fix, Andrew Morton, (Mon Mar 5, 3:57 pm)
Re: [PATCH] fs: nobh_truncate_page() fix, Dave Kleikamp, (Mon Mar 5, 4:02 pm)
Re: [PATCH] fs: nobh_truncate_page() fix, Dave Kleikamp, (Mon Mar 5, 4:10 pm)
Re: [PATCH] fs: nobh_truncate_page() fix, Andrew Morton, (Mon Mar 5, 4:31 pm)