Commit 0b3fb240 authored by paul luse's avatar paul luse Committed by Darek Stojaczyk
Browse files

lib/reduce: fix bug with adding up req->decomp_iovcnt



In the memcpy elimination patches, the same bug exists in 3
places.  When building req->decomp_iov using the host buffers,
req->decomp_iovcnt was being incremented in the loop and also
being used as part of the index messing everything up.

Signed-off-by: default avatarpaul luse <paul.e.luse@intel.com>
Change-Id: I485ac32502801c1e11b8392b2df7eba06b4f5a9b
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/461053


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
parent b9bc6254
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -1103,8 +1103,8 @@ _reduce_vol_decompress_chunk(struct spdk_reduce_vol_request *req, reduce_request
		req->decomp_iov[i + req->decomp_iovcnt].iov_base = req->iov[i].iov_base;
		req->decomp_iov[i + req->decomp_iovcnt].iov_len = req->iov[i].iov_len;
		ttl_len += req->decomp_iov[i + req->decomp_iovcnt].iov_len;
		req->decomp_iovcnt++;
	}
	req->decomp_iovcnt += req->iovcnt;

	/* send the rest of the chunk to our scratch buffer */
	remainder = vol->params.chunk_size - ttl_len;
@@ -1162,8 +1162,8 @@ _write_decompress_done(void *_req, int reduce_errno)
		req->decomp_iov[i + req->decomp_iovcnt].iov_base = req->iov[i].iov_base;
		req->decomp_iov[i + req->decomp_iovcnt].iov_len = req->iov[i].iov_len;
		ttl_len += req->decomp_iov[i + req->decomp_iovcnt].iov_len;
		req->decomp_iovcnt++;
	}
	req->decomp_iovcnt += req->iovcnt;

	if (ttl_len < req->vol->params.chunk_size) {
		req->decomp_iov[req->decomp_iovcnt].iov_base = req->decomp_buf + ttl_len;
@@ -1407,8 +1407,8 @@ _start_writev_request(struct spdk_reduce_vol_request *req)
		req->decomp_iov[i + req->decomp_iovcnt].iov_base = req->iov[i].iov_base;
		req->decomp_iov[i + req->decomp_iovcnt].iov_len = req->iov[i].iov_len;
		ttl_len += req->decomp_iov[i + req->decomp_iovcnt].iov_len;
		req->decomp_iovcnt++;
	}
	req->decomp_iovcnt += req->iovcnt;

	chunk_offset += req->length;
	if (chunk_offset != lb_per_chunk) {