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

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