]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librados: only request ack if AioComplete has an ack callback
authorSage Weil <sage@redhat.com>
Thu, 22 Sep 2016 15:07:32 +0000 (11:07 -0400)
committerSage Weil <sage@redhat.com>
Thu, 22 Sep 2016 18:35:28 +0000 (14:35 -0400)
Probalby no librados users are actually using the ack callback, but we are
still requesting an ack message from the OSD.  Only request it if the
AioCompletion has a callback defined for it.

This might make users who are no setting the callback but are install
polling the completion or using wait_for_complete() unhappy, but I don't
think they actually exist.  And even if they do, they are highly unlikely
to notice the difference given the way the OSDs are implemented.

Signed-off-by: Sage Weil <sage@redhat.com>
src/librados/AioCompletionImpl.h
src/librados/IoCtxImpl.cc

index 982f2bd7eee17ab94cc8f3355db04490cd99dba7..c8b570d1be41c17e32c4cc6784543eec2612ea30 100644 (file)
@@ -59,6 +59,10 @@ struct librados::AioCompletionImpl {
                        is_read(false), blp(nullptr), out_buf(nullptr),
                        io(NULL), aio_write_seq(0), aio_write_list_item(this) { }
 
+  bool wants_ack() {
+    return is_read || callback_complete;
+  }
+
   int set_complete_callback(void *cb_arg, rados_callback_t cb) {
     lock.Lock();
     callback_complete = cb;
index 1b29d1eeea87894960c6ad2f558da702d19a5bbd..001ce41837114330ea6d56f413f48764b7b4a25e 100644 (file)
@@ -766,7 +766,7 @@ int librados::IoCtxImpl::aio_operate(const object_t& oid,
   if (snap_seq != CEPH_NOSNAP)
     return -EROFS;
 
-  Context *onack = new C_aio_Ack(c);
+  Context *onack = c->wants_ack() ? new C_aio_Ack(c) : NULL;
   Context *oncommit = new C_aio_Safe(c);
 
   c->io = this;
@@ -874,7 +874,7 @@ int librados::IoCtxImpl::aio_write(const object_t &oid, AioCompletionImpl *c,
   if (snap_seq != CEPH_NOSNAP)
     return -EROFS;
 
-  Context *onack = new C_aio_Ack(c);
+  Context *onack = c->wants_ack() ? new C_aio_Ack(c) : NULL;
   Context *onsafe = new C_aio_Safe(c);
 
   c->io = this;
@@ -900,7 +900,7 @@ int librados::IoCtxImpl::aio_append(const object_t &oid, AioCompletionImpl *c,
   if (snap_seq != CEPH_NOSNAP)
     return -EROFS;
 
-  Context *onack = new C_aio_Ack(c);
+  Context *onack = c->wants_ack() ? new C_aio_Ack(c) : NULL;
   Context *onsafe = new C_aio_Safe(c);
 
   c->io = this;
@@ -927,7 +927,7 @@ int librados::IoCtxImpl::aio_write_full(const object_t &oid,
   if (snap_seq != CEPH_NOSNAP)
     return -EROFS;
 
-  Context *onack = new C_aio_Ack(c);
+  Context *onack = c->wants_ack() ? new C_aio_Ack(c) : NULL;
   Context *onsafe = new C_aio_Safe(c);
 
   c->io = this;
@@ -958,7 +958,7 @@ int librados::IoCtxImpl::aio_writesame(const object_t &oid,
   if (snap_seq != CEPH_NOSNAP)
     return -EROFS;
 
-  Context *onack = new C_aio_Ack(c);
+  Context *onack = c->wants_ack() ? new C_aio_Ack(c) : NULL;
   Context *onsafe = new C_aio_Safe(c);
 
   c->io = this;
@@ -982,7 +982,7 @@ int librados::IoCtxImpl::aio_remove(const object_t &oid, AioCompletionImpl *c)
   if (snap_seq != CEPH_NOSNAP)
     return -EROFS;
 
-  Context *onack = new C_aio_Ack(c);
+  Context *onack = c->wants_ack() ? new C_aio_Ack(c) : NULL;
   Context *onsafe = new C_aio_Safe(c);
 
   c->io = this;