From eb1ddcb664ad12149e1f293172a104d8987ccced Mon Sep 17 00:00:00 2001 From: paul luse Date: Tue, 18 Jun 2019 14:42:39 -0400 Subject: [PATCH] lib/reduce: remove dead code clearing unused backing io units At the start of time all of values of io_unit_index[] array in the chunk maps are FF's. When a partial chunk is written, only some of the io_unit_index[] vals will be assigned values from the allocated_backing_io_units bit array. When that chunk is written again, it is not done so in place and at that time in when _write_write_done() is called, the io_unit_index[] values are set to FF again and the bit array bits are cleared for the old chunk so that it is fresh again for use by another write. This change removes code from an early stage of the write process where a 'fresh' chuck in allocated. Because of points made earlier, it is not possible for any of the io_unit_index[] values to be assigned or have a corresponding bit set in the bit array. The prev version of this patch cleared the bit array because the io_unit_index[] array was being cleared however after further investigation, and for the reasons stated earlier, the io_unit_index[] did not have a valid value so clearing the bit array was simply wrong. Removing this dead code clears things up and leaves it to one place to clear the io_unit_index[], when a chunk is overwritten. Well, 2 places including init time. Change-Id: I5c4e5360c9c13817d2fa7d3c7d004b44537af7f4 Signed-off-by: paul luse Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458520 Reviewed-by: Shuhei Matsumoto Reviewed-by: Darek Stojaczyk Reviewed-by: Jim Harris Tested-by: SPDK CI Jenkins --- lib/reduce/reduce.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/reduce/reduce.c b/lib/reduce/reduce.c index b202004e2..2f31847f6 100644 --- a/lib/reduce/reduce.c +++ b/lib/reduce/reduce.c @@ -1066,9 +1066,6 @@ _reduce_vol_write_chunk(struct spdk_reduce_vol_request *req, reduce_request_fn n assert(req->chunk->io_unit_index[i] != UINT32_MAX); spdk_bit_array_set(vol->allocated_backing_io_units, req->chunk->io_unit_index[i]); } - while (i < vol->backing_io_units_per_chunk) { - req->chunk->io_unit_index[i++] = REDUCE_EMPTY_MAP_ENTRY; - } _issue_backing_ops(req, vol, next_fn, true /* write */); }