Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] librados: support copy-less writes in librados C API #12216

Closed

Conversation

branch-predictor
Copy link
Contributor

@branch-predictor branch-predictor commented Nov 29, 2016

These commits introduce rados_write2(), rados_write_full2(), rados_writesame2(), rados_append2() and rados_setxattr2(), rados_aio_write2(), rados_aio_write_full2(), rados_aio_writesame2(), rados_aio_append2() and rados_aio_setxattr2() which do not copy user buffers into temporary bufferptrs, reducing memory and CPU usage, at expense of requiring that provided buffers don't change through entire write/append. Otherwise these "2" function perform exactly like their non-"2" equivalents.

Signed-off-by: Piotr Dałek git@predictor.org.pl

@mattbenjamin
Copy link
Contributor

Looks like a good thing (tm).

This commit introduces rados_write2(), rados_write_full2(),
rados_writesame2(), rados_append2() and rados_setxattr2() which
do not copy user buffers into temporary bufferptrs, reducing
memory and CPU usage, at expense of requiring that provied
buffers don't change through entire write/append, which
should perform synchronously anyway. Otherwise these "2"
function perform as their non-"2" equivalents.

Signed-off-by: Piotr Dałek <git@predictor.org.pl>
This commit introduces rados_aio_write2(), rados_aio_write_full2(),
rados_aio_writesame2(), rados_aio_append2() and rados_aio_setxattr2()
which do not copy user buffers into temporary bufferptrs, reducing
memory and CPU usage, at expense of requiring that provied
buffers don't change through entire write/append. Otherwise these "2"
function perform as their non-"2" equivalents.

Signed-off-by: Piotr Dałek <git@predictor.org.pl>
@branch-predictor branch-predictor changed the title [RFC] librados: support copy-less writes in sync i/o in C API [RFC] librados: support copy-less writes in librados C API Nov 29, 2016
@yuyuyu101
Copy link
Member

great!

@yuyuyu101
Copy link
Member

I'm not sure "2" is a good idea to indicate this?

@branch-predictor
Copy link
Contributor Author

branch-predictor commented Nov 30, 2016 via email

Copy link
Contributor

@adamemerson adamemerson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a valuable contribution. If we are going to have a C API to librados at all, it should be possible to use it efficiently.

* @returns 0 on success, negative error code on failure
*/
CEPH_RADOS_API int rados_write2(rados_ioctx_t io, const char *oid,
char *buf, size_t len, uint64_t off);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps rados_write_nc would be more obvious.

bufferlist bl;
bufferptr bp = buffer::create_static(len, buf);
bl.push_back(bp);
int retval = ctx->write(oid, bl, len, off);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks competently done and reasonable.

@cholcombe973
Copy link
Contributor

I'll add these to the Rust bindings as soon as they land. Nice work!

@dillaman
Copy link

Probably need to ensure that this won't hit the same messenger race condition that was pointed out here [1]

[1] yuyuyu101@794b49b

@liewegas liewegas self-requested a review January 11, 2017 18:03
@liewegas liewegas self-assigned this Jan 11, 2017
@liewegas liewegas added the DNM label Dec 29, 2017
@stale
Copy link

stale bot commented Oct 18, 2018

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you are a maintainer or core committer, please follow-up on this issue to identify what steps should be taken by the author to move this proposed change forward.
If you are the author of this pull request, thank you for your proposed contribution. If you believe this change is still appropriate, please ensure that any feedback has been addressed and ask for a code review.

@stale stale bot added the stale label Oct 18, 2018
@mattbenjamin
Copy link
Contributor

@adamemerson should this be stale?

@stale stale bot removed the stale label Oct 18, 2018
@adamemerson
Copy link
Contributor

@branch-predictor Is this something we still need/was there something blocking this moving forward, or just in need of review/testing?

@dillaman
Copy link

@adamemerson See my comment above -- if you pass wrapped memory pointers and those pointers get stuck in the messenger layer, boom.

@stale
Copy link

stale bot commented Dec 17, 2018

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you are a maintainer or core committer, please follow-up on this issue to identify what steps should be taken by the author to move this proposed change forward.
If you are the author of this pull request, thank you for your proposed contribution. If you believe this change is still appropriate, please ensure that any feedback has been addressed and ask for a code review.

@stale
Copy link

stale bot commented Apr 22, 2019

This pull request has been automatically closed because there has been no activity for 90 days. Please feel free to reopen this pull request (or open a new one) if the proposed change is still appropriate. Thank you for your contribution!

@stale stale bot closed this Apr 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants