From 643e103fe775892cc33e0a2b3c73bd42faaa5d45 Mon Sep 17 00:00:00 2001 From: Robert Baldyga Date: Thu, 17 Mar 2022 20:50:11 +0100 Subject: [PATCH] Don't attempt to set data for flush/discard on cache volume Signed-off-by: Robert Baldyga --- src/ocf_cache.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/ocf_cache.c b/src/ocf_cache.c index c315f9d..67e29ad 100644 --- a/src/ocf_cache.c +++ b/src/ocf_cache.c @@ -327,14 +327,11 @@ static void ocf_cache_volume_io_complete(struct ocf_io *vol_io, int error) static int ocf_cache_volume_prepare_vol_io(struct ocf_io *io, struct ocf_io **vol_io) { - struct ocf_cache_volume_io_priv *priv; ocf_cache_t cache; struct ocf_io *tmp_io; - int result; OCF_CHECK_NULL(io); - priv = ocf_io_get_priv(io); cache = ocf_volume_to_cache(ocf_io_get_volume(io)); tmp_io = ocf_volume_new_io(ocf_cache_get_volume(cache), io->io_queue, @@ -342,12 +339,6 @@ static int ocf_cache_volume_prepare_vol_io(struct ocf_io *io, if (!tmp_io) return -OCF_ERR_NO_MEM; - result = ocf_io_set_data(tmp_io, priv->data, 0); - if (result) { - ocf_io_put(tmp_io); - return result; - } - *vol_io = tmp_io; return 0; @@ -377,6 +368,13 @@ static void ocf_cache_volume_submit_io(struct ocf_io *io) return; } + result = ocf_io_set_data(vol_io, priv->data, 0); + if (result) { + ocf_io_put(vol_io); + ocf_io_end(io, result); + return; + } + ocf_io_set_cmpl(vol_io, io, NULL, ocf_cache_volume_io_complete); ocf_volume_submit_io(vol_io);