[OpenAFS-devel] how does fileserver read from disk?

chas williams - CONTRACTOR chas@cmf.nrl.navy.mil
Fri, 16 Sep 2005 08:42:49 -0400


In message <6E0E8B0D-4DAF-445C-959C-3E9B212EF35D@e18.physik.tu-muenchen.de>,Roland Kuhn writes:
>Why can't this be replaced by read(big segment)->buffer->sendmsg(small  
>segments). AFAIK readv() is implemented in terms of read() in the  
>kernel for almost all filesystems, so it should really only have the  
>effect of making the disk transfer more efficient. The msg headers  
>interspersed with the data have to come from userspace in any case,  
>right?

no reason you couldnt do this i suppose.  you would need twice the
number of entries in the iovec though.  you would need a special version
of rx_AllocWritev() that only allocated packet headers and chops up a
buffer you pass in.

curious, i rewrote rx_FetchData() to read into a single buffer and then
memcpy() into the already allocated rx packets.  this had no impact on
performance as far as i could tell (my typical test read was a 16k read
split across 12/13 rx packets).  the big problem with iovec is not iovec
really but rather than you only get 1k for each rx packet you process.
it quite a bit of work to handle an rx packet.  (although if your lower
level disk driver didnt support scatter/gather you might seem some
benefit from this).