Add support for kernel 5.11
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
@@ -1068,7 +1068,6 @@ out_bdev:
|
||||
int cache_mngt_prepare_core_cfg(struct ocf_mngt_core_config *cfg,
|
||||
struct kcas_insert_core *cmd_info)
|
||||
{
|
||||
struct block_device *bdev;
|
||||
char core_name[OCF_CORE_NAME_SIZE] = {};
|
||||
ocf_cache_t cache;
|
||||
uint16_t core_id;
|
||||
@@ -1109,10 +1108,8 @@ int cache_mngt_prepare_core_cfg(struct ocf_mngt_core_config *cfg,
|
||||
return 0;
|
||||
}
|
||||
|
||||
bdev = CAS_LOOKUP_BDEV(cfg->uuid.data);
|
||||
if (IS_ERR(bdev))
|
||||
if (!cas_bdev_exist(cfg->uuid.data))
|
||||
return -OCF_ERR_INVAL_VOLUME_TYPE;
|
||||
bdput(bdev);
|
||||
|
||||
if (cmd_info->update_path)
|
||||
return 0;
|
||||
@@ -1135,9 +1132,7 @@ static int cache_mngt_update_core_uuid(ocf_cache_t cache, const char *core_name,
|
||||
{
|
||||
ocf_core_t core;
|
||||
ocf_volume_t vol;
|
||||
struct block_device *bdev;
|
||||
struct bd_object *bdvol;
|
||||
bool match;
|
||||
int result;
|
||||
|
||||
if (ocf_core_get_by_name(cache, core_name, name_len, &core)) {
|
||||
@@ -1154,19 +1149,7 @@ static int cache_mngt_update_core_uuid(ocf_cache_t cache, const char *core_name,
|
||||
vol = ocf_core_get_volume(core);
|
||||
bdvol = bd_object(vol);
|
||||
|
||||
/* lookup block device object for device pointed by uuid */
|
||||
bdev = CAS_LOOKUP_BDEV(uuid->data);
|
||||
if (IS_ERR(bdev)) {
|
||||
printk(KERN_ERR "failed to lookup bdev%s\n", (char*)uuid->data);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* check whether both core id and uuid point to the same block device */
|
||||
match = (bdvol->btm_bd == bdev);
|
||||
|
||||
bdput(bdev);
|
||||
|
||||
if (!match) {
|
||||
if (!cas_bdev_match(uuid->data, bdvol->btm_bd)) {
|
||||
printk(KERN_ERR "UUID provided does not match target core device\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
@@ -1766,7 +1749,7 @@ int cache_mngt_prepare_cache_cfg(struct ocf_mngt_cache_config *cfg,
|
||||
-OCF_ERR_INVAL_VOLUME_TYPE;
|
||||
}
|
||||
|
||||
is_part = (bdev->bd_contains != bdev);
|
||||
is_part = (cas_bdev_whole(bdev) != bdev);
|
||||
part_count = cas_blk_get_part_count(bdev);
|
||||
blkdev_put(bdev, (FMODE_EXCL|FMODE_READ));
|
||||
|
||||
@@ -1872,7 +1855,7 @@ static void init_instance_complete(struct _cache_mngt_attach_context *ctx,
|
||||
bdev = bd_cache_obj->btm_bd;
|
||||
|
||||
/* If we deal with whole device, reread partitions */
|
||||
if (bdev->bd_contains == bdev)
|
||||
if (cas_bdev_whole(bdev) == bdev)
|
||||
cas_reread_partitions(bdev);
|
||||
|
||||
/* Set other back information */
|
||||
|
||||
@@ -303,7 +303,7 @@ int cas_blk_identify_type_by_bdev(struct block_device *bdev,
|
||||
atomic_params_int.is_mode_optimal = 1;
|
||||
break;
|
||||
#else
|
||||
if (bdev == bdev->bd_contains) {
|
||||
if (bdev == cas_bdev_whole(bdev)) {
|
||||
/*
|
||||
* Entire device - format isn't optimal
|
||||
*/
|
||||
|
||||
@@ -84,9 +84,9 @@ uint64_t block_dev_get_byte_length(ocf_volume_t vol)
|
||||
struct block_device *bd = bdobj->btm_bd;
|
||||
uint64_t sector_length;
|
||||
|
||||
sector_length = (bd->bd_contains == bd) ?
|
||||
sector_length = (cas_bdev_whole(bd) == bd) ?
|
||||
get_capacity(bd->bd_disk) :
|
||||
bd->bd_part->nr_sects;
|
||||
cas_bdev_nr_sectors(bd);
|
||||
|
||||
return sector_length << SECTOR_SHIFT;
|
||||
}
|
||||
|
||||
@@ -30,21 +30,6 @@ static void _blockdev_set_bio_data(struct blk_data *data, struct bio *bio)
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline unsigned long long _blockdev_start_io_acct(struct bio *bio)
|
||||
{
|
||||
struct gendisk *gd = CAS_BIO_GET_DEV(bio);
|
||||
|
||||
return cas_generic_start_io_acct(gd->queue, bio, &gd->part0);
|
||||
}
|
||||
|
||||
static inline void _blockdev_end_io_acct(struct bio *bio,
|
||||
unsigned long start_time)
|
||||
{
|
||||
struct gendisk *gd = CAS_BIO_GET_DEV(bio);
|
||||
|
||||
cas_generic_end_io_acct(gd->queue, bio, &gd->part0, start_time);
|
||||
}
|
||||
|
||||
static inline int _blkdev_can_hndl_bio(struct bio *bio)
|
||||
{
|
||||
if (CAS_CHECK_BARRIER(bio)) {
|
||||
@@ -140,7 +125,7 @@ static int _blockdev_set_geometry(struct casdsk_disk *dsk, void *private)
|
||||
cache_bd = casdisk_functions.casdsk_disk_get_blkdev(bd_cache_vol->dsk);
|
||||
BUG_ON(!cache_bd);
|
||||
|
||||
core_q = core_bd->bd_contains->bd_disk->queue;
|
||||
core_q = cas_bdev_whole(core_bd)->bd_disk->queue;
|
||||
cache_q = cache_bd->bd_disk->queue;
|
||||
exp_q = casdisk_functions.casdsk_exp_obj_get_queue(dsk);
|
||||
|
||||
@@ -215,7 +200,7 @@ static void block_dev_complete_data(struct ocf_io *io, int error)
|
||||
struct blk_data *data = ocf_io_get_data(io);
|
||||
struct bio *bio = data->master_io_req;
|
||||
|
||||
_blockdev_end_io_acct(bio, data->start_time);
|
||||
cas_generic_end_io_acct(bio, data->start_time);
|
||||
|
||||
CAS_BIO_ENDIO(bio, CAS_BIO_BISIZE(bio), CAS_ERRNO_TO_BLK_STS(error));
|
||||
ocf_io_put(io);
|
||||
@@ -275,7 +260,7 @@ static void _blockdev_handle_data(ocf_core_t core, struct bio *bio)
|
||||
}
|
||||
|
||||
ocf_io_set_cmpl(io, NULL, NULL, block_dev_complete_data);
|
||||
data->start_time = _blockdev_start_io_acct(bio);
|
||||
data->start_time = cas_generic_start_io_acct(bio);
|
||||
|
||||
ocf_core_submit_io(io);
|
||||
}
|
||||
@@ -296,7 +281,8 @@ static void _blockdev_handle_discard(ocf_core_t core, struct bio *bio)
|
||||
|
||||
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);
|
||||
CAS_BIO_BISIZE(bio), OCF_WRITE, 0,
|
||||
CAS_CLEAR_FLUSH(CAS_BIO_OP_FLAGS(bio)));
|
||||
|
||||
if (!io) {
|
||||
CAS_PRINT_RL(KERN_CRIT
|
||||
|
||||
Reference in New Issue
Block a user