Adapt to new ocf_io API
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
parent
d01c26d629
commit
231ae815c5
@ -108,7 +108,7 @@ static struct cas_atomic_io *cas_atomic_alloc(int dir, struct ocf_io *io, bool w
|
||||
|
||||
/* Get number of IOs to be issued */
|
||||
uint32_t ios_count;
|
||||
ocf_cache_t cache = ocf_volume_get_cache(io->volume);
|
||||
ocf_cache_t cache = ocf_volume_get_cache(ocf_io_get_volume(io));
|
||||
|
||||
uint64_t addr = io->addr;
|
||||
uint32_t i, bytes = io->bytes;
|
||||
@ -161,7 +161,7 @@ static struct cas_atomic_io *cas_atomic_alloc(int dir, struct ocf_io *io, bool w
|
||||
this->bytes = min(bytes, max_io_size);
|
||||
this->dir = dir;
|
||||
this->flags = io->flags;
|
||||
this->volume = io->volume;
|
||||
this->volume = ocf_io_get_volume(io);
|
||||
|
||||
CAS_DEBUG_PARAM("Sub-atomic IO (%u), Addr = %llu, bytes = %u",
|
||||
i, this->addr, this->bytes);
|
||||
@ -326,7 +326,7 @@ static int cas_atomic_wr_prepare(struct ocf_io *io,
|
||||
uint64_t addr = atom->addr;
|
||||
uint32_t bytes = atom->bytes;
|
||||
|
||||
cache = ocf_volume_get_cache(io->volume);
|
||||
cache = ocf_volume_get_cache(ocf_io_get_volume(io));
|
||||
|
||||
/* Initialize iterators */
|
||||
cas_io_iter_init(&dst, atom->data->vec, atom->bvec_size);
|
||||
@ -765,7 +765,7 @@ static int cas_atomic_submit_discard_bio(struct cas_atomic_io *atom)
|
||||
static int cas_atomic_special_req_prepare(struct cas_atomic_io *atom,
|
||||
struct ocf_io *io)
|
||||
{
|
||||
struct bd_object *bdobj = bd_object(io->volume);
|
||||
struct bd_object *bdobj = bd_object(ocf_io_get_volume(io));
|
||||
struct block_device *bdev = bdobj->btm_bd;
|
||||
|
||||
CAS_DEBUG_TRACE();
|
||||
@ -773,7 +773,7 @@ static int cas_atomic_special_req_prepare(struct cas_atomic_io *atom,
|
||||
atom->count = 1;
|
||||
atom->cmpl_fn = io->end;
|
||||
atom->cmpl_context = io;
|
||||
atom->volume = io->volume;
|
||||
atom->volume = ocf_io_get_volume(io);
|
||||
atom->flags = io->flags;
|
||||
atomic_set(&atom->req_remaining, 1);
|
||||
|
||||
@ -792,7 +792,7 @@ static int cas_atomic_special_req_prepare(struct cas_atomic_io *atom,
|
||||
|
||||
void cas_atomic_submit_discard(struct ocf_io *io)
|
||||
{
|
||||
struct bd_object *bdobj = bd_object(io->volume);
|
||||
struct bd_object *bdobj = bd_object(ocf_io_get_volume(io));
|
||||
struct block_device *bdev = bdobj->btm_bd;
|
||||
struct request_queue *q = bdev_get_queue(bdev);
|
||||
int result = 0;
|
||||
@ -849,7 +849,7 @@ out:
|
||||
void cas_atomic_submit_flush(struct ocf_io *io)
|
||||
{
|
||||
#ifdef CAS_FLUSH_SUPPORTED
|
||||
struct bd_object *bdobj = bd_object(io->volume);
|
||||
struct bd_object *bdobj = bd_object(ocf_io_get_volume(io));
|
||||
struct block_device *bdev = bdobj->btm_bd;
|
||||
struct request_queue *q = bdev_get_queue(bdev);
|
||||
int result = 0;
|
||||
@ -1049,7 +1049,7 @@ static void _cas_atomic_write_zeroes_end(struct cas_atomic_write_zero_ctx *ctx,
|
||||
static void _cas_atomic_write_zeroes_step_cmpl(struct ocf_io *io, int error)
|
||||
{
|
||||
struct cas_atomic_write_zero_ctx *ctx = io->priv1;
|
||||
struct bd_object *bdobj = bd_object(io->volume);
|
||||
struct bd_object *bdobj = bd_object(ocf_io_get_volume(io));
|
||||
const unsigned bytes_processed = (io->addr - ctx->original_io->addr)
|
||||
+ io->bytes;
|
||||
const unsigned bytes_left = ctx->original_io->bytes - bytes_processed;
|
||||
@ -1097,7 +1097,9 @@ void cas_atomic_submit_write_zeroes(struct ocf_io *io)
|
||||
goto error;
|
||||
}
|
||||
|
||||
ctx->sub_io = ocf_volume_new_io(io->volume);
|
||||
ctx->sub_io = ocf_volume_new_io(ocf_io_get_volume(io), io->io_queue,
|
||||
io->addr, min(io->bytes, ctx->step_size),
|
||||
OCF_WRITE, 0, 0);
|
||||
if (!ctx->sub_io) {
|
||||
result = -ENOMEM;
|
||||
goto error_after_ctx;
|
||||
@ -1112,9 +1114,6 @@ void cas_atomic_submit_write_zeroes(struct ocf_io *io)
|
||||
ocf_io_get(io);
|
||||
|
||||
/* set up sub-io */
|
||||
ocf_io_configure(ctx->sub_io, io->addr,
|
||||
min(io->bytes, ctx->step_size),
|
||||
OCF_WRITE, 0, 0);
|
||||
ocf_io_set_cmpl(ctx->sub_io, ctx, NULL, _cas_atomic_write_zeroes_step_cmpl);
|
||||
|
||||
cas_atomic_fire_io(ctx->sub_io, NULL, true);
|
||||
|
@ -210,7 +210,7 @@ CAS_DECLARE_BLOCK_CALLBACK(cas_bd_io_end, struct bio *bio,
|
||||
BUG_ON(!bio->bi_private);
|
||||
CAS_BLOCK_CALLBACK_INIT(bio);
|
||||
io = bio->bi_private;
|
||||
bdobj = bd_object(io->volume);
|
||||
bdobj = bd_object(ocf_io_get_volume(io));
|
||||
BUG_ON(!bdobj);
|
||||
err = CAS_BLOCK_CALLBACK_ERROR(bio, error);
|
||||
bdio = cas_io_to_blkio(io);
|
||||
@ -248,7 +248,7 @@ static void block_dev_submit_flush(struct ocf_io *io)
|
||||
{
|
||||
#ifdef CAS_FLUSH_SUPPORTED
|
||||
struct blkio *blkio = cas_io_to_blkio(io);
|
||||
struct bd_object *bdobj = bd_object(io->volume);
|
||||
struct bd_object *bdobj = bd_object(ocf_io_get_volume(io));
|
||||
struct block_device *bdev = bdobj->btm_bd;
|
||||
struct request_queue *q = bdev_get_queue(bdev);
|
||||
struct bio *bio = NULL;
|
||||
@ -315,7 +315,7 @@ out:
|
||||
void block_dev_submit_discard(struct ocf_io *io)
|
||||
{
|
||||
struct blkio *blkio = cas_io_to_blkio(io);
|
||||
struct bd_object *bdobj = bd_object(io->volume);
|
||||
struct bd_object *bdobj = bd_object(ocf_io_get_volume(io));
|
||||
struct block_device *bd = bdobj->btm_bd;
|
||||
struct request_queue *q = bdev_get_queue(bd);
|
||||
struct bio *bio = NULL;
|
||||
@ -396,7 +396,7 @@ out:
|
||||
static inline bool cas_bd_io_prepare(int *dir, struct ocf_io *io)
|
||||
{
|
||||
struct blkio *bdio = cas_io_to_blkio(io);
|
||||
struct bd_object *bdobj = bd_object(io->volume);
|
||||
struct bd_object *bdobj = bd_object(ocf_io_get_volume(io));
|
||||
|
||||
/* Setup DIR */
|
||||
bdio->dir = *dir;
|
||||
@ -437,7 +437,7 @@ static inline bool cas_bd_io_prepare(int *dir, struct ocf_io *io)
|
||||
static void block_dev_submit_io(struct ocf_io *io)
|
||||
{
|
||||
struct blkio *bdio = cas_io_to_blkio(io);
|
||||
struct bd_object *bdobj = bd_object(io->volume);
|
||||
struct bd_object *bdobj = bd_object(ocf_io_get_volume(io));
|
||||
struct bio_vec_iter *iter = &bdio->iter;
|
||||
uint64_t addr = io->addr;
|
||||
uint32_t bytes = io->bytes;
|
||||
|
@ -212,7 +212,13 @@ static int _blockdev_alloc_many_requests(ocf_core_t core,
|
||||
|
||||
data->master_io_req = master;
|
||||
|
||||
sub_io = ocf_core_new_io(core);
|
||||
sub_io = ocf_core_new_io(core,
|
||||
cache_priv->io_queues[smp_processor_id()],
|
||||
CAS_BIO_BISECTOR(bio) << SECTOR_SHIFT,
|
||||
CAS_BIO_BISIZE(bio), (bio_data_dir(bio) == READ) ?
|
||||
OCF_READ : OCF_WRITE,
|
||||
cas_cls_classify(cache, bio), flags);
|
||||
|
||||
if (!sub_io) {
|
||||
cas_free_blk_data(data);
|
||||
error = -ENOMEM;
|
||||
@ -221,11 +227,6 @@ static int _blockdev_alloc_many_requests(ocf_core_t core,
|
||||
|
||||
data->io = sub_io;
|
||||
|
||||
ocf_io_configure(sub_io, CAS_BIO_BISECTOR(bio) << SECTOR_SHIFT,
|
||||
CAS_BIO_BISIZE(bio), (bio_data_dir(bio) == READ) ?
|
||||
OCF_READ : OCF_WRITE,
|
||||
cas_cls_classify(cache, bio), flags);
|
||||
|
||||
error = ocf_io_set_data(sub_io, data, 0);
|
||||
if (error) {
|
||||
ocf_io_put(sub_io);
|
||||
@ -233,7 +234,6 @@ static int _blockdev_alloc_many_requests(ocf_core_t core,
|
||||
break;
|
||||
}
|
||||
|
||||
ocf_io_set_queue(sub_io, cache_priv->io_queues[smp_processor_id()]);
|
||||
ocf_io_set_cmpl(sub_io, NULL, NULL, block_dev_complete_sub_rq);
|
||||
|
||||
list_add_tail(&data->list, list);
|
||||
@ -291,13 +291,11 @@ static int _blkdev_handle_flush_request(struct request *rq, ocf_core_t core)
|
||||
ocf_cache_t cache = ocf_core_get_cache(core);
|
||||
struct cache_priv *cache_priv = ocf_cache_get_priv(cache);
|
||||
|
||||
io = ocf_core_new_io(core);
|
||||
io = ocf_core_new_io(core, cache_priv->io_queues[smp_processor_id()],
|
||||
0, 0, OCF_WRITE, 0, CAS_WRITE_FLUSH);
|
||||
if (!io)
|
||||
return -ENOMEM;
|
||||
|
||||
ocf_io_configure(io, 0, 0, OCF_WRITE, 0, CAS_WRITE_FLUSH);
|
||||
|
||||
ocf_io_set_queue(io, cache_priv->io_queues[smp_processor_id()]);
|
||||
ocf_io_set_cmpl(io, rq, NULL, block_dev_complete_flush);
|
||||
|
||||
ocf_core_submit_flush(io);
|
||||
@ -416,16 +414,16 @@ static int _blkdev_handle_request(struct request *rq, ocf_core_t core)
|
||||
return _blkdev_handle_flush_request(rq, core);
|
||||
}
|
||||
|
||||
io = ocf_core_new_io(core);
|
||||
io = ocf_core_new_io(core, cache_priv->io_queues[smp_processor_id()],
|
||||
BLK_RQ_POS(rq) << SECTOR_SHIFT, BLK_RQ_BYTES(rq),
|
||||
(rq_data_dir(rq) == CAS_RQ_DATA_DIR_WR) ?
|
||||
OCF_WRITE : OCF_READ,
|
||||
cas_cls_classify(cache, rq->bio), master_flags);
|
||||
if (!io) {
|
||||
CAS_PRINT_RL(KERN_CRIT "Out of memory. Ending IO processing.\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
ocf_io_configure(io, BLK_RQ_POS(rq) << SECTOR_SHIFT, BLK_RQ_BYTES(rq),
|
||||
(rq_data_dir(rq) == CAS_RQ_DATA_DIR_WR) ?
|
||||
OCF_WRITE : OCF_READ,
|
||||
cas_cls_classify(cache, rq->bio), master_flags);
|
||||
|
||||
size = _blkdev_scan_request(cache, rq, io, &single_io);
|
||||
|
||||
@ -455,7 +453,6 @@ static int _blkdev_handle_request(struct request *rq, ocf_core_t core)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ocf_io_set_queue(io, cache_priv->io_queues[smp_processor_id()]);
|
||||
ocf_io_set_cmpl(io, NULL, NULL, block_dev_complete_rq);
|
||||
|
||||
ocf_core_submit_io(io);
|
||||
@ -709,7 +706,10 @@ static void _blockdev_make_request_discard(struct casdsk_disk *dsk,
|
||||
struct cache_priv *cache_priv = ocf_cache_get_priv(cache);
|
||||
struct ocf_io *io;
|
||||
|
||||
io = ocf_core_new_io(core);
|
||||
io = ocf_core_new_io(core, cache_priv->io_queues[smp_processor_id()],
|
||||
CAS_BIO_BISECTOR(bio) << SECTOR_SHIFT,
|
||||
CAS_BIO_BISIZE(bio), OCF_WRITE, 0, 0);
|
||||
|
||||
if (!io) {
|
||||
CAS_PRINT_RL(KERN_CRIT
|
||||
"Out of memory. Ending IO processing.\n");
|
||||
@ -717,10 +717,6 @@ static void _blockdev_make_request_discard(struct casdsk_disk *dsk,
|
||||
return;
|
||||
}
|
||||
|
||||
ocf_io_configure(io, CAS_BIO_BISECTOR(bio) << SECTOR_SHIFT, CAS_BIO_BISIZE(bio),
|
||||
0, 0, 0);
|
||||
|
||||
ocf_io_set_queue(io, cache_priv->io_queues[smp_processor_id()]);
|
||||
ocf_io_set_cmpl(io, bio, NULL, block_dev_complete_bio_discard);
|
||||
|
||||
ocf_core_submit_discard(io);
|
||||
@ -775,7 +771,12 @@ static int _blockdev_make_request_fast(struct casdsk_disk *dsk,
|
||||
data->master_io_req = bio;
|
||||
data->start_time = jiffies;
|
||||
|
||||
io = ocf_core_new_io(core);
|
||||
io = ocf_core_new_io(core, cache_priv->io_queues[smp_processor_id()],
|
||||
CAS_BIO_BISECTOR(bio) << SECTOR_SHIFT,
|
||||
CAS_BIO_BISIZE(bio), (bio_data_dir(bio) == READ) ?
|
||||
OCF_READ : OCF_WRITE,
|
||||
cas_cls_classify(cache, bio), 0);
|
||||
|
||||
if (!io) {
|
||||
printk(KERN_CRIT "Out of memory. Ending IO processing.\n");
|
||||
cas_free_blk_data(data);
|
||||
@ -783,10 +784,6 @@ static int _blockdev_make_request_fast(struct casdsk_disk *dsk,
|
||||
return CASDSK_BIO_HANDLED;
|
||||
}
|
||||
|
||||
ocf_io_configure(io, CAS_BIO_BISECTOR(bio) << SECTOR_SHIFT, CAS_BIO_BISIZE(bio),
|
||||
(bio_data_dir(bio) == READ) ? OCF_READ : OCF_WRITE,
|
||||
cas_cls_classify(cache, bio), 0);
|
||||
|
||||
ret = ocf_io_set_data(io, data, 0);
|
||||
if (ret < 0) {
|
||||
ocf_io_put(io);
|
||||
@ -795,7 +792,6 @@ static int _blockdev_make_request_fast(struct casdsk_disk *dsk,
|
||||
return CASDSK_BIO_HANDLED;
|
||||
}
|
||||
|
||||
ocf_io_set_queue(io, cache_priv->io_queues[smp_processor_id()]);
|
||||
ocf_io_set_cmpl(io, NULL, NULL, block_dev_complete_bio_fast);
|
||||
ocf_io_set_start(io, block_dev_start_bio_fast);
|
||||
|
||||
|
2
ocf
2
ocf
@ -1 +1 @@
|
||||
Subproject commit 999f3f724548cf69bb93b96cd17a5c122c178caf
|
||||
Subproject commit aa02f56b052a636e30c282a4b0efef4b3bb9808e
|
Loading…
Reference in New Issue
Block a user