summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2024-03-14 16:30:04 +0100
committerSimon Rettberg2024-03-14 16:30:04 +0100
commit487c05e10eff69a4466f9ad12a2c5458594dc6b9 (patch)
tree8cb01e34561d2a0f9fad0f6e3c5870e56ab8eae6
parentDon't use sysfs_emit in case we apply an offset to buf (diff)
downloadxloop-centos-9.tar.gz
xloop-centos-9.tar.xz
xloop-centos-9.zip
Quick and dirty Centos 9 supportcentos-9
-rw-r--r--src/kernel/xloop_file_fmt_raw.c4
-rw-r--r--src/kernel/xloop_main.c11
-rw-r--r--src/kernel/xloop_main.h10
-rw-r--r--src/kernel/xloop_main_6.6.c6
4 files changed, 5 insertions, 26 deletions
diff --git a/src/kernel/xloop_file_fmt_raw.c b/src/kernel/xloop_file_fmt_raw.c
index 5f8d453..9270eb5 100644
--- a/src/kernel/xloop_file_fmt_raw.c
+++ b/src/kernel/xloop_file_fmt_raw.c
@@ -83,7 +83,7 @@ static void __raw_file_fmt_rw_aio_do_completion(struct xloop_cmd *cmd)
#endif
}
-#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0) && !RHEL_CHECK_VERSION(RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9, 0))
static void __raw_file_fmt_rw_aio_complete(struct kiocb *iocb, long ret, long ret2)
#else
static void __raw_file_fmt_rw_aio_complete(struct kiocb *iocb, long ret)
@@ -182,7 +182,7 @@ static int __raw_file_fmt_rw_aio(struct xloop_device *xlo, struct xloop_cmd *cmd
kthread_associate_blkcg(NULL);
#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0) && !RHEL_CHECK_VERSION(RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9, 0))
if (ret != -EIOCBQUEUED)
cmd->iocb.ki_complete(&cmd->iocb, ret, 0);
#else
diff --git a/src/kernel/xloop_main.c b/src/kernel/xloop_main.c
index cff7aa3..e90e535 100644
--- a/src/kernel/xloop_main.c
+++ b/src/kernel/xloop_main.c
@@ -3,15 +3,4 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include "xloop_main.h"
-
-#if RHEL_CHECK_VERSION(RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9, 0))
-#include "xloop_main_rhel_9.0.c"
-#elif RHEL_CHECK_VERSION(RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(8, 5))
-#include "xloop_main_rhel_8.5.c"
-#elif LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0)
-#include "xloop_main_4.18.c"
-#elif LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0)
-#include "xloop_main_5.15.c"
-#else
#include "xloop_main_6.6.c"
-#endif
diff --git a/src/kernel/xloop_main.h b/src/kernel/xloop_main.h
index b4615d6..8379a78 100644
--- a/src/kernel/xloop_main.h
+++ b/src/kernel/xloop_main.h
@@ -9,14 +9,4 @@
#define RHEL_CHECK_VERSION(CONDITION) (0)
#endif
-#if RHEL_CHECK_VERSION(RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9, 0))
-#include "xloop_main_rhel_9.0.h"
-#elif RHEL_CHECK_VERSION(RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(8, 5))
-#include "xloop_main_rhel_8.5.h"
-#elif LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0)
-#include "xloop_main_4.18.h"
-#elif LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0)
-#include "xloop_main_5.15.h"
-#else
#include "xloop_main_6.6.h"
-#endif
diff --git a/src/kernel/xloop_main_6.6.c b/src/kernel/xloop_main_6.6.c
index 871ce7b..e6330dd 100644
--- a/src/kernel/xloop_main_6.6.c
+++ b/src/kernel/xloop_main_6.6.c
@@ -354,7 +354,7 @@ static int xloop_change_fd(struct xloop_device *xlo, struct block_device *bdev,
goto out_err;
/* and ... switch */
- disk_force_media_change(xlo->xlo_disk);
+ disk_force_media_change(xlo->xlo_disk, DISK_EVENT_MEDIA_CHANGE);
blk_mq_freeze_queue(xlo->xlo_queue);
mapping_set_gfp_mask(old_file->f_mapping, xlo->old_gfp_mask);
xlo->xlo_backing_file = file;
@@ -831,7 +831,7 @@ static int xloop_configure(struct xloop_device *xlo, blk_mode_t mode,
/* suppress uevents while reconfiguring the device */
dev_set_uevent_suppress(disk_to_dev(xlo->xlo_disk), 1);
- disk_force_media_change(xlo->xlo_disk);
+ disk_force_media_change(xlo->xlo_disk, DISK_EVENT_MEDIA_CHANGE);
set_disk_ro(xlo->xlo_disk, (xlo->xlo_flags & XLO_FLAGS_READ_ONLY) != 0);
xlo->use_dio = xlo->xlo_flags & XLO_FLAGS_DIRECT_IO;
@@ -941,7 +941,7 @@ static void __xloop_clr_fd(struct xloop_device *xlo, bool release)
if (!release)
blk_mq_unfreeze_queue(xlo->xlo_queue);
- disk_force_media_change(xlo->xlo_disk);
+ disk_force_media_change(xlo->xlo_disk, DISK_EVENT_MEDIA_CHANGE);
if (xlo->xlo_flags & XLO_FLAGS_PARTSCAN) {
int err;