Skip to content

Commit 6a24afd

Browse files
committed
osdc: Interface to allow split reads to copy op from client op to split op
When spliting ops, certain addition sub ops (e.g. get xattr) can be simply passed through to the child op. Signed-off-by: Alex Ainscow <[email protected]>
1 parent 3e6c66f commit 6a24afd

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/osdc/Objecter.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,11 @@ struct ObjectOperation {
161161

162162
}
163163

164+
OSDOp& pass_thru_op(OSDOp& op) {
165+
ops.emplace_back(op);
166+
return ops.back();
167+
}
168+
164169
OSDOp& add_op(int op) {
165170
ops.emplace_back();
166171
ops.back().op.op = op;
@@ -2120,6 +2125,26 @@ class Objecter : public md_config_obs_t, public Dispatcher {
21202125
return tid < other.tid;
21212126
}
21222127

2128+
void pass_thru_op(::ObjectOperation &other, unsigned index, bufferlist *bl, int *rval) {
2129+
ceph_assert(index < ops.size());
2130+
2131+
other.pass_thru_op(ops[index]);
2132+
unsigned p = other.ops.size() - 1;
2133+
ceph_assert(out_bl.size() == ops.size());
2134+
ceph_assert(out_rval.size() == ops.size());
2135+
ceph_assert(out_ec.size() == ops.size());
2136+
ceph_assert(out_handler.size() == ops.size());
2137+
2138+
other.out_bl.resize(p + 1);
2139+
other.out_rval.resize(p + 1);
2140+
other.out_ec.resize(p + 1);
2141+
other.out_handler.resize(p + 1);
2142+
2143+
other.out_bl[p] = bl;
2144+
other.out_rval[p] = rval;
2145+
// We don't copy the out handler here - it must be run by the copied-from op.
2146+
}
2147+
21232148
private:
21242149
~Op() override {
21252150
trace.event("finish");

0 commit comments

Comments
 (0)