From 7cc38bb646160d2b7197e548f8aaf9bd6cea3451 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 11 Jan 2024 12:27:42 +0100 Subject: Fix Mr. Bauer's crimes against the kernel coding guidelines :) --- src/kernel/xloop_file_fmt_qcow_main.c | 2 +- src/kernel/xloop_file_fmt_raw.c | 6 +++--- src/kernel/xloop_main_rhel_9.0.c | 29 ----------------------------- 3 files changed, 4 insertions(+), 33 deletions(-) diff --git a/src/kernel/xloop_file_fmt_qcow_main.c b/src/kernel/xloop_file_fmt_qcow_main.c index 62b83e0..cc14941 100644 --- a/src/kernel/xloop_file_fmt_qcow_main.c +++ b/src/kernel/xloop_file_fmt_qcow_main.c @@ -40,7 +40,7 @@ #define ZSTD_WINDOWLOG_LIMIT_DEFAULT 27 #define ZSTD_MAXWINDOWSIZE ((U32_C(1) << ZSTD_WINDOWLOG_LIMIT_DEFAULT) + 1) -#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0) && ! RHEL_CHECK_VERSION(RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9, 0)) +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0) && !RHEL_CHECK_VERSION(RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9, 0)) #define zstd_dstream_workspace_bound ZSTD_DStreamWorkspaceBound #define zstd_init_dstream ZSTD_initDStream #define zstd_reset_dstream ZSTD_resetDStream diff --git a/src/kernel/xloop_file_fmt_raw.c b/src/kernel/xloop_file_fmt_raw.c index 06a91bd..f77476f 100644 --- a/src/kernel/xloop_file_fmt_raw.c +++ b/src/kernel/xloop_file_fmt_raw.c @@ -157,7 +157,7 @@ static void __raw_file_fmt_rw_aio_complete(struct kiocb *iocb, long ret) struct xloop_cmd *cmd = container_of(iocb, struct xloop_cmd, iocb); -#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0) && ! RHEL_CHECK_VERSION(RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9, 0)) +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0) && !RHEL_CHECK_VERSION(RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9, 0)) if (cmd->css) css_put(cmd->css); #endif @@ -232,7 +232,7 @@ static int __raw_file_fmt_rw_aio(struct xloop_device *xlo, struct xloop_cmd *cmd cmd->iocb.ki_complete = __raw_file_fmt_rw_aio_complete; cmd->iocb.ki_flags = IOCB_DIRECT; cmd->iocb.ki_ioprio = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_NONE, 0); -#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0) && ! RHEL_CHECK_VERSION(RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9, 0)) +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0) && !RHEL_CHECK_VERSION(RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9, 0)) if (cmd->css) kthread_associate_blkcg(cmd->css); #endif @@ -243,7 +243,7 @@ static int __raw_file_fmt_rw_aio(struct xloop_device *xlo, struct xloop_cmd *cmd ret = call_read_iter(file, &cmd->iocb, &iter); __raw_file_fmt_rw_aio_do_completion(cmd); -#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0) && ! RHEL_CHECK_VERSION(RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9, 0)) +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0) && !RHEL_CHECK_VERSION(RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9, 0)) kthread_associate_blkcg(NULL); #endif diff --git a/src/kernel/xloop_main_rhel_9.0.c b/src/kernel/xloop_main_rhel_9.0.c index 56bfae9..abb256d 100644 --- a/src/kernel/xloop_main_rhel_9.0.c +++ b/src/kernel/xloop_main_rhel_9.0.c @@ -97,12 +97,6 @@ #define XLOOP_IDLE_WORKER_TIMEOUT (60 * HZ) -/* -#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0) -#define GENHD_FL_NO_PART GENHD_FL_NO_PART_SCAN -#endif -*/ - static DEFINE_IDR(xloop_index_idr); static DEFINE_MUTEX(xloop_ctl_mutex); static DEFINE_MUTEX(xloop_validate_mutex); @@ -669,20 +663,10 @@ static void xloop_config_discard(struct xloop_device *xlo) q->limits.discard_granularity = granularity; blk_queue_max_discard_sectors(q, max_discard_sectors); blk_queue_max_write_zeroes_sectors(q, max_discard_sectors); -/* -#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 19, 0) - blk_queue_flag_set(QUEUE_FLAG_DISCARD, q); -#endif -*/ } else { q->limits.discard_granularity = 0; blk_queue_max_discard_sectors(q, 0); blk_queue_max_write_zeroes_sectors(q, 0); -/* -#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 19, 0) - blk_queue_flag_clear(QUEUE_FLAG_DISCARD, q); -#endif -*/ } q->limits.discard_alignment = 0; } @@ -1904,15 +1888,7 @@ static blk_status_t xloop_queue_rq(struct blk_mq_hw_ctx *hctx, cmd->memcg_css = NULL; #ifdef CONFIG_BLK_CGROUP if (rq->bio && rq->bio->bi_blkg) { -/* -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 0) -*/ cmd->blkcg_css = bio_blkcg_css(rq->bio); -/* -#else - cmd->blkcg_css = &bio_blkcg(rq->bio)->css; -#endif -*/ #ifdef CONFIG_MEMCG cmd->memcg_css = cgroup_get_e_css(cmd->blkcg_css->cgroup, @@ -2133,11 +2109,6 @@ static int xloop_add(int i) */ if (!part_shift) disk->flags |= GENHD_FL_NO_PART; -/* -#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0) - disk->flags |= GENHD_FL_EXT_DEVT; -#endif -*/ atomic_set(&xlo->xlo_refcnt, 0); mutex_init(&xlo->xlo_mutex); xlo->xlo_number = i; -- cgit v1.2.3-55-g7522