lkml.org 
[lkml]   [2000]   [Sep]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From



On Sat, 2 Sep 2000, Linus Torvalds wrote:

> You don't actually have to be smart.
>
> There's a really simple way to avoid this: compare the thing you're going
> to zero out against zero before you memset() it to zero. If it was already
> zero, you just unlock the page and release.
>
> Downside: you have to read the page in, in order to compare. However, this
> turns out to be a non-issue: if there were no blocks on that page (like a
> forward truncate) this ends up generating no IO anyway. If there _were_
> blocks on the page, it's likely that one of them was the one we're going
> to partially clear anyway, so the "prepare_write()" would have had to read
> it in anyway.
>
> Upside: you don't need to mark it dirty unnecessarily, assuming you just
> extended the file. No extra allocation, and no extra write to disk.
>
> Comments? Basically the "grab_cache_page()" would be a "read_cache_page()"
> instead with all the wait-on-page etc stuff.

Works for me. However, that way it looks like a fs/buffer.c fodder.
Mind if I just call it block_zero_page(page, from, to) and export it?

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

\
 
 \ /
  Last update: 2005-03-22 12:39    [W:0.092 / U:19.716 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site