drbd/0016-compat-test-and-patch-for-queue_limits_start_update.patch
2025-01-08 07:34:16 +00:00

72 lines
2.6 KiB
Diff

From fef08ee4fac426f5dfbec124bd2bd58fbd390cb2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christoph=20B=C3=B6hmwalder?=
<christoph.boehmwalder@linbit.com>
Date: Thu, 22 Aug 2024 12:09:42 +0200
Subject: [PATCH 16/32] compat: test and patch for queue_limits_start_update
---
...ueue_limits_start_update__no_present.cocci | 20 +++++++++++++++++++
drbd/drbd-kernel-compat/gen_patch_names.c | 3 +++
.../tests/have_queue_limits_start_update.c | 8 ++++++++
3 files changed, 31 insertions(+)
create mode 100644 drbd/drbd-kernel-compat/cocci/queue_limits_start_update__no_present.cocci
create mode 100644 drbd/drbd-kernel-compat/tests/have_queue_limits_start_update.c
diff --git a/drbd/drbd-kernel-compat/cocci/queue_limits_start_update__no_present.cocci b/drbd/drbd-kernel-compat/cocci/queue_limits_start_update__no_present.cocci
new file mode 100644
index 000000000000..4e34f5887181
--- /dev/null
+++ b/drbd/drbd-kernel-compat/cocci/queue_limits_start_update__no_present.cocci
@@ -0,0 +1,20 @@
+@@
+identifier lim;
+identifier q;
+identifier device;
+identifier bdev;
+@@
+void drbd_reconsider_queue_parameters(struct drbd_device *device, struct drbd_backing_dev *bdev)
+{
+...
+ lim =
+- queue_limits_start_update(q);
++ q->limits;
+...
+- if (queue_limits_commit_update(q, &lim)) { ... }
++ blk_queue_max_hw_sectors(q, lim.max_hw_sectors);
++ q->limits = lim;
++ if (bdev)
++ disk_update_readahead(device->vdisk);
+...
+}
diff --git a/drbd/drbd-kernel-compat/gen_patch_names.c b/drbd/drbd-kernel-compat/gen_patch_names.c
index c21a43b39488..13aec5c8bd5f 100644
--- a/drbd/drbd-kernel-compat/gen_patch_names.c
+++ b/drbd/drbd-kernel-compat/gen_patch_names.c
@@ -393,6 +393,9 @@ int main(int argc, char **argv)
COMPAT_HAVE_WB_CONGESTED_ENUM, "present");
#endif
+ patch(1, "queue_limits_start_update", true, false,
+ COMPAT_HAVE_QUEUE_LIMITS_START_UPDATE, "present");
+
patch(1, "disk_update_readahead", true, false,
COMPAT_HAVE_DISK_UPDATE_READAHEAD, "present");
diff --git a/drbd/drbd-kernel-compat/tests/have_queue_limits_start_update.c b/drbd/drbd-kernel-compat/tests/have_queue_limits_start_update.c
new file mode 100644
index 000000000000..a867d1675218
--- /dev/null
+++ b/drbd/drbd-kernel-compat/tests/have_queue_limits_start_update.c
@@ -0,0 +1,8 @@
+/* { "version": "v6.9-rc1", "commit": "d690cb8ae14bd377d422b7905b6959c7e7a45b95", "comment": "block: add an API to atomically update queue limits", "author": "Christoph Hellwig <hch@lst.de>", "date": "Tue Feb 13 08:34:14 2024 +0100" } */
+
+#include <linux/blkdev.h>
+
+static struct queue_limits foo(struct request_queue *q)
+{
+ return queue_limits_start_update(q);
+}
--
2.35.3