On Tue, Aug 28, 2012 at 04:23:31PM +0200, Paolo Bonzini wrote: > Il 28/08/2012 15:37, Stefan Hajnoczi ha scritto: > >> > The "right fix" would not be much more complex though, something like > >> > this, right? > >> > (untested). > > Yes but it's more complicated. To do a really good job we should > > slice off the first/last clusters if they are unaligned, handle them > > like regular allocating writes, and handle the middle of the request > > as a zero write. > > > > I decided to do the simplest implementation since this scenario only > > occurs in test cases, not real guests. > > Yes, I was curious because it reminded me of the patch I did to write > zeroes when I was playing with discard to avoid the large bounce buffer > in qed_aio_write_inplace. That patch takes care of processing clusters > one by one (though that means one L2 write for each and every cluster, > not just the first and last). > > It probably causes a performance hit, but anyway I attach it for > completeness.
Thanks for sharing. I think this patch could be used as the basis for something that handles the first and last clusters one-at-a-time and does the middle clusters in a single L2 update. I'm not going to implement that right now because I prefer the simple solution unless this code path becomes more used. Stefan