lib/reduce: for compress path, copy data from host buffers if needed
If the data was not compressed for whatever reason, it needs to be copied from the host buffers much in the same way as the patch before this did. Signed-off-by: paul luse <paul.e.luse@intel.com> Change-Id: I5c92db16afbce3ca573c556ee78a51ba6511c564 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/462895 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
907ec7268d
commit
7384ca015b
@ -1045,6 +1045,9 @@ _reduce_vol_write_chunk(struct spdk_reduce_vol_request *req, reduce_request_fn n
|
||||
{
|
||||
struct spdk_reduce_vol *vol = req->vol;
|
||||
uint32_t i;
|
||||
uint64_t chunk_offset;
|
||||
uint8_t *buf;
|
||||
int j;
|
||||
|
||||
req->chunk_map_index = spdk_bit_array_find_first_clear(vol->allocated_chunk_maps, 0);
|
||||
|
||||
@ -1061,6 +1064,16 @@ _reduce_vol_write_chunk(struct spdk_reduce_vol_request *req, reduce_request_fn n
|
||||
req->chunk->compressed_size =
|
||||
req->chunk_is_compressed ? compressed_size : vol->params.chunk_size;
|
||||
|
||||
/* if the chunk is uncompressed we need to copy the data from the host buffers. */
|
||||
if (req->chunk_is_compressed == false) {
|
||||
chunk_offset = req->offset % vol->logical_blocks_per_chunk;
|
||||
buf = req->decomp_buf + chunk_offset * vol->params.logical_block_size;
|
||||
for (j = 0; j < req->iovcnt; j++) {
|
||||
memcpy(buf, req->iov[j].iov_base, req->iov[j].iov_len);
|
||||
buf += req->iov[j].iov_len;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < req->num_io_units; i++) {
|
||||
req->chunk->io_unit_index[i] = spdk_bit_array_find_first_clear(vol->allocated_backing_io_units, 0);
|
||||
/* TODO: fail if no backing block found - but really this should also not
|
||||
|
Loading…
x
Reference in New Issue
Block a user