Re: read/write on RADOS using external buffer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Mon, 13 Sep 2010, Takuya ASADA wrote:
> I want to use external buffer in Rados::write() and Rados::read() in
> my application, I figure out the way on write() but I couldn't on
> read().
> 
> I have "char *buf" as buffer, and it's length "int len".
> On write(), I could do it like this:
>   rados.initialize(0, NULL);
>   rados.open_pool(bucket, &pool);
>   bl.push_front(ceph::buffer::create_static(len, buf));
>   rados.write_full(pool, oid, bl);
> 
> But on read(), I tried slimier code but fails:
>   r = rados.initialize(0, NULL);
>   r = rados.open_pool(bucket, &pool);
>   bl.push_front(ceph::buffer::create_static(len, buf));
>   rados.read(pool, oid, 0, bl, 0);
> 
> It seems new buffer allocated inside of read() operation, and the data
> wrote on new buffer instead of "buf".
> Where that new buffer allocated?
> And is there a way to use external buffer instead of new buffer?

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.

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.)

sage
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux