drbd/0022-compat-fixup-queue_flag_discard__yes_present.patch
2025-01-08 07:34:16 +00:00

78 lines
2.1 KiB
Diff

From ce06250eb289e98bf97940104c92751282704783 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christoph=20B=C3=B6hmwalder?=
<christoph.boehmwalder@linbit.com>
Date: Wed, 4 Sep 2024 19:05:06 +0200
Subject: [PATCH 22/32] compat: fixup queue_flag_discard__yes_present
blk_queue_discard_granularity does not exist anymore, just use the field
in queue_limits.
Match directly do drbd_reconsider_queue_parameters instead of trying to
guess the right function.
---
.../queue_flag_discard__yes_present.cocci | 30 ++++++-------------
1 file changed, 9 insertions(+), 21 deletions(-)
diff --git a/drbd/drbd-kernel-compat/cocci/queue_flag_discard__yes_present.cocci b/drbd/drbd-kernel-compat/cocci/queue_flag_discard__yes_present.cocci
index cc28c3d02d82..e0ecc697b10a 100644
--- a/drbd/drbd-kernel-compat/cocci/queue_flag_discard__yes_present.cocci
+++ b/drbd/drbd-kernel-compat/cocci/queue_flag_discard__yes_present.cocci
@@ -1,27 +1,19 @@
@@
-struct request_queue *q;
-@@
-(
-q->limits.max_discard_sectors = 0;
-+ blk_queue_flag_clear(QUEUE_FLAG_DISCARD, q);
-|
-q->limits.max_discard_sectors = ...;
-+ blk_queue_flag_set(QUEUE_FLAG_DISCARD, q);
-)
-
-@@
-struct request_queue *q;
+struct queue_limits lim;
+identifier q;
@@
+struct request_queue *q = device->rq_queue;
+...
(
-blk_queue_discard_granularity(q, 0);
+lim.max_hw_discard_sectors = 0;
+ blk_queue_flag_clear(QUEUE_FLAG_DISCARD, q);
|
-blk_queue_discard_granularity(q, 512);
+lim.max_hw_discard_sectors = ...;
+ blk_queue_flag_set(QUEUE_FLAG_DISCARD, q);
)
@@
-identifier q, device, fn;
+identifier q, device;
@@
+static void fixup_discard_if_not_supported(struct request_queue *q)
+{
@@ -31,18 +23,14 @@ identifier q, device, fn;
+ * */
+ if (!blk_queue_discard(q)) {
+ blk_queue_max_discard_sectors(q, 0);
-+ blk_queue_discard_granularity(q, 0);
++ q->limits.discard_granularity = 0;
+ }
+}
-fn (struct drbd_device *device, ...)
+void drbd_reconsider_queue_parameters(struct drbd_device *device, ...)
{
...
struct request_queue *q = device->rq_queue;
...
-decide_on_discard_support(...);
-<+...
-blk_stack_limits(...);
-...+>
+ fixup_discard_if_not_supported(q);
}
--
2.35.3