From ed159eae1bd54ef87791f8cd0e0a00628b767712 Mon Sep 17 00:00:00 2001 From: Ben Walker Date: Fri, 5 May 2017 13:06:39 -0700 Subject: [PATCH] bdev: Eliminate spdk_bdev_io::ctx The user can get there via the bdev, so this didn't have a purpose. Change-Id: I7f85bb71d5ee238d37ba3624d0ac68a161c95e49 Signed-off-by: Ben Walker --- include/spdk_internal/bdev.h | 3 --- lib/bdev/aio/blockdev_aio.c | 8 ++++---- lib/bdev/bdev.c | 2 -- lib/bdev/malloc/blockdev_malloc.c | 12 ++++++------ lib/bdev/nvme/blockdev_nvme.c | 10 +++++----- lib/bdev/rbd/blockdev_rbd.c | 6 +++--- lib/bdev/split/vbdev_split.c | 2 +- 7 files changed, 19 insertions(+), 24 deletions(-) diff --git a/include/spdk_internal/bdev.h b/include/spdk_internal/bdev.h index 87755d3ec..03edcf708 100644 --- a/include/spdk_internal/bdev.h +++ b/include/spdk_internal/bdev.h @@ -148,9 +148,6 @@ struct spdk_bdev_fn_table { typedef void (*spdk_bdev_io_get_rbuf_cb)(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io); struct spdk_bdev_io { - /** Pointer to scratch area reserved for use by the driver consuming this spdk_bdev_io. */ - void *ctx; - /** The block device that this I/O belongs to. */ struct spdk_bdev *bdev; diff --git a/lib/bdev/aio/blockdev_aio.c b/lib/bdev/aio/blockdev_aio.c index 19e150c4a..a928ea8ff 100644 --- a/lib/bdev/aio/blockdev_aio.c +++ b/lib/bdev/aio/blockdev_aio.c @@ -226,7 +226,7 @@ blockdev_aio_reset(struct file_disk *fdisk, struct blockdev_aio_task *aio_task) static void blockdev_aio_get_rbuf_cb(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io) { - blockdev_aio_readv((struct file_disk *)bdev_io->ctx, + blockdev_aio_readv((struct file_disk *)bdev_io->bdev->ctxt, ch, (struct blockdev_aio_task *)bdev_io->driver_ctx, bdev_io->u.read.iovs, @@ -243,7 +243,7 @@ static int _blockdev_aio_submit_request(struct spdk_io_channel *ch, struct spdk_ return 0; case SPDK_BDEV_IO_TYPE_WRITE: - blockdev_aio_writev((struct file_disk *)bdev_io->ctx, + blockdev_aio_writev((struct file_disk *)bdev_io->bdev->ctxt, ch, (struct blockdev_aio_task *)bdev_io->driver_ctx, bdev_io->u.write.iovs, @@ -252,14 +252,14 @@ static int _blockdev_aio_submit_request(struct spdk_io_channel *ch, struct spdk_ bdev_io->u.write.offset); return 0; case SPDK_BDEV_IO_TYPE_FLUSH: - blockdev_aio_flush((struct file_disk *)bdev_io->ctx, + blockdev_aio_flush((struct file_disk *)bdev_io->bdev->ctxt, (struct blockdev_aio_task *)bdev_io->driver_ctx, bdev_io->u.flush.offset, bdev_io->u.flush.length); return 0; case SPDK_BDEV_IO_TYPE_RESET: - blockdev_aio_reset((struct file_disk *)bdev_io->ctx, + blockdev_aio_reset((struct file_disk *)bdev_io->bdev->ctxt, (struct blockdev_aio_task *)bdev_io->driver_ctx); return 0; default: diff --git a/lib/bdev/bdev.c b/lib/bdev/bdev.c index e5d0f7c9a..6e353568b 100644 --- a/lib/bdev/bdev.c +++ b/lib/bdev/bdev.c @@ -455,7 +455,6 @@ spdk_bdev_io_resubmit(struct spdk_bdev_io *bdev_io, struct spdk_bdev *new_bdev) * being switched, they need to be reinitialized. */ bdev_io->gencnt = new_bdev->gencnt; - bdev_io->ctx = new_bdev->ctxt; __submit_request(new_bdev, bdev_io); } @@ -466,7 +465,6 @@ spdk_bdev_io_init(struct spdk_bdev_io *bdev_io, spdk_bdev_io_completion_cb cb) { bdev_io->bdev = bdev; - bdev_io->ctx = bdev->ctxt; bdev_io->caller_ctx = cb_arg; bdev_io->cb = cb; bdev_io->gencnt = bdev->gencnt; diff --git a/lib/bdev/malloc/blockdev_malloc.c b/lib/bdev/malloc/blockdev_malloc.c index a45ffe511..f9644f840 100644 --- a/lib/bdev/malloc/blockdev_malloc.c +++ b/lib/bdev/malloc/blockdev_malloc.c @@ -277,7 +277,7 @@ static int _blockdev_malloc_submit_request(struct spdk_io_channel *ch, struct sp if (bdev_io->u.read.iovs[0].iov_base == NULL) { assert(bdev_io->u.read.iovcnt == 1); bdev_io->u.read.iovs[0].iov_base = - ((struct malloc_disk *)bdev_io->ctx)->malloc_buf + + ((struct malloc_disk *)bdev_io->bdev->ctxt)->malloc_buf + bdev_io->u.read.offset; bdev_io->u.read.iovs[0].iov_len = bdev_io->u.read.len; bdev_io->u.read.put_rbuf = false; @@ -286,7 +286,7 @@ static int _blockdev_malloc_submit_request(struct spdk_io_channel *ch, struct sp return 0; } - blockdev_malloc_readv((struct malloc_disk *)bdev_io->ctx, + blockdev_malloc_readv((struct malloc_disk *)bdev_io->bdev->ctxt, ch, (struct malloc_task *)bdev_io->driver_ctx, bdev_io->u.read.iovs, @@ -296,7 +296,7 @@ static int _blockdev_malloc_submit_request(struct spdk_io_channel *ch, struct sp return 0; case SPDK_BDEV_IO_TYPE_WRITE: - blockdev_malloc_writev((struct malloc_disk *)bdev_io->ctx, + blockdev_malloc_writev((struct malloc_disk *)bdev_io->bdev->ctxt, ch, (struct malloc_task *)bdev_io->driver_ctx, bdev_io->u.write.iovs, @@ -306,17 +306,17 @@ static int _blockdev_malloc_submit_request(struct spdk_io_channel *ch, struct sp return 0; case SPDK_BDEV_IO_TYPE_RESET: - return blockdev_malloc_reset((struct malloc_disk *)bdev_io->ctx, + return blockdev_malloc_reset((struct malloc_disk *)bdev_io->bdev->ctxt, (struct malloc_task *)bdev_io->driver_ctx); case SPDK_BDEV_IO_TYPE_FLUSH: - return blockdev_malloc_flush((struct malloc_disk *)bdev_io->ctx, + return blockdev_malloc_flush((struct malloc_disk *)bdev_io->bdev->ctxt, (struct malloc_task *)bdev_io->driver_ctx, bdev_io->u.flush.offset, bdev_io->u.flush.length); case SPDK_BDEV_IO_TYPE_UNMAP: - return blockdev_malloc_unmap((struct malloc_disk *)bdev_io->ctx, + return blockdev_malloc_unmap((struct malloc_disk *)bdev_io->bdev->ctxt, ch, (struct malloc_task *)bdev_io->driver_ctx, bdev_io->u.unmap.unmap_bdesc, diff --git a/lib/bdev/nvme/blockdev_nvme.c b/lib/bdev/nvme/blockdev_nvme.c index 132d81e04..a30727385 100644 --- a/lib/bdev/nvme/blockdev_nvme.c +++ b/lib/bdev/nvme/blockdev_nvme.c @@ -259,7 +259,7 @@ bdev_nvme_get_rbuf_cb(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io) { int ret; - ret = bdev_nvme_readv((struct nvme_bdev *)bdev_io->ctx, + ret = bdev_nvme_readv((struct nvme_bdev *)bdev_io->bdev->ctxt, ch, (struct nvme_bdev_io *)bdev_io->driver_ctx, bdev_io->u.read.iovs, @@ -281,7 +281,7 @@ _bdev_nvme_submit_request(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_ return 0; case SPDK_BDEV_IO_TYPE_WRITE: - return bdev_nvme_writev((struct nvme_bdev *)bdev_io->ctx, + return bdev_nvme_writev((struct nvme_bdev *)bdev_io->bdev->ctxt, ch, (struct nvme_bdev_io *)bdev_io->driver_ctx, bdev_io->u.write.iovs, @@ -290,18 +290,18 @@ _bdev_nvme_submit_request(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_ bdev_io->u.write.offset); case SPDK_BDEV_IO_TYPE_UNMAP: - return bdev_nvme_unmap((struct nvme_bdev *)bdev_io->ctx, + return bdev_nvme_unmap((struct nvme_bdev *)bdev_io->bdev->ctxt, ch, (struct nvme_bdev_io *)bdev_io->driver_ctx, bdev_io->u.unmap.unmap_bdesc, bdev_io->u.unmap.bdesc_count); case SPDK_BDEV_IO_TYPE_RESET: - return bdev_nvme_reset((struct nvme_bdev *)bdev_io->ctx, + return bdev_nvme_reset((struct nvme_bdev *)bdev_io->bdev->ctxt, (struct nvme_bdev_io *)bdev_io->driver_ctx); case SPDK_BDEV_IO_TYPE_FLUSH: - return bdev_nvme_flush((struct nvme_bdev *)bdev_io->ctx, + return bdev_nvme_flush((struct nvme_bdev *)bdev_io->bdev->ctxt, (struct nvme_bdev_io *)bdev_io->driver_ctx, bdev_io->u.flush.offset, bdev_io->u.flush.length); diff --git a/lib/bdev/rbd/blockdev_rbd.c b/lib/bdev/rbd/blockdev_rbd.c index 13416696d..6ea916118 100644 --- a/lib/bdev/rbd/blockdev_rbd.c +++ b/lib/bdev/rbd/blockdev_rbd.c @@ -256,7 +256,7 @@ static void blockdev_rbd_get_rbuf_cb(struct spdk_io_channel *ch, struct spdk_bde { int ret; - ret = blockdev_rbd_readv(bdev_io->ctx, + ret = blockdev_rbd_readv(bdev_io->bdev->ctxt, ch, (struct blockdev_rbd_io *)bdev_io->driver_ctx, bdev_io->u.read.iovs, @@ -277,7 +277,7 @@ static int _blockdev_rbd_submit_request(struct spdk_io_channel *ch, struct spdk_ return 0; case SPDK_BDEV_IO_TYPE_WRITE: - return blockdev_rbd_writev((struct blockdev_rbd *)bdev_io->ctx, + return blockdev_rbd_writev((struct blockdev_rbd *)bdev_io->bdev->ctxt, ch, (struct blockdev_rbd_io *)bdev_io->driver_ctx, bdev_io->u.write.iovs, @@ -285,7 +285,7 @@ static int _blockdev_rbd_submit_request(struct spdk_io_channel *ch, struct spdk_ bdev_io->u.write.len, bdev_io->u.write.offset); case SPDK_BDEV_IO_TYPE_FLUSH: - return blockdev_rbd_flush((struct blockdev_rbd *)bdev_io->ctx, + return blockdev_rbd_flush((struct blockdev_rbd *)bdev_io->bdev->ctxt, ch, (struct blockdev_rbd_io *)bdev_io->driver_ctx, bdev_io->u.flush.offset, diff --git a/lib/bdev/split/vbdev_split.c b/lib/bdev/split/vbdev_split.c index e28b5c59a..afd607719 100644 --- a/lib/bdev/split/vbdev_split.c +++ b/lib/bdev/split/vbdev_split.c @@ -112,7 +112,7 @@ split_reset(struct split_disk *split_disk, struct spdk_bdev_io *bdev_io) static void vbdev_split_submit_request(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io) { - struct split_disk *split_disk = bdev_io->ctx; + struct split_disk *split_disk = bdev_io->bdev->ctxt; /* Modify the I/O to adjust for the offset within the base bdev. */ switch (bdev_io->type) {