diff options
author | Yehuda Sadeh <yehuda@inktank.com> | 2013-11-23 02:21:57 +0100 |
---|---|---|
committer | Yehuda Sadeh <yehuda@inktank.com> | 2013-12-24 18:00:03 +0100 |
commit | 771da13b6647ebbe8acce3a6f79ec7e84db08c21 (patch) | |
tree | df2ba736f0420e27cf7bf811aa3645defdbdb508 /src/osdc | |
parent | Merge pull request #990 from ceph/wip-fix-mon-fwd (diff) | |
download | ceph-771da13b6647ebbe8acce3a6f79ec7e84db08c21.tar.xz ceph-771da13b6647ebbe8acce3a6f79ec7e84db08c21.zip |
objecter, librados: create Objecter::Op in two phases
(currently only in some librados operations)
First create the op, only then lock and submit so that we reduce lock
contention.
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
Diffstat (limited to 'src/osdc')
-rw-r--r-- | src/osdc/Objecter.h | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/osdc/Objecter.h b/src/osdc/Objecter.h index 4a1a54da486..fbc15c69dec 100644 --- a/src/osdc/Objecter.h +++ b/src/osdc/Objecter.h @@ -1481,12 +1481,12 @@ public: private: // low-level - tid_t op_submit(Op *op); tid_t _op_submit(Op *op); inline void unregister_op(Op *op); // public interface - public: +public: + tid_t op_submit(Op *op); bool is_active() { return !(ops.empty() && linger_ops.empty() && poolstat_ops.empty() && statfs_ops.empty()); } @@ -1548,7 +1548,7 @@ private: } // mid-level helpers - tid_t mutate(const object_t& oid, const object_locator_t& oloc, + Op *prepare_mutate_op(const object_t& oid, const object_locator_t& oloc, ObjectOperation& op, const SnapContext& snapc, utime_t mtime, int flags, Context *onack, Context *oncommit, version_t *objver = NULL) { @@ -1556,9 +1556,16 @@ private: o->priority = op.priority; o->mtime = mtime; o->snapc = snapc; + return o; + } + tid_t mutate(const object_t& oid, const object_locator_t& oloc, + ObjectOperation& op, + const SnapContext& snapc, utime_t mtime, int flags, + Context *onack, Context *oncommit, version_t *objver = NULL) { + Op *o = prepare_mutate_op(oid, oloc, op, snapc, mtime, flags, onack, oncommit, objver); return op_submit(o); } - tid_t read(const object_t& oid, const object_locator_t& oloc, + Op *prepare_read_op(const object_t& oid, const object_locator_t& oloc, ObjectOperation& op, snapid_t snapid, bufferlist *pbl, int flags, Context *onack, version_t *objver = NULL) { @@ -1569,6 +1576,13 @@ private: o->out_bl.swap(op.out_bl); o->out_handler.swap(op.out_handler); o->out_rval.swap(op.out_rval); + return o; + } + tid_t read(const object_t& oid, const object_locator_t& oloc, + ObjectOperation& op, + snapid_t snapid, bufferlist *pbl, int flags, + Context *onack, version_t *objver = NULL) { + Op *o = prepare_read_op(oid, oloc, op, snapid, pbl, flags, onack, objver); return op_submit(o); } tid_t pg_read(uint32_t hash, object_locator_t oloc, |