From b4f28292c222010b178bc14c42374e59e9ae3d13 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 8 Oct 2012 09:55:17 -0700 Subject: [PATCH] filer: fix add_partial_sparse_result Fix advancement of bl_off, and handling of case where bl has no more bytes to consume. Signed-off-by: Sage Weil --- src/osdc/Filer.cc | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/osdc/Filer.cc b/src/osdc/Filer.cc index 4b67a20f57dd2..3d71373bda2e0 100644 --- a/src/osdc/Filer.cc +++ b/src/osdc/Filer.cc @@ -492,17 +492,19 @@ void Filer::StripedReadResult::add_partial_sparse_result(CephContext *cct, size_t left = (s->first + s->second) - bl_off; size_t actual = MIN(left, tlen); - pair& r = partial[tofs]; - bl.splice(0, actual, &r.first); - r.second = actual; - bl_off += actual; - tofs += actual; - tlen -= actual; - - if (actual == left) + if (actual > 0) { + pair& r = partial[tofs]; + bl.splice(0, actual, &r.first); + r.second = actual; + bl_off += actual; + tofs += actual; + tlen -= actual; + } + if (actual == left) { + ldout(cct, 30) << " s advancing" << dendl; s++; + } } - bl_off += p->second; } } -- 2.39.5