Update after removing struct ocf_io

Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com>
This commit is contained in:
Robert Baldyga 2023-10-13 16:38:02 +02:00
parent 5820e17e21
commit 1e80f2d0c2
3 changed files with 19 additions and 18 deletions

View File

@ -38,7 +38,7 @@ struct blk_data {
/** /**
* @brief CAS IO with which data is associated * @brief CAS IO with which data is associated
*/ */
struct ocf_io *io; ocf_io_t io;
/** /**
* @brief Timestamp of start processing request * @brief Timestamp of start processing request

View File

@ -149,9 +149,9 @@ static void block_dev_forward_io(ocf_volume_t volume,
ocf_forward_token_t token, int dir, uint64_t addr, ocf_forward_token_t token, int dir, uint64_t addr,
uint64_t bytes, uint64_t offset) uint64_t bytes, uint64_t offset)
{ {
struct ocf_io *io = ocf_forward_get_io(token);
struct bd_object *bdobj = bd_object(volume); struct bd_object *bdobj = bd_object(volume);
struct blk_data *data = ocf_io_get_data(io); struct blk_data *data = ocf_forward_get_data(token);
uint64_t flags = ocf_forward_get_flags(token);
int bio_dir = (dir == OCF_READ) ? READ : WRITE; int bio_dir = (dir == OCF_READ) ? READ : WRITE;
struct bio_vec_iter iter; struct bio_vec_iter iter;
struct blk_plug plug; struct blk_plug plug;
@ -182,7 +182,7 @@ static void block_dev_forward_io(ocf_volume_t volume,
CAS_BIO_BISECTOR(bio) = addr / SECTOR_SIZE; CAS_BIO_BISECTOR(bio) = addr / SECTOR_SIZE;
bio->bi_next = NULL; bio->bi_next = NULL;
bio->bi_private = (void *)token; bio->bi_private = (void *)token;
CAS_BIO_OP_FLAGS(bio) |= filter_req_flags(bio_dir, io->flags); CAS_BIO_OP_FLAGS(bio) |= filter_req_flags(bio_dir, flags);
bio->bi_end_io = CAS_REFER_BLOCK_CALLBACK(cas_bd_forward_end); bio->bi_end_io = CAS_REFER_BLOCK_CALLBACK(cas_bd_forward_end);
/* Add pages */ /* Add pages */
@ -248,10 +248,8 @@ static void block_dev_forward_io(ocf_volume_t volume,
static void block_dev_forward_flush(ocf_volume_t volume, static void block_dev_forward_flush(ocf_volume_t volume,
ocf_forward_token_t token) ocf_forward_token_t token)
{ {
struct ocf_io *io = ocf_forward_get_io(token);
struct bd_object *bdobj = bd_object(volume); struct bd_object *bdobj = bd_object(volume);
struct request_queue *q = bdev_get_queue(bdobj->btm_bd); struct request_queue *q = bdev_get_queue(bdobj->btm_bd);
int bio_dir = (io->dir == OCF_READ) ? READ : WRITE;
struct bio *bio; struct bio *bio;
if (!q) { if (!q) {
@ -277,7 +275,7 @@ static void block_dev_forward_flush(ocf_volume_t volume,
bio->bi_private = (void *)token; bio->bi_private = (void *)token;
bio->bi_end_io = CAS_REFER_BLOCK_CALLBACK(cas_bd_forward_end); bio->bi_end_io = CAS_REFER_BLOCK_CALLBACK(cas_bd_forward_end);
cas_submit_bio(CAS_SET_FLUSH(bio_dir), bio); cas_submit_bio(CAS_SET_FLUSH(0), bio);
} }

View File

@ -189,10 +189,11 @@ static void blkdev_complete_data_master(struct blk_data *master, int error)
cas_free_blk_data(master); cas_free_blk_data(master);
} }
static void blkdev_complete_data(struct ocf_io *io, int error) static void blkdev_complete_data(ocf_io_t io, void *priv1, void *priv2,
int error)
{ {
struct bio *bio = io->priv1; struct bio *bio = priv1;
struct blk_data *master = io->priv2; struct blk_data *master = priv2;
struct blk_data *data = ocf_io_get_data(io); struct blk_data *data = ocf_io_get_data(io);
ocf_io_put(io); ocf_io_put(io);
@ -217,7 +218,7 @@ static int blkdev_handle_data_single(struct bd_object *bvol, struct bio *bio,
ocf_cache_t cache = ocf_volume_get_cache(bvol->front_volume); ocf_cache_t cache = ocf_volume_get_cache(bvol->front_volume);
struct cache_priv *cache_priv = ocf_cache_get_priv(cache); struct cache_priv *cache_priv = ocf_cache_get_priv(cache);
ocf_queue_t queue = cache_priv->io_queues[smp_processor_id()]; ocf_queue_t queue = cache_priv->io_queues[smp_processor_id()];
struct ocf_io *io; ocf_io_t io;
struct blk_data *data; struct blk_data *data;
uint64_t flags = CAS_BIO_OP_FLAGS(bio); uint64_t flags = CAS_BIO_OP_FLAGS(bio);
int ret; int ret;
@ -317,9 +318,10 @@ err:
CAS_BIO_ENDIO(bio, CAS_BIO_BISIZE(bio), CAS_ERRNO_TO_BLK_STS(error)); CAS_BIO_ENDIO(bio, CAS_BIO_BISIZE(bio), CAS_ERRNO_TO_BLK_STS(error));
} }
static void blkdev_complete_discard(struct ocf_io *io, int error) static void blkdev_complete_discard(ocf_io_t io, void *priv1, void *priv2,
int error)
{ {
struct bio *bio = io->priv1; struct bio *bio = priv1;
int result = map_cas_err_to_generic(error); int result = map_cas_err_to_generic(error);
CAS_BIO_ENDIO(bio, CAS_BIO_BISIZE(bio), CAS_ERRNO_TO_BLK_STS(result)); CAS_BIO_ENDIO(bio, CAS_BIO_BISIZE(bio), CAS_ERRNO_TO_BLK_STS(result));
@ -331,7 +333,7 @@ static void blkdev_handle_discard(struct bd_object *bvol, struct bio *bio)
ocf_cache_t cache = ocf_volume_get_cache(bvol->front_volume); ocf_cache_t cache = ocf_volume_get_cache(bvol->front_volume);
struct cache_priv *cache_priv = ocf_cache_get_priv(cache); struct cache_priv *cache_priv = ocf_cache_get_priv(cache);
ocf_queue_t queue = cache_priv->io_queues[smp_processor_id()]; ocf_queue_t queue = cache_priv->io_queues[smp_processor_id()];
struct ocf_io *io; ocf_io_t io;
io = ocf_volume_new_io(bvol->front_volume, queue, io = ocf_volume_new_io(bvol->front_volume, queue,
CAS_BIO_BISECTOR(bio) << SECTOR_SHIFT, CAS_BIO_BISECTOR(bio) << SECTOR_SHIFT,
@ -356,10 +358,11 @@ static void blkdev_handle_bio_noflush(struct bd_object *bvol, struct bio *bio)
blkdev_handle_data(bvol, bio); blkdev_handle_data(bvol, bio);
} }
static void blkdev_complete_flush(struct ocf_io *io, int error) static void blkdev_complete_flush(ocf_io_t io, void *priv1, void *priv2,
int error)
{ {
struct bio *bio = io->priv1; struct bio *bio = priv1;
struct bd_object *bvol = io->priv2; struct bd_object *bvol = priv2;
int result = map_cas_err_to_generic(error); int result = map_cas_err_to_generic(error);
ocf_io_put(io); ocf_io_put(io);
@ -378,7 +381,7 @@ static void blkdev_handle_flush(struct bd_object *bvol, struct bio *bio)
ocf_cache_t cache = ocf_volume_get_cache(bvol->front_volume); ocf_cache_t cache = ocf_volume_get_cache(bvol->front_volume);
struct cache_priv *cache_priv = ocf_cache_get_priv(cache); struct cache_priv *cache_priv = ocf_cache_get_priv(cache);
ocf_queue_t queue = cache_priv->io_queues[smp_processor_id()]; ocf_queue_t queue = cache_priv->io_queues[smp_processor_id()];
struct ocf_io *io; ocf_io_t io;
io = ocf_volume_new_io(bvol->front_volume, queue, 0, 0, OCF_WRITE, 0, io = ocf_volume_new_io(bvol->front_volume, queue, 0, 0, OCF_WRITE, 0,
CAS_SET_FLUSH(0)); CAS_SET_FLUSH(0));