lib/ftl: Fix I/O alignment in dirty shutdown restore
Changed to use 4k alignment in dirty shutdown I/Os. Otherwise the scatter gather lists used in QEMU for underlying file/block device would use an extra entry (e.g. 17 for 16 sector writes), and eventually some I/Os would write to offset 0 in underlying file, corrupting head metadata. Signed-off-by: Mateusz Kozlowski <mateusz.kozlowski@intel.com> Change-Id: If8c88ce708529b094a09c8ee952912cc22cd53b9 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458090 Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com> Reviewed-by: Wojciech Malikowski <wojciech.malikowski@intel.com> Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
67d027ece9
commit
38bb4bcdee
@ -180,7 +180,6 @@ ftl_restore_check_seq(const struct ftl_restore *restore)
|
||||
|
||||
for (i = 0; i < ftl_dev_num_bands(dev); ++i) {
|
||||
rband = &restore->bands[i];
|
||||
|
||||
if (rband->md_status != FTL_MD_SUCCESS) {
|
||||
continue;
|
||||
}
|
||||
@ -533,7 +532,14 @@ ftl_restore_pad_band(struct ftl_restore_band *rband)
|
||||
ppa = band->chunk_buf[i].start_ppa;
|
||||
ppa.lbk = info.wp;
|
||||
|
||||
buffer = spdk_dma_zmalloc(FTL_BLOCK_SIZE * dev->xfer_size, sizeof(uint32_t), NULL);
|
||||
/*
|
||||
* We need 4k alignment for lightnvm writes; otherwise, due to a bug in QEMU,
|
||||
* scatter gather lists to underlying block device become broken as the number of
|
||||
* incoming offsets (dev->xfer_size) would be smaller than the calculated size of
|
||||
* sgl (dev->xfer_size+1), which eventually results in some part of the write
|
||||
* hitting offset 0 of the drive, overwriting head_md of band 0.
|
||||
*/
|
||||
buffer = spdk_dma_zmalloc(FTL_BLOCK_SIZE * dev->xfer_size, FTL_BLOCK_SIZE, NULL);
|
||||
if (spdk_unlikely(!buffer)) {
|
||||
rc = -ENOMEM;
|
||||
goto error;
|
||||
|
Loading…
Reference in New Issue
Block a user