Blame SOURCES/0015-sbitmapq-Fix-for-sbitmap_queue-without-min_shallow_d.patch

1a20ba
From 12fe6c7cdd768f87ce6e903a2bbfb0c0591585c5 Mon Sep 17 00:00:00 2001
1a20ba
From: Kazuhito Hagio <k-hagio-ab@nec.com>
1a20ba
Date: Fri, 10 Jun 2022 11:49:47 +0900
1a20ba
Subject: [PATCH 15/18] sbitmapq: Fix for sbitmap_queue without
1a20ba
 min_shallow_depth member
1a20ba
1a20ba
The sbitmap_queue.min_shallow_depth member was added by kernel commit
1a20ba
a327553965de ("sbitmap: fix missed wakeups caused by sbitmap_queue_get_shallow()")
1a20ba
at Linux 4.18.  Without the patch, on earlier kernels the "sbitmapq"
1a20ba
command fails with the following error:
1a20ba
1a20ba
  crash> sbitmapq ffff89bb7638ee50
1a20ba
1a20ba
  sbitmapq: invalid structure member offset: sbitmap_queue_min_shallow_depth
1a20ba
            FILE: sbitmap.c  LINE: 398  FUNCTION: sbitmap_queue_context_load()
1a20ba
1a20ba
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
1a20ba
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
1a20ba
---
1a20ba
 sbitmap.c | 6 ++++--
1a20ba
 1 file changed, 4 insertions(+), 2 deletions(-)
1a20ba
1a20ba
diff --git a/sbitmap.c b/sbitmap.c
1a20ba
index c9f7209f9e3e..bb2f19e6207b 100644
1a20ba
--- a/sbitmap.c
1a20ba
+++ b/sbitmap.c
1a20ba
@@ -371,7 +371,8 @@ static void sbitmap_queue_show(const struct sbitmap_queue_context *sqc,
1a20ba
 	else if (VALID_MEMBER(sbitmap_round_robin)) /* 5.13 and later */
1a20ba
 		fprintf(fp, "round_robin = %d\n", sc->round_robin);
1a20ba
 
1a20ba
-	fprintf(fp, "min_shallow_depth = %u\n", sqc->min_shallow_depth);
1a20ba
+	if (VALID_MEMBER(sbitmap_queue_min_shallow_depth)) /* 4.18 and later */
1a20ba
+		fprintf(fp, "min_shallow_depth = %u\n", sqc->min_shallow_depth);
1a20ba
 }
1a20ba
 
1a20ba
 static void sbitmap_queue_context_load(ulong addr, struct sbitmap_queue_context *sqc)
1a20ba
@@ -395,7 +396,8 @@ static void sbitmap_queue_context_load(ulong addr, struct sbitmap_queue_context
1a20ba
 		sqc->ws_active = INT(sbitmap_queue_buf + OFFSET(sbitmap_queue_ws_active));
1a20ba
 	if (VALID_MEMBER(sbitmap_queue_round_robin))
1a20ba
 		sqc->round_robin = BOOL(sbitmap_queue_buf + OFFSET(sbitmap_queue_round_robin));
1a20ba
-	sqc->min_shallow_depth = UINT(sbitmap_queue_buf + OFFSET(sbitmap_queue_min_shallow_depth));
1a20ba
+	if (VALID_MEMBER(sbitmap_queue_min_shallow_depth))
1a20ba
+		sqc->min_shallow_depth = UINT(sbitmap_queue_buf + OFFSET(sbitmap_queue_min_shallow_depth));
1a20ba
 
1a20ba
 	FREEBUF(sbitmap_queue_buf);
1a20ba
 }
1a20ba
-- 
1a20ba
2.30.2
1a20ba