All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rutger ter Borg <rutger@terborg.net>
To: ceph-devel@vger.kernel.org
Subject: Re: [PATCH] fix librados aio read buffer handling
Date: Wed, 27 Nov 2013 09:49:09 +0100	[thread overview]
Message-ID: <l74blq$9ia$1@ger.gmane.org> (raw)
In-Reply-To: <524A0098.4060005@inktank.com>

[-- Attachment #1: Type: text/plain, Size: 648 bytes --]

On 2013-10-01 00:52, Josh Durgin wrote:
>
> 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.

Please find attached a revised patch against 0.72.1. I've added a fix 
for setting the return value in C_aio_Ack::finish(),

if (c->bl.length() > 0) {
   c->rval = c->bl.length();
}

Cheers,

Rutger



[-- Attachment #2: aio_read_patch_2.diff --]
[-- Type: text/x-patch, Size: 2410 bytes --]

diff -u -p ceph-0.72.1/src/librados/AioCompletionImpl.h ceph-0.72.1-patched/src/librados/AioCompletionImpl.h
--- ceph-0.72.1/src/librados/AioCompletionImpl.h	2013-11-22 10:15:58.000000000 +0100
+++ ceph-0.72.1-patched/src/librados/AioCompletionImpl.h	2013-11-25 11:32:06.178467454 +0100
@@ -39,8 +39,7 @@ struct librados::AioCompletionImpl {
 
   // for read
   bool is_read;
-  bufferlist bl, *pbl;
-  char *buf;
+  bufferlist bl;
   unsigned maxlen;
 
   IoCtxImpl *io;
@@ -54,7 +53,7 @@ struct librados::AioCompletionImpl {
 			callback_safe(0),
 			callback_complete_arg(0),
 			callback_safe_arg(0),
-			is_read(false), pbl(0), buf(0), maxlen(0),
+			is_read(false), maxlen(0),
 			io(NULL), aio_write_seq(0), aio_write_list_item(this) { }
 
   int set_complete_callback(void *cb_arg, rados_callback_t cb) {
diff -u -p ceph-0.72.1/src/librados/IoCtxImpl.cc ceph-0.72.1-patched/src/librados/IoCtxImpl.cc
--- ceph-0.72.1/src/librados/IoCtxImpl.cc	2013-11-22 10:15:58.000000000 +0100
+++ ceph-0.72.1-patched/src/librados/IoCtxImpl.cc	2013-11-25 11:40:41.952777192 +0100
@@ -570,7 +570,6 @@ int librados::IoCtxImpl::aio_operate_rea
 
   c->is_read = true;
   c->io = this;
-  c->pbl = pbl;
 
   Mutex::Locker l(*lock);
   objecter->read(oid, oloc,
@@ -612,11 +611,10 @@ int librados::IoCtxImpl::aio_read(const
 
   c->is_read = true;
   c->io = this;
-  c->pbl = pbl;
 
   Mutex::Locker l(*lock);
   objecter->read(oid, oloc,
-		 off, len, snapid, &c->bl, 0,
+		 off, len, snapid, pbl, 0,
 		 onack, &c->objver);
   return 0;
 }
@@ -632,8 +630,9 @@ int librados::IoCtxImpl::aio_read(const
 
   c->is_read = true;
   c->io = this;
-  c->buf = buf;
   c->maxlen = len;
+  c->bl.clear();
+  c->bl.push_back( buffer::create_static( len, buf ) );
 
   Mutex::Locker l(*lock);
   objecter->read(oid, oloc,
@@ -668,7 +667,6 @@ int librados::IoCtxImpl::aio_sparse_read
 
   c->is_read = true;
   c->io = this;
-  c->pbl = NULL;
 
   onack->m_ops.sparse_read(off, len, m, data_bl, NULL);
 
@@ -1179,14 +1177,9 @@ void librados::IoCtxImpl::C_aio_Ack::fin
     c->safe = true;
   c->cond.Signal();
 
-  if (c->buf && c->bl.length() > 0) {
-    unsigned l = MIN(c->bl.length(), c->maxlen);
-    c->bl.copy(0, l, c->buf);
+  if (c->bl.length() > 0) {
     c->rval = c->bl.length();
   }
-  if (c->pbl) {
-    *c->pbl = c->bl;
-  }
 
   if (c->callback_complete) {
     c->io->client->finisher.queue(new C_AioComplete(c));

  parent reply	other threads:[~2013-11-27  8:49 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
2013-09-30 23:14     ` Sage Weil
2013-11-27  8:49     ` Rutger ter Borg [this message]
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='l74blq$9ia$1@ger.gmane.org' \
    --to=rutger@terborg.net \
    --cc=ceph-devel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.