diff --git a/include/spdk/bdev.h b/include/spdk/bdev.h index 04ea58a5f8..3d0e640bfe 100644 --- a/include/spdk/bdev.h +++ b/include/spdk/bdev.h @@ -81,7 +81,8 @@ struct spdk_bdev_desc; /** bdev I/O type */ enum spdk_bdev_io_type { - SPDK_BDEV_IO_TYPE_READ = 1, + SPDK_BDEV_IO_TYPE_INVALID = 0, + SPDK_BDEV_IO_TYPE_READ, SPDK_BDEV_IO_TYPE_WRITE, SPDK_BDEV_IO_TYPE_UNMAP, SPDK_BDEV_IO_TYPE_FLUSH, diff --git a/include/spdk_internal/bdev.h b/include/spdk_internal/bdev.h index 52ceed0b38..15d963cd54 100644 --- a/include/spdk_internal/bdev.h +++ b/include/spdk_internal/bdev.h @@ -260,7 +260,18 @@ struct spdk_bdev_io { TAILQ_ENTRY(spdk_bdev_io) buf_link; /** Enumerated value representing the I/O type. */ - enum spdk_bdev_io_type type; + int16_t type; + + /** Status for the IO */ + int16_t status; + + /** + * Set to true while the bdev module submit_request function is in progress. + * + * This is used to decide whether spdk_bdev_io_complete() can complete the I/O directly + * or if completion must be deferred via an event. + */ + bool in_submit_request; union { struct { @@ -321,9 +332,6 @@ struct spdk_bdev_io { } nvme_passthru; } u; - /** Status for the IO */ - enum spdk_bdev_io_status status; - /** Error information from a device */ union { /** Only valid when status is SPDK_BDEV_IO_STATUS_NVME_ERROR */ @@ -352,14 +360,6 @@ struct spdk_bdev_io { /** Context that will be passed to the completion callback */ void *caller_ctx; - /** - * Set to true while the bdev module submit_request function is in progress. - * - * This is used to decide whether spdk_bdev_io_complete() can complete the I/O directly - * or if completion must be deferred via an event. - */ - bool in_submit_request; - /** Member used for linking child I/Os together. */ TAILQ_ENTRY(spdk_bdev_io) link; diff --git a/lib/bdev/bdev.c b/lib/bdev/bdev.c index c6ef715652..6e01f88ad3 100644 --- a/lib/bdev/bdev.c +++ b/lib/bdev/bdev.c @@ -581,7 +581,7 @@ spdk_bdev_get_io(void) abort(); } - memset(bdev_io, 0, sizeof(*bdev_io)); + memset(bdev_io, 0, offsetof(struct spdk_bdev_io, u)); return bdev_io; }