blob_bdev: add unmap -> write_zeroes fallback
If the bdev doesn't support unmap, we should not send unmap I/O. Instead, use spdk_bdev_write_zeroes(), which has a fallback in the bdev layer for devices that don't natively support it. Change-Id: I1bd05d3518716f8e60501dbb4f9da0fee23cf7c2 Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-on: https://review.gerrithub.io/383491 Reviewed-by: Seth Howell <seth.howell5141@gmail.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
parent
e68e2e749b
commit
d189b8eedd
@ -227,7 +227,16 @@ spdk_bdev_create_bs_dev(struct spdk_bdev *bdev, spdk_bdev_remove_cb_t remove_cb,
|
||||
b->bs_dev.readv = bdev_blob_readv;
|
||||
b->bs_dev.writev = bdev_blob_writev;
|
||||
b->bs_dev.write_zeroes = bdev_blob_write_zeroes;
|
||||
b->bs_dev.unmap = bdev_blob_unmap;
|
||||
if (spdk_bdev_io_type_supported(bdev, SPDK_BDEV_IO_TYPE_UNMAP)) {
|
||||
b->bs_dev.unmap = bdev_blob_unmap;
|
||||
} else {
|
||||
/*
|
||||
* If bdev doesn't support unmap, use write_zeroes as a fallback.
|
||||
* This will always work, since bdev implements write_zeroes on top of write
|
||||
* if the device doesn't natively support write_zeroes.
|
||||
*/
|
||||
b->bs_dev.unmap = bdev_blob_write_zeroes;
|
||||
}
|
||||
|
||||
return &b->bs_dev;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user