During a write, if there is no more buffer space for the user data,
return the amount that was written instead of waiting until there
is free space. If nothing has been written yet, then block as before.
This solves a deadlock that occurs if the user data is too large to
fit in the available buffer: the write thread will block before any
data is added to the write queue, leaving no possibility that more
buffers will free up when they are ACKed (since they have not yet been
sent). The write thread will then block forever and hold all of the
buffers.
This was fixed by duplicating most of the IOB interfaces: The versions that waited are still present (like iob_alloc()), but now there are non-waiting verisons of the same interfaces (like iob_tryalloc()). The TCP read-ahead logic now uses only these non-waiting interfaces.