From: Josh Durgin <josh.durgin@inktank.com>
To: Sage Weil <sage@inktank.com>, Rutger ter Borg <rutger@terborg.net>
Cc: ceph-devel@vger.kernel.org
Subject: Re: [PATCH] fix librados aio read buffer handling
Date: Mon, 30 Sep 2013 15:52:08 -0700 [thread overview]
Message-ID: <524A0098.4060005@inktank.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1309300834080.12714@cobra.newdream.net>
On 09/30/2013 08:38 AM, Sage Weil wrote:
> On Mon, 30 Sep 2013, Rutger ter Borg wrote:
>>
>> Dear all,
>>
>> please find attached a patch that enables a user to pass user-owned buffers
>> into librados' aio_read. The patch (against dumpling) removes the buf and pbl
>> data members in AioCompletionImpl.
>>
>> * The 'buf' argument to read() used to be passed into AioCompletionImpl, and
>> the results would be copied back after reading. This is replaced with the
>> creation of a static buffer of that buf.
>>
>> * The pbl argument in AioCompletionImpl is removed.
>>
>> The patch is tested against an application using librados. I've assumed that
>> 'pbl' in
>>
>> aio_read( ...., pbl, )
>>
>> is allocated by the user. It may even speed things up: a buffer copy is
>> prevented.
>
> I am a little worried that one path of aio_read uses c->bl and the other
> doesn't, but that probably is no big deal provided it is noted in the
> structure definition.
It does clean up the existing usage, where the destination may be
c->buf or c->pbl though.
> My larger concern is that we're about to do some major changes in the
> messenger and other code to use splice/tee/vmsplice to avoid copies
> to/from userspace when possible. That will involve removing some of the
> currently 'use the existing buffer' code. I'm hoping it will work out
> that in the librados case we just carry the kernel pages around a bit
> longer and delay the final copy into userspace, but it's hard to say until
> the code gets written. Josh plans to start working on it this week.
>
> Josh, do you think we should apply this now or wait until we see where
> things end up?
I'm fine applying this now (with one fix). It's a nice cleanup
even if things change more soon.
For the C interface, the return value stored in the AioCompletionImpl
needs to be the length read, so the caller can tell if a short read
occurred (this is only possible when trying to read past the end of an
object). This was being set in C_aio_Ack::finish(), but was removed by
this patch.
One thing I'm not sure about is whether the bufferlist is guaranteed
not to be split anywhere in the lower levels. rados_read()
accounts for this case:
if (bl.c_str() != buf)
bl.copy(0, bl.length(), buf);
Sage, is that actually necessary?
Josh
next prev parent reply other threads:[~2013-09-30 22:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-30 10:13 [PATCH] fix librados aio read buffer handling Rutger ter Borg
2013-09-30 15:38 ` Sage Weil
2013-09-30 22:52 ` Josh Durgin [this message]
2013-09-30 23:14 ` Sage Weil
2013-11-27 8:49 ` Rutger ter Borg
2013-12-30 20:00 ` Josh Durgin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=524A0098.4060005@inktank.com \
--to=josh.durgin@inktank.com \
--cc=ceph-devel@vger.kernel.org \
--cc=rutger@terborg.net \
--cc=sage@inktank.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox