On Dec 4, 2012, at 10:11 PM, David Laight <da...@l8s.co.uk> wrote: > On Tue, Dec 04, 2012 at 09:53:11PM +0100, J. Hannken-Illjes wrote: >> >> On Dec 4, 2012, at 8:10 PM, Michael van Elst <mlel...@serpens.de> wrote: >> >>> hann...@eis.cs.tu-bs.de ("J. Hannken-Illjes") writes: >>> >>>> The attached diff tries to coalesce writes to the journal in MAXPHYS >>>> sized and aligned blocks. >>> [...] >>>> Comments or objections anyone? >>> >>>> + * Write data to the log. >>>> + * Try to coalesce writes and emit MAXPHYS aligned blocks. >>> >>> Looks fine, but I would prefer the code to use an arbitrarily sized >>> buffer in case we get individual per device transfer limits. Currently >>> that size would still be MAXPHYS, but then the code could query the driver >>> for a proper size. >> >> As `struct wapbl' is per-mount and I suppose this will be per-mount-static >> it will be just a small `s/MAXPHYS/get-the-optimal-length/' as soon as >> tls-maxphys comes to head. > > Except that you want the writes to be preferably aligned to that length, > not just of that length.
That is exactly how the diff works: /* * Remaining space so this buffer ends on a MAXPHYS boundary. */ resid = MAXPHYS - dbtob(wl->wl_buffer_addr % btodb(MAXPHYS)) - wl->wl_buffer_len; aligns the end of the write to MAXPHYS. So the first write will be of size <= MAXPHYS, the following writes will be of size MAXPHYS and aligned to MAXPHYS and the last write will be of size <= MAXPHYS. -- J. Hannken-Illjes - hann...@eis.cs.tu-bs.de - TU Braunschweig (Germany)