Skip to content

Commit

Permalink
Fix Mr. Bauer's crimes against the kernel coding guidelines :)
Browse files Browse the repository at this point in the history
  • Loading branch information
srett committed Jan 11, 2024
1 parent 7cba241 commit 7cc38bb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 33 deletions.
2 changes: 1 addition & 1 deletion src/kernel/xloop_file_fmt_qcow_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/kernel/xloop_file_fmt_raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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

Expand Down
29 changes: 0 additions & 29 deletions src/kernel/xloop_main_rhel_9.0.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 7cc38bb

Please sign in to comment.