ecda894264
* add patch boo1235399-fix_the_warning_of_blk_validate_limits.patch OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/drbd?expand=0&rev=156
74 lines
2.2 KiB
Diff
74 lines
2.2 KiB
Diff
From 78d5d462c2bdac350921c114caca588c606d7c0b Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Christoph=20B=C3=B6hmwalder?=
|
|
<christoph.boehmwalder@linbit.com>
|
|
Date: Mon, 1 Jul 2024 17:56:08 +0200
|
|
Subject: [PATCH 14/32] drbd: split out a drbd_discard_supported helper
|
|
|
|
Add a helper to check if discard is supported for a given connection /
|
|
backing device combination.
|
|
|
|
Similar idea to upstream kernel commit 5eaee6e9c8f9
|
|
("drbd: split out a drbd_discard_supported helper"), but also get rid of
|
|
the goto.
|
|
---
|
|
drbd/drbd_nl.c | 29 ++++++++++++++++++-----------
|
|
1 file changed, 18 insertions(+), 11 deletions(-)
|
|
|
|
diff --git a/drbd/drbd_nl.c b/drbd/drbd_nl.c
|
|
index a0c3534d8996..e3f508cd0421 100644
|
|
--- a/drbd/drbd_nl.c
|
|
+++ b/drbd/drbd_nl.c
|
|
@@ -2044,19 +2044,31 @@ static unsigned int drbd_max_discard_sectors(struct drbd_resource *resource)
|
|
return s;
|
|
}
|
|
|
|
-static void decide_on_discard_support(struct drbd_device *device,
|
|
+static bool drbd_discard_supported(struct drbd_device *device,
|
|
struct drbd_backing_dev *bdev)
|
|
{
|
|
- struct request_queue *q = device->rq_queue;
|
|
- unsigned int max_discard_sectors;
|
|
-
|
|
if (bdev && !bdev_max_discard_sectors(bdev->backing_bdev))
|
|
- goto not_supported;
|
|
+ return false;
|
|
|
|
if (!(common_connection_features(device->resource) & DRBD_FF_TRIM)) {
|
|
drbd_info(device,
|
|
"peer DRBD too old, does not support TRIM: disabling discards\n");
|
|
- goto not_supported;
|
|
+ return false;
|
|
+ }
|
|
+
|
|
+ return true;
|
|
+}
|
|
+
|
|
+static void decide_on_discard_support(struct drbd_device *device,
|
|
+ struct drbd_backing_dev *bdev)
|
|
+{
|
|
+ struct request_queue *q = device->rq_queue;
|
|
+ unsigned int max_discard_sectors;
|
|
+
|
|
+ if (!drbd_discard_supported(device, bdev)) {
|
|
+ blk_queue_discard_granularity(q, 0);
|
|
+ blk_queue_max_discard_sectors(q, 0);
|
|
+ return;
|
|
}
|
|
|
|
/*
|
|
@@ -2070,11 +2082,6 @@ static void decide_on_discard_support(struct drbd_device *device,
|
|
blk_queue_discard_granularity(q, 512);
|
|
max_discard_sectors = drbd_max_discard_sectors(device->resource);
|
|
blk_queue_max_discard_sectors(q, max_discard_sectors);
|
|
- return;
|
|
-
|
|
-not_supported:
|
|
- blk_queue_discard_granularity(q, 0);
|
|
- blk_queue_max_discard_sectors(q, 0);
|
|
}
|
|
|
|
static void fixup_write_zeroes(struct drbd_device *device, struct request_queue *q)
|
|
--
|
|
2.35.3
|
|
|