On Fri, Nov 21, 2008 at 05:50:17PM -0500, Jeff Layton wrote: > On Fri, 21 Nov 2008 14:38:18 -0600 > "Steve French" <smfrench@xxxxxxxxx> wrote: > > > Fix attached. > > > > Shaggy/Jeff/Nick etc. do you want to review/ack it since it is late in the rc? > > > > Talking with Steve on IRC, we thought it might be better to optimize > away the read when possible. I think this patch should do it. We skip > the read if the write starts past the current end of the file, or if > the offset into the page of the beginning of the write is 0 and we're > writing past the current end of the file. In those situations we just > zero out the rest of the page. > > Combined patch inlined below. I also took the liberty of adding a page > pointer to make the code look a little cleaner. > > Thoughts? You just have to be very careful when marking a page uptodate. This is why I removed that earlier hunk. 1) the actual write may not cover as much space as we were told here. 2) the page no wlooks like this I think? 0 offset+len PAGE_CACHE_SIZE |---- uninitialized data ---|---- zeroes ---| Then if you SetPageUptodate, if you are using the generic_mapping_read, it can come and read the page even without locking it. If you are not using the generic pagecache operations at all, then you could do something like this if you are careful, but it still seems a bit risky. Or am I wrong about the data being uninitialized? -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html