mirror of
https://github.com/ceph/ceph
synced 2025-02-21 18:17:42 +00:00
librados: move snapc creation to caller for aio_operate
The common case already has a snapshot context, so avoid duplicating it (copying a potentially large vector) in IoCtxImpl::aio_operate(). Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
This commit is contained in:
parent
f1d1f11926
commit
4c4d5591bd
@ -712,7 +712,7 @@ int librados::IoCtxImpl::aio_operate_read(const object_t &oid,
|
||||
|
||||
int librados::IoCtxImpl::aio_operate(const object_t& oid,
|
||||
::ObjectOperation *o, AioCompletionImpl *c,
|
||||
snap_t seq, vector<snapid_t>& snaps)
|
||||
const SnapContext& snap_context)
|
||||
{
|
||||
utime_t ut = ceph_clock_now(client->cct);
|
||||
/* can't write to a snapshot */
|
||||
@ -725,9 +725,8 @@ int librados::IoCtxImpl::aio_operate(const object_t& oid,
|
||||
c->io = this;
|
||||
queue_aio_write(c);
|
||||
|
||||
SnapContext local_snapc(seq, snaps);
|
||||
Mutex::Locker l(*lock);
|
||||
objecter->mutate(oid, oloc, *o, local_snapc, ut, 0, onack, oncommit,
|
||||
objecter->mutate(oid, oloc, *o, snap_context, ut, 0, onack, oncommit,
|
||||
&c->objver);
|
||||
|
||||
return 0;
|
||||
|
@ -139,7 +139,7 @@ struct librados::IoCtxImpl {
|
||||
int operate(const object_t& oid, ::ObjectOperation *o, time_t *pmtime);
|
||||
int operate_read(const object_t& oid, ::ObjectOperation *o, bufferlist *pbl);
|
||||
int aio_operate(const object_t& oid, ::ObjectOperation *o,
|
||||
AioCompletionImpl *c, snap_t seq, vector<snapid_t>& snaps);
|
||||
AioCompletionImpl *c, const SnapContext& snap_context);
|
||||
int aio_operate_read(const object_t& oid, ::ObjectOperation *o, AioCompletionImpl *c, bufferlist *pbl);
|
||||
|
||||
struct C_aio_Ack : public Context {
|
||||
|
@ -860,8 +860,7 @@ int librados::IoCtx::aio_operate(const std::string& oid, AioCompletion *c,
|
||||
{
|
||||
object_t obj(oid);
|
||||
return io_ctx_impl->aio_operate(obj, (::ObjectOperation*)o->impl, c->pc,
|
||||
io_ctx_impl->snapc.seq,
|
||||
io_ctx_impl->snapc.snaps);
|
||||
io_ctx_impl->snapc);
|
||||
}
|
||||
|
||||
int librados::IoCtx::aio_operate(const std::string& oid, AioCompletion *c,
|
||||
@ -873,8 +872,9 @@ int librados::IoCtx::aio_operate(const std::string& oid, AioCompletion *c,
|
||||
snv.resize(snaps.size());
|
||||
for (size_t i = 0; i < snaps.size(); ++i)
|
||||
snv[i] = snaps[i];
|
||||
SnapContext snapc(snap_seq, snv);
|
||||
return io_ctx_impl->aio_operate(obj, (::ObjectOperation*)o->impl, c->pc,
|
||||
snap_seq, snv);
|
||||
snapc);
|
||||
}
|
||||
|
||||
int librados::IoCtx::aio_operate(const std::string& oid, AioCompletion *c, librados::ObjectReadOperation *o, bufferlist *pbl)
|
||||
|
Loading…
Reference in New Issue
Block a user