configure: Add bdev_disk_changed() wrapper
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
parent
d9ea8d3e32
commit
48c3598ef5
39
configure.d/1_reread_partitions.conf
Normal file
39
configure.d/1_reread_partitions.conf
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Copyright(c) 2012-2020 Intel Corporation
|
||||||
|
# SPDX-License-Identifier: BSD-3-Clause-Clear
|
||||||
|
#
|
||||||
|
|
||||||
|
. $(dirname $3)/conf_framework
|
||||||
|
|
||||||
|
check() {
|
||||||
|
cur_name=$(basename $2)
|
||||||
|
config_file_path=$1
|
||||||
|
if compile_module $cur_name "bdev_disk_changed(NULL, false);" "linux/genhd.h"
|
||||||
|
then
|
||||||
|
echo $cur_name "1" >> $config_file_path
|
||||||
|
else
|
||||||
|
echo $cur_name "2" >> $config_file_path
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
apply() {
|
||||||
|
case "$1" in
|
||||||
|
"1")
|
||||||
|
add_function "
|
||||||
|
static inline void cas_reread_partitions(struct block_device *bdev)
|
||||||
|
{
|
||||||
|
bdev_disk_changed(bdev, false);
|
||||||
|
}" ;;
|
||||||
|
"2")
|
||||||
|
add_function "
|
||||||
|
static inline void cas_reread_partitions(struct block_device *bdev)
|
||||||
|
{
|
||||||
|
ioctl_by_bdev(bdev, BLKRRPART, (unsigned long)NULL);
|
||||||
|
}" ;;
|
||||||
|
*)
|
||||||
|
exit 1
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
conf_run $@
|
@ -1824,7 +1824,7 @@ static void init_instance_complete(struct _cache_mngt_attach_context *ctx,
|
|||||||
|
|
||||||
/* If we deal with whole device, reread partitions */
|
/* If we deal with whole device, reread partitions */
|
||||||
if (bdev->bd_contains == bdev)
|
if (bdev->bd_contains == bdev)
|
||||||
ioctl_by_bdev(bdev, BLKRRPART, (unsigned long)NULL);
|
cas_reread_partitions(bdev);
|
||||||
|
|
||||||
/* Set other back information */
|
/* Set other back information */
|
||||||
name = block_dev_get_elevator_name(
|
name = block_dev_get_elevator_name(
|
||||||
|
@ -267,7 +267,7 @@ static int _casdsk_exp_obj_hide_parts(struct casdsk_disk *dsk)
|
|||||||
gdsk->disk_name);
|
gdsk->disk_name);
|
||||||
|
|
||||||
/* Try restore previous partitions by rescaning */
|
/* Try restore previous partitions by rescaning */
|
||||||
ioctl_by_bdev(bd, BLKRRPART, (unsigned long) NULL);
|
cas_reread_partitions(bd);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -280,7 +280,7 @@ static int _casdsk_exp_obj_hide_parts(struct casdsk_disk *dsk)
|
|||||||
gdsk->flags &= ~_casdsk_flags;
|
gdsk->flags &= ~_casdsk_flags;
|
||||||
gdsk->minors = 1;
|
gdsk->minors = 1;
|
||||||
/* Rescan partitions */
|
/* Rescan partitions */
|
||||||
ioctl_by_bdev(bd, BLKRRPART, (unsigned long) NULL);
|
cas_reread_partitions(bd);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -325,7 +325,7 @@ static void _casdsk_exp_obj_clear_dev_t(struct casdsk_disk *dsk)
|
|||||||
/* Restore previous configuration of bottom disk */
|
/* Restore previous configuration of bottom disk */
|
||||||
gdsk->minors = dsk->gd_minors;
|
gdsk->minors = dsk->gd_minors;
|
||||||
gdsk->flags |= dsk->gd_flags;
|
gdsk->flags |= dsk->gd_flags;
|
||||||
ioctl_by_bdev(bdev, BLKRRPART, (unsigned long) NULL);
|
cas_reread_partitions(bdev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user