Merge pull request #1053 from hammerg/fix_kernel_5.12_v2

Add a support for kernel 5.12
This commit is contained in:
Robert Baldyga
2022-03-08 08:25:58 +01:00
committed by GitHub
8 changed files with 136 additions and 48 deletions

View File

@@ -4,7 +4,6 @@
*/
#include "cas_cache.h"
#include "utils/utils_blk.h"
#include "threads.h"
extern u32 max_writeback_queue_size;

View File

@@ -46,7 +46,7 @@ MODULE_PARM_DESC(seq_cut_off_mb,
ocf_ctx_t cas_ctx;
struct casdsk_functions_mapper casdisk_functions;
#ifdef SYMBOL_LOOKUP_SUPPORTED
#if defined(SYMBOL_LOOKUP_SUPPORTED) && defined(MODULE_MUTEX_SUPPORTED)
struct exported_symbol {
char *name;
@@ -83,7 +83,9 @@ int static cas_find_symbol(void *data, const char *namebuf,
int static cas_casdisk_lookup_funtions(void)
{
#ifdef MODULE_MUTEX_SUPPORTED
mutex_lock(&module_mutex);
#endif
cas_lookup_symbol(casdsk_disk_detach);
cas_lookup_symbol(casdsk_exp_obj_destroy);
cas_lookup_symbol(casdsk_exp_obj_create);
@@ -105,7 +107,9 @@ int static cas_casdisk_lookup_funtions(void)
cas_lookup_symbol(casdsk_disk_open);
cas_lookup_symbol(casdsk_disk_clear_pt);
cas_lookup_symbol(casdsk_exp_obj_get_gendisk);
#ifdef MODULE_MUTEX_SUPPORTED
mutex_unlock(&module_mutex);
#endif
return 0;
}

View File

@@ -1,22 +0,0 @@
/*
* Copyright(c) 2012-2021 Intel Corporation
* SPDX-License-Identifier: BSD-3-Clause
*/
#include "utils_blk.h"
int cas_blk_get_part_count(struct block_device *bdev)
{
struct disk_part_tbl *ptbl;
int i, count = 0;
rcu_read_lock();
ptbl = rcu_dereference(bdev->bd_disk->part_tbl);
for (i = 0; i < ptbl->len; ++i) {
if (rcu_access_pointer(ptbl->part[i]))
count++;
}
rcu_read_unlock();
return count;
}

View File

@@ -1,14 +0,0 @@
/*
* Copyright(c) 2012-2021 Intel Corporation
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef UTILS_BLK_H_
#define UTILS_BLK_H_
#include <linux/fs.h>
#include <linux/genhd.h>
int cas_blk_get_part_count(struct block_device *bdev);
#endif /* UTILS_BLK_H_ */