From 65e8738611cde0090619b3566a2e25f83b4c8468 Mon Sep 17 00:00:00 2001 From: kofiliu Date: Fri, 27 May 2016 03:45:06 -0400 Subject: [PATCH] osd: sparse_read offset may not be zero for ecpool Signed-off-by: kofiliu --- src/osd/ReplicatedPG.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 8b3da574699..b931ca2fb4c 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -4047,14 +4047,15 @@ struct FillInVerifyExtent : public Context { struct ToSparseReadResult : public Context { bufferlist& data_bl; + uint64_t data_offset; ceph_le64& len; - ToSparseReadResult(bufferlist& bl, ceph_le64& len): - data_bl(bl), len(len) {} + ToSparseReadResult(bufferlist& bl, uint64_t offset, ceph_le64& len): + data_bl(bl), data_offset(offset),len(len) {} void finish(int r) { if (r < 0) return; len = r; bufferlist outdata; - map extents = {{0, r}}; + map extents = {{data_offset, r}}; ::encode(extents, outdata); ::encode_destructively(data_bl, outdata); data_bl.swap(outdata); @@ -4318,7 +4319,7 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector& ops) ctx->pending_async_reads.push_back( make_pair( boost::make_tuple(op.extent.offset, op.extent.length, op.flags), - make_pair(&osd_op.outdata, new ToSparseReadResult(osd_op.outdata, + make_pair(&osd_op.outdata, new ToSparseReadResult(osd_op.outdata, op.extent.offset, op.extent.length)))); dout(10) << " async_read (was sparse_read) noted for " << soid << dendl; } else {