reduce: write uncompressed data when compress returns error

Most typically, the error will be -ENOSPC, meaning the
destination buffer wasn't big enough to hold the compressed
data.  But even for other types of errors, just write the
uncompressed data rather than treating it as an I/O
failure.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Id6526cab95488a1a587b183237f9980c83287761

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/449511
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Jim Harris 2019-03-28 13:41:09 -07:00 committed by Ben Walker
parent c1bab69c61
commit fa0d54d431

View File

@ -1018,10 +1018,14 @@ _write_compress_done(void *_req, int reduce_errno)
{
struct spdk_reduce_vol_request *req = _req;
/* Negative reduce_errno indicates failure for compression operations. */
/* Negative reduce_errno indicates failure for compression operations.
* Just write the uncompressed data instead. Force this to happen
* by just passing the full chunk size to _reduce_vol_write_chunk.
* When it sees the data couldn't be compressed, it will just write
* the uncompressed buffer to disk.
*/
if (reduce_errno < 0) {
_reduce_vol_complete_req(req, reduce_errno);
return;
reduce_errno = req->vol->params.chunk_size;
}
/* Positive reduce_errno indicates number of bytes in compressed buffer. */