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

Linux 6.11 support #194

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
21 changes: 18 additions & 3 deletions module/rapiddisk.c
Original file line number Diff line number Diff line change
Expand Up @@ -820,15 +820,24 @@ static int attach_device(unsigned long num, unsigned long long size)
if (!disk)
#endif
goto out_free_queue;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,11,0)
struct request_queue *q = disk->queue;
struct queue_limits lim;
lim = queue_limits_start_update(q);
lim.logical_block_size = BYTES_PER_SECTOR;
lim.physical_block_size = PAGE_SIZE;
queue_limits_commit_update(q, &lim);
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0)
blk_queue_logical_block_size(disk->queue, BYTES_PER_SECTOR);
blk_queue_physical_block_size(disk->queue, PAGE_SIZE);
#else
blk_queue_logical_block_size(rdsk->rdsk_queue, BYTES_PER_SECTOR);
blk_queue_physical_block_size(rdsk->rdsk_queue, PAGE_SIZE);
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,11,0)
blk_queue_write_cache(disk->queue);
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0)
blk_queue_write_cache(disk->queue, false, false);
#else
blk_queue_write_cache(rdsk->rdsk_queue, false, false);
Expand All @@ -844,12 +853,18 @@ static int attach_device(unsigned long num, unsigned long long size)
disk->queue->nr_requests = nr_requests;
disk->queue->limits.discard_granularity = PAGE_SIZE;
disk->queue->limits.max_discard_sectors = UINT_MAX;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,19,0) || (defined(RHEL_MAJOR) && RHEL_MAJOR >= 9 && RHEL_MINOR >= 0)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,11,0)
blk_queue_disable_discard(disk->queue);
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5,19,0) || (defined(RHEL_MAJOR) && RHEL_MAJOR >= 9 && RHEL_MINOR >= 0)
blk_queue_max_discard_sectors(disk->queue, 0);
#else
blk_queue_flag_set(QUEUE_FLAG_DISCARD, disk->queue);
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,11,0)
disk->queue->limits.features = BLK_FEAT_ROTATIONAL;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why rotational? Is this the right feature to define? For instance, I am looking at the brd code and it only defines BLK_FEAT_SYNCHRONOUS and BLK_FEAT_NOWAIT. Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@piso77: I've forwarded your rapiddisk patch from the Ubuntu package to upstream. Upstream has a question that you hopefully can answer.

#else
blk_queue_flag_set(QUEUE_FLAG_NONROT, disk->queue);
#endif
#else
rdsk->rdsk_queue->limits.max_sectors = (max_sectors * 2);
rdsk->rdsk_queue->nr_requests = nr_requests;
Expand Down
2 changes: 1 addition & 1 deletion src/rapiddiskd.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
#define D_STDOUT_LOG "/tmp/rapiddiskd_out.log"
#define D_EXITING "Daemon exiting."
#define D_STARTING "Starting daemon..."
#define D_RECV_REQ "Recevied request '%s'."
#define D_RECV_REQ "Received request '%s'."
#define D_LOOP_EXITING "Daemon loop function exiting: %s."
#define D_SIGNAL_RECEIVED "Signal_handler function, SIGNAL received: %s."

Expand Down