|
|
545b23 |
From 7ccb4ae63d3ae885e1c7e6652f4d935f7ac02844 Mon Sep 17 00:00:00 2001
|
|
|
545b23 |
From: Jason Dillaman <dillaman@redhat.com>
|
|
|
545b23 |
Date: Thu, 9 Apr 2015 13:33:09 -0400
|
|
|
545b23 |
Subject: [PATCH 20/22] librbd: AioRequest::send no longer returns a result
|
|
|
545b23 |
|
|
|
545b23 |
The librados calls used by AioRequest::send should always return
|
|
|
545b23 |
zero unless there is a bug.
|
|
|
545b23 |
|
|
|
545b23 |
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
|
|
|
545b23 |
(cherry picked from commit c77bce3311ab62892eb8c1d883263ba7ed663b20)
|
|
|
545b23 |
|
|
|
545b23 |
Conflicts:
|
|
|
545b23 |
src/librbd/AioRequest.cc
|
|
|
545b23 |
src/librbd/AioRequest.h
|
|
|
545b23 |
src/librbd/internal.cc
|
|
|
545b23 |
|
|
|
545b23 |
(cherry picked from commit 7fea9b6954c7e8b913c7ab561f8b28432ecb19fa)
|
|
|
545b23 |
---
|
|
|
545b23 |
src/librbd/AioRequest.cc | 15 +++++++++------
|
|
|
545b23 |
src/librbd/AioRequest.h | 6 +++---
|
|
|
545b23 |
src/librbd/internal.cc | 23 ++++++++++-------------
|
|
|
545b23 |
3 files changed, 22 insertions(+), 22 deletions(-)
|
|
|
545b23 |
|
|
|
545b23 |
diff --git a/src/librbd/AioRequest.cc b/src/librbd/AioRequest.cc
|
|
|
545b23 |
index 5cf9a11..dee6eba 100644
|
|
|
545b23 |
--- a/src/librbd/AioRequest.cc
|
|
|
545b23 |
+++ b/src/librbd/AioRequest.cc
|
|
|
545b23 |
@@ -85,8 +85,9 @@ namespace librbd {
|
|
|
545b23 |
return true;
|
|
|
545b23 |
}
|
|
|
545b23 |
|
|
|
545b23 |
- int AioRead::send() {
|
|
|
545b23 |
- ldout(m_ictx->cct, 20) << "send " << this << " " << m_oid << " " << m_object_off << "~" << m_object_len << dendl;
|
|
|
545b23 |
+ void AioRead::send() {
|
|
|
545b23 |
+ ldout(m_ictx->cct, 20) << "send " << this << " " << m_oid << " "
|
|
|
545b23 |
+ << m_object_off << "~" << m_object_len << dendl;
|
|
|
545b23 |
|
|
|
545b23 |
librados::AioCompletion *rados_completion =
|
|
|
545b23 |
librados::Rados::aio_create_completion(this, rados_req_cb, NULL);
|
|
|
545b23 |
@@ -99,10 +100,11 @@ namespace librbd {
|
|
|
545b23 |
} else {
|
|
|
545b23 |
op.read(m_object_off, m_object_len, &m_read_data, NULL);
|
|
|
545b23 |
}
|
|
|
545b23 |
+
|
|
|
545b23 |
r = m_ioctx->aio_operate(m_oid, rados_completion, &op, flags, NULL);
|
|
|
545b23 |
+ assert(r == 0);
|
|
|
545b23 |
|
|
|
545b23 |
rados_completion->release();
|
|
|
545b23 |
- return r;
|
|
|
545b23 |
}
|
|
|
545b23 |
|
|
|
545b23 |
/** write **/
|
|
|
545b23 |
@@ -224,16 +226,17 @@ namespace librbd {
|
|
|
545b23 |
return finished;
|
|
|
545b23 |
}
|
|
|
545b23 |
|
|
|
545b23 |
- int AbstractWrite::send() {
|
|
|
545b23 |
- ldout(m_ictx->cct, 20) << "send " << this << " " << m_oid << " " << m_object_off << "~" << m_object_len << dendl;
|
|
|
545b23 |
+ void AbstractWrite::send() {
|
|
|
545b23 |
+ ldout(m_ictx->cct, 20) << "send " << this << " " << m_oid << " "
|
|
|
545b23 |
+ << m_object_off << "~" << m_object_len << dendl;
|
|
|
545b23 |
librados::AioCompletion *rados_completion =
|
|
|
545b23 |
librados::Rados::aio_create_completion(this, NULL, rados_req_cb);
|
|
|
545b23 |
int r;
|
|
|
545b23 |
assert(m_write.size());
|
|
|
545b23 |
r = m_ioctx->aio_operate(m_oid, rados_completion, &m_write,
|
|
|
545b23 |
m_snap_seq, m_snaps);
|
|
|
545b23 |
+ assert(r == 0);
|
|
|
545b23 |
rados_completion->release();
|
|
|
545b23 |
- return r;
|
|
|
545b23 |
}
|
|
|
545b23 |
|
|
|
545b23 |
void AbstractWrite::send_copyup() {
|
|
|
545b23 |
diff --git a/src/librbd/AioRequest.h b/src/librbd/AioRequest.h
|
|
|
545b23 |
index d6103f9..882b535 100644
|
|
|
545b23 |
--- a/src/librbd/AioRequest.h
|
|
|
545b23 |
+++ b/src/librbd/AioRequest.h
|
|
|
545b23 |
@@ -43,7 +43,7 @@ namespace librbd {
|
|
|
545b23 |
}
|
|
|
545b23 |
|
|
|
545b23 |
virtual bool should_complete(int r) = 0;
|
|
|
545b23 |
- virtual int send() = 0;
|
|
|
545b23 |
+ virtual void send() = 0;
|
|
|
545b23 |
|
|
|
545b23 |
protected:
|
|
|
545b23 |
void read_from_parent(vector<pair<uint64_t,uint64_t> >& image_extents);
|
|
|
545b23 |
@@ -73,7 +73,7 @@ namespace librbd {
|
|
|
545b23 |
}
|
|
|
545b23 |
virtual ~AioRead() {}
|
|
|
545b23 |
virtual bool should_complete(int r);
|
|
|
545b23 |
- virtual int send();
|
|
|
545b23 |
+ virtual void send();
|
|
|
545b23 |
|
|
|
545b23 |
ceph::bufferlist &data() {
|
|
|
545b23 |
return m_read_data;
|
|
|
545b23 |
@@ -100,7 +100,7 @@ namespace librbd {
|
|
|
545b23 |
bool hide_enoent);
|
|
|
545b23 |
virtual ~AbstractWrite() {}
|
|
|
545b23 |
virtual bool should_complete(int r);
|
|
|
545b23 |
- virtual int send();
|
|
|
545b23 |
+ virtual void send();
|
|
|
545b23 |
void guard_write();
|
|
|
545b23 |
|
|
|
545b23 |
bool has_parent() const {
|
|
|
545b23 |
diff --git a/src/librbd/internal.cc b/src/librbd/internal.cc
|
|
|
545b23 |
index 477d936..0a51da2 100644
|
|
|
545b23 |
--- a/src/librbd/internal.cc
|
|
|
545b23 |
+++ b/src/librbd/internal.cc
|
|
|
545b23 |
@@ -2179,6 +2179,10 @@ reprotect_and_return_err:
|
|
|
545b23 |
SimpleThrottle throttle(cct->_conf->rbd_concurrent_management_ops, false);
|
|
|
545b23 |
|
|
|
545b23 |
for (uint64_t ono = 0; ono < overlap_objects; ono++) {
|
|
|
545b23 |
+ if (throttle.pending_error()) {
|
|
|
545b23 |
+ return throttle.wait_for_ret();
|
|
|
545b23 |
+ }
|
|
|
545b23 |
+
|
|
|
545b23 |
{
|
|
|
545b23 |
RWLock::RLocker l(ictx->parent_lock);
|
|
|
545b23 |
// stop early if the parent went away - it just means
|
|
|
545b23 |
@@ -2202,12 +2206,7 @@ reprotect_and_return_err:
|
|
|
545b23 |
Context *comp = new C_SimpleThrottle(&throttle);
|
|
|
545b23 |
AioWrite *req = new AioWrite(ictx, oid, ono, 0, objectx, object_overlap,
|
|
|
545b23 |
bl, snapc, CEPH_NOSNAP, comp);
|
|
|
545b23 |
- r = req->send();
|
|
|
545b23 |
- if (r < 0) {
|
|
|
545b23 |
- lderr(cct) << "failed to flatten object " << oid << dendl;
|
|
|
545b23 |
- goto err;
|
|
|
545b23 |
- }
|
|
|
545b23 |
-
|
|
|
545b23 |
+ req->send();
|
|
|
545b23 |
prog_ctx.update_progress(ono, overlap_objects);
|
|
|
545b23 |
}
|
|
|
545b23 |
|
|
|
545b23 |
@@ -2952,8 +2951,7 @@ reprotect_and_return_err:
|
|
|
545b23 |
objectx, object_overlap,
|
|
|
545b23 |
bl, snapc, snap_id, req_comp);
|
|
|
545b23 |
c->add_request();
|
|
|
545b23 |
- r = req->send();
|
|
|
545b23 |
- assert(r == 0);
|
|
|
545b23 |
+ req->send();
|
|
|
545b23 |
}
|
|
|
545b23 |
}
|
|
|
545b23 |
|
|
|
545b23 |
@@ -3035,10 +3033,10 @@ reprotect_and_return_err:
|
|
|
545b23 |
snapc, snap_id, req_comp);
|
|
|
545b23 |
}
|
|
|
545b23 |
|
|
|
545b23 |
- r = req->send();
|
|
|
545b23 |
- assert(r == 0);
|
|
|
545b23 |
+ req->send();
|
|
|
545b23 |
}
|
|
|
545b23 |
|
|
|
545b23 |
+ r = 0;
|
|
|
545b23 |
if (ictx->object_cacher) {
|
|
|
545b23 |
Mutex::Locker l(ictx->cache_lock);
|
|
|
545b23 |
ictx->object_cacher->discard_set(ictx->object_set, extents);
|
|
|
545b23 |
@@ -3129,13 +3127,12 @@ reprotect_and_return_err:
|
|
|
545b23 |
q->length, q->offset,
|
|
|
545b23 |
cache_comp);
|
|
|
545b23 |
} else {
|
|
|
545b23 |
- r = req->send();
|
|
|
545b23 |
- assert(r == 0);
|
|
|
545b23 |
+ req->send();
|
|
|
545b23 |
}
|
|
|
545b23 |
}
|
|
|
545b23 |
}
|
|
|
545b23 |
|
|
|
545b23 |
- c->finish_adding_requests(cct);
|
|
|
545b23 |
+ c->finish_adding_requests(ictx->cct);
|
|
|
545b23 |
c->put();
|
|
|
545b23 |
|
|
|
545b23 |
ictx->perfcounter->inc(l_librbd_aio_rd);
|
|
|
545b23 |
--
|
|
|
545b23 |
2.1.0
|
|
|
545b23 |
|