Commit d679b0ec authored by Mateusz Kozlowski's avatar Mateusz Kozlowski Committed by Ben Walker
Browse files

lib/ftl: Remove num_pad_bands counter from restore



Base off restore completion on list population rather than another
counter.

Signed-off-by: default avatarMateusz Kozlowski <mateusz.kozlowski@intel.com>
Change-Id: I8f9d8f13aea42e1c350640efd84ff6c247eded0a
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457606


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: default avatarWojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
parent a57daa69
Loading
Loading
Loading
Loading
+5 −9
Original line number Diff line number Diff line
@@ -64,8 +64,6 @@ struct ftl_restore {

	STAILQ_HEAD(, ftl_restore_band) pad_bands;

	size_t				num_pad_bands;

	int				pad_status;

	void				*md_buf;
@@ -377,6 +375,7 @@ static bool
ftl_pad_chunk_pad_finish(struct ftl_restore_band *rband, bool direct_access)
{
	struct ftl_restore *restore = rband->parent;
	struct ftl_restore_band *next_band;
	size_t i, num_pad_chunks = 0;

	if (spdk_unlikely(restore->pad_status && !restore->num_ios)) {
@@ -403,12 +402,13 @@ ftl_pad_chunk_pad_finish(struct ftl_restore_band *rband, bool direct_access)
			rband->band->state = FTL_BAND_STATE_CLOSED;
			ftl_band_set_direct_access(rband->band, false);
		}
		if (--restore->num_pad_bands == 0) {
		next_band = STAILQ_NEXT(rband, stailq);
		if (!next_band) {
			ftl_restore_complete(restore, restore->pad_status);
			return true;
		} else {
			/* Start off padding in the next band */
			ftl_restore_pad_band(STAILQ_NEXT(rband, stailq));
			ftl_restore_pad_band(next_band);
			return true;
		}
	}
@@ -513,10 +513,7 @@ ftl_restore_pad_band(struct ftl_restore_band *rband)
	band->state = FTL_BAND_STATE_OPEN;
	rc = ftl_band_set_direct_access(band, true);
	if (rc) {
		restore->pad_status = rc;
		if (--restore->num_pad_bands == 0) {
			ftl_restore_complete(restore, restore->pad_status);
		}
		ftl_restore_complete(restore, rc);
		return;
	}

@@ -587,7 +584,6 @@ ftl_restore_tail_md_cb(struct ftl_io *io, void *ctx, int status)
			SPDK_ERRLOG("%s while restoring tail md. Will attempt to pad band %u.\n",
				    spdk_strerror(-status), rband->band->id);
			STAILQ_INSERT_TAIL(&restore->pad_bands, rband, stailq);
			restore->num_pad_bands++;
		}
	}