Il 21/08/2013 12:31, Charlie Shepherd ha scritto: > On 21/08/2013 10:19, Paolo Bonzini wrote: >> Il 21/08/2013 11:11, Charlie Shepherd ha scritto: >>> It still seems >>> worthwhile to me to be as efficient as possible, I guess that means >>> processing a sector's worth of metadata at a time? >> Yes, that's what my patches do. My is_allocated and flushing strategy + >> something like your replacement of cow_set_bit (just without the >> unbounded allocation) should be pretty good. >> >> Perhaps you can use a cow_co_is_allocated loop after writing the data. >> If it returns 0, you flush (the first time only) and call your >> cow_update_bitmap. Then you advance by num_same sectors and go on until >> you did all the nb_sectors. The disadvantage is that it does two reads >> (one in cow_co_is_allocated, one in cow_update_bitmap). The advantage >> is that unbounded allocation goes away because cow_co_is_allocated will >> never consider more than a sector of bitmap data. And you can reuse all >> your cow_update_bitmap code. > > Agreed. But can the two functions not share the same read data?
Yes, of course! Good idea. Paolo