Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Close block devices in a synchronous manner #1481

Merged
merged 2 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 32 additions & 8 deletions configure.d/1_bdev_open_by_path.conf
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,18 @@ check() {
if compile_module $cur_name "blkdev_get_by_path(NULL, 0, NULL);" "linux/blkdev.h"
then
echo $cur_name 1 >> $config_file_path
elif compile_module $cur_name "blkdev_get_by_path(NULL, 0, NULL, NULL);" "linux/blkdev.h"
elif compile_module $cur_name "blkdev_get_by_path(NULL, 0, NULL, NULL);blkdev_put(NULL, FMODE_READ);" "linux/blkdev.h"
then
echo $cur_name 2 >> $config_file_path
elif compile_module $cur_name "bdev_open_by_path(NULL, 0, NULL, NULL);" "linux/blkdev.h"
elif compile_module $cur_name "blkdev_get_by_path(NULL, 0, NULL, NULL);blkdev_put(NULL, NULL);" "linux/blkdev.h"
then
echo $cur_name 3 >> $config_file_path
elif compile_module $cur_name "bdev_file_open_by_path(NULL, 0, NULL, NULL);" "linux/blkdev.h"
elif compile_module $cur_name "bdev_open_by_path(NULL, 0, NULL, NULL);" "linux/blkdev.h"
then
echo $cur_name 4 >> $config_file_path
elif compile_module $cur_name "bdev_file_open_by_path(NULL, 0, NULL, NULL);" "linux/blkdev.h"
then
echo $cur_name 5 >> $config_file_path
else
echo $cur_name X >> $config_file_path
fi
Expand All @@ -31,29 +34,50 @@ check() {
apply() {
case "$1" in
"1")
# Related kernel commit 0718afd47f70cf46877c39c25d06b786e1a3f36c
add_typedef "struct block_device *cas_bdev_handle_t;"
add_define "cas_bdev_open_by_path(path, mode, holder) \\
blkdev_get_by_path(path, mode, holder)"
add_define "cas_bdev_get_from_handle(handle) \\
((struct block_device *)handle)" ;;
((struct block_device *)handle)"
add_define "cas_bdev_release(handle, mode, holder) \\
blkdev_put((struct block_device *)handle, mode)" ;;
"2")
# Before kernel commit 2736e8eeb0ccdc71d1f4256c9c9a28f58cc43307
add_typedef "struct block_device *cas_bdev_handle_t;"
add_define "cas_bdev_open_by_path(path, mode, holder) \\
blkdev_get_by_path(path, mode, holder, NULL)"
add_define "cas_bdev_get_from_handle(handle) \\
((struct block_device *)handle)" ;;
((struct block_device *)handle)"
add_define "cas_bdev_release(handle, mode, holder) \\
blkdev_put((struct block_device *)handle, mode)" ;;
"3")
# From kernel commit 2736e8eeb0ccdc71d1f4256c9c9a28f58cc43307
add_typedef "struct block_device *cas_bdev_handle_t;"
add_define "cas_bdev_open_by_path(path, mode, holder) \\
blkdev_get_by_path(path, mode, holder, NULL)"
add_define "cas_bdev_get_from_handle(handle) \\
((struct block_device *)handle)"
add_define "cas_bdev_release(handle, mode, holder) \\
blkdev_put((struct block_device *)handle, holder)" ;;
"4")
# From kernel commit e719b4d156749f02eafed31a3c515f2aa9dcc72a
add_typedef "struct bdev_handle *cas_bdev_handle_t;"
add_define "cas_bdev_open_by_path(path, mode, holder) \\
bdev_open_by_path(path, mode, holder, NULL)"
add_define "cas_bdev_get_from_handle(handle) \\
(handle->bdev)" ;;
"4")
(handle->bdev)"
add_define "cas_bdev_release(handle, mode, holder) \\
bdev_release(handle)" ;;
"5")
# From kernel commit e97d06a46526d9392cbdbd7eda193091e1af2723
add_typedef "struct file *cas_bdev_handle_t;"
add_define "cas_bdev_open_by_path(path, mode, holder) \\
bdev_file_open_by_path(path, mode, holder, NULL)"
add_define "cas_bdev_get_from_handle(handle) \\
file_bdev(handle)" ;;
file_bdev(handle)"
add_define "cas_bdev_release(handle, mode, holder) \\
__fput_sync(handle)" ;;
*)
exit 1
esac
Expand Down
50 changes: 0 additions & 50 deletions configure.d/1_bdev_release.conf

This file was deleted.

Loading