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 <benjamin.walker@intel.com>
This commit is contained in:
parent
3415ce1227
commit
ed159eae1b
@ -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;
|
||||
|
||||
|
@ -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:
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
|
@ -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,
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user