lib/ftl: Add ability to ignore endmeta errors on restore

If a band wasn't closed during shutdown (ie. after dirty shutdown),
the start md contains valid data, however end md does not (or it may
not be written at all).
The config gives the user the ability to specify if encountering
this case should result in an error, or if ftl should pad the band
with data and recover from closed bands only.

Signed-off-by: Mateusz Kozlowski <mateusz.kozlowski@intel.com>
Change-Id: If02f7ca8bc90bb61698fb710fee2274af6af01e4
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455513
Reviewed-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Mateusz Kozlowski 2019-05-23 15:43:21 +02:00 committed by Ben Walker
parent 9939830608
commit a9ce7b8551
3 changed files with 20 additions and 4 deletions

View File

@ -89,6 +89,9 @@ struct spdk_ftl_conf {
/* Number of interleaving units per ws_opt */
size_t num_interleave_units;
/* Allow for partial recovery from open bands instead of returning error */
bool allow_open_bands;
};
/* Range of parallel units (inclusive) */

View File

@ -90,6 +90,12 @@ static const struct spdk_ftl_conf g_default_conf = {
/* Number of interleaving units per ws_opt */
/* 1 for default and 3 for 3D TLC NAND */
.num_interleave_units = 1,
/*
* If clear ftl will return error when restoring after a dirty shutdown
* If set, last band will be padded, ftl will restore based only on closed bands - this
* will result in lost data after recovery.
*/
.allow_open_bands = false,
};
static void ftl_dev_free_sync(struct spdk_ftl_dev *dev);

View File

@ -573,11 +573,18 @@ ftl_restore_tail_md_cb(struct ftl_io *io, void *ctx, int status)
struct spdk_ftl_dev *dev = rband->band->dev;
if (status) {
if (!dev->conf.allow_open_bands) {
SPDK_ERRLOG("%s while restoring tail md in band %u.\n",
spdk_strerror(-status), rband->band->id);
ftl_restore_complete(restore, status);
return;
} else {
SPDK_ERRLOG("%s while restoring tail md. Will attempt to pad band %u.\n",
spdk_strerror(status), rband->band->id);
spdk_strerror(-status), rband->band->id);
STAILQ_INSERT_TAIL(&restore->pad_bands, rband, stailq);
restore->num_pad_bands++;
}
}
if (!status && ftl_restore_l2p(rband->band)) {
ftl_restore_complete(restore, -ENOTRECOVERABLE);