From 0b6b572f7d0cabd074aa33037bac6ab11c3b8fa0 Mon Sep 17 00:00:00 2001 From: Seth Howell Date: Fri, 11 Aug 2017 12:04:21 -0700 Subject: [PATCH] lib/bdev_malloc: add support for the write_zeroes I/O type Change-Id: Id66d773ff66a9cd1da6cf2515b3fe765cd8edbd6 Signed-off-by: Seth Howell Reviewed-on: https://review.gerrithub.io/373971 Tested-by: SPDK Automated Test System Reviewed-by: Daniel Verkamp Reviewed-by: Ben Walker --- lib/bdev/malloc/bdev_malloc.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/bdev/malloc/bdev_malloc.c b/lib/bdev/malloc/bdev_malloc.c index bfe79ca1e..3da4baff8 100644 --- a/lib/bdev/malloc/bdev_malloc.c +++ b/lib/bdev/malloc/bdev_malloc.c @@ -320,6 +320,15 @@ static int _bdev_malloc_submit_request(struct spdk_io_channel *ch, struct spdk_b (struct malloc_task *)bdev_io->driver_ctx, bdev_io->u.unmap.offset, bdev_io->u.unmap.len); + + case SPDK_BDEV_IO_TYPE_WRITE_ZEROES: + /* bdev_malloc_unmap is implemented with a call to mem_cpy_fill which zeroes out all of the requested bytes. */ + return bdev_malloc_unmap((struct malloc_disk *)bdev_io->bdev->ctxt, + ch, + (struct malloc_task *)bdev_io->driver_ctx, + bdev_io->u.write.offset, + bdev_io->u.write.len); + default: return -1; } @@ -342,6 +351,7 @@ bdev_malloc_io_type_supported(void *ctx, enum spdk_bdev_io_type io_type) case SPDK_BDEV_IO_TYPE_FLUSH: case SPDK_BDEV_IO_TYPE_RESET: case SPDK_BDEV_IO_TYPE_UNMAP: + case SPDK_BDEV_IO_TYPE_WRITE_ZEROES: return true; default: