triple allocation of large buffers.

Amin Azez azez at ufomechanic.net
Wed Jan 16 17:32:25 GMT 2008


I'm trying to avoid double and triple allocation of large buffers.

Buffers for read-requests are allocated before vfs_cifs sees the
request, pointers to these buffers are passed in smb_read structures
when the request is proxied. I think I remember that the buffer provided
by the caller is an offset in an already allocated packet response, in
order to save copying great buffers of memory all over the place.

vfs_proxy now uses rpc for passing proxied read requests in order to
easily support various compression types, and I'm wondering if this is a
bad idea...

How many copies of the RPC large data block will be allocated at once?
1. The caller to vfs_proxy pre-allocates a buffer as part of the
response packet
2. The rpc..recv will allocate some when it receives the RPC response.
3. Will the rpc struct pointer merely point to an offset in the
DATA_BLOB or will a new buffer be allocated to hold what is also in the
data blob?

I guess I will than have to memcpy from the rpc struct's pointer to the
req's allocated buffer.

The whole thing is horrible! If NDR has to unpack to a 3rd buffer then
there must be some way to hint to unpack it into the existing buffer as
part of the response packet.

But maybe all this just happens transparently anyway with normal reads
in vfs_cifs, maybe it also has to copy from the received proxy response
to the outgoing response?

Sam


More information about the samba-technical mailing list