On Wed, 15 Sep 2010, Takuya ASADA wrote:
> Hi,
>
> > There currently isn't a way to use a preallocated buffer for reads. The
> > incoming data is read into a buffer allocated low in the stack by the
> > messaging layer. The bufferlist& ref is really a handle for the caller to
> > get at the buffers; any prior contents are discarded.
>
> I understood.
> So that allocated inside SimpleMessenger::Pipe::read_message(), right?
>
> > This is something that could be changed, but it will require an additional
> > messenger callback so that the upper layers can provide the buffer to read
> > the data into. (That is what the kernel implementation does.)
>
> Well, could you tell me where can I find that callback code?
> In fs/ceph/messenger.c?
> I'd like to look into it.
Yeah, it's the alloc_msg callback in struct ceph_connection_operations.
You'll find implementations in {osd,mon,mds}_client.c. The message header
is passed as an argument, which includes message payload sizes as well as
a tid (request/transaction id) to (say) look up the request the response
is for.
sage