File bug-1043040_test-fix-read-ahead-issues-in-test-scripts.patch of Package lvm2.13365

From 037eb35169d4a322c3b6d75c5b3491c77c41b4a3 Mon Sep 17 00:00:00 2001
From: Eric Ren <zren@suse.com>
Date: Sat, 17 Jun 2017 21:32:40 +0800
Subject: [PATCH] test: fix read ahead issues in test scripts

We have a SUSE specific kernel patch, which
tunes the kernel "VM_MAX_READAHEAD" from
128k to 512k. Thus, some testing scripts are
affected by this change. See bsc#1043040 for
more infos.

Signed-off-by: Eric Ren <zren@suse.com>
---
 test/shell/lvcreate-usage.sh | 4 ++--
 test/shell/read-ahead.sh     | 8 +++++++-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/test/shell/lvcreate-usage.sh b/test/shell/lvcreate-usage.sh
index 4b5c2b6..e2e1b8f 100644
--- a/test/shell/lvcreate-usage.sh
+++ b/test/shell/lvcreate-usage.sh
@@ -173,10 +173,10 @@ check lv_field $vg/$lv3 lv_read_ahead "8.00k"
 check lv_field $vg/$lv3 lv_kernel_read_ahead "8.00k"
 lvcreate -L 8 -n $lv4 --readahead auto $vg
 check lv_field $vg/$lv4 lv_read_ahead "auto"
-check lv_field $vg/$lv4 lv_kernel_read_ahead "128.00k"
+check lv_field $vg/$lv4 lv_kernel_read_ahead "512.00k"
 lvcreate -L 8 -n $lv5 -i2 --stripesize 16k --readahead auto $vg
 check lv_field $vg/$lv5 lv_read_ahead "auto"
-check lv_field $vg/$lv5 lv_kernel_read_ahead "128.00k"
+check lv_field $vg/$lv5 lv_kernel_read_ahead "512.00k"
 lvcreate -L 8 -n $lv6 -i2 --stripesize 128k --readahead auto $vg
 check lv_field $vg/$lv6 lv_read_ahead "auto"
 check lv_field $vg/$lv6 lv_kernel_read_ahead "512.00k"
diff --git a/test/shell/read-ahead.sh b/test/shell/read-ahead.sh
index 9045de8..4a4991b 100644
--- a/test/shell/read-ahead.sh
+++ b/test/shell/read-ahead.sh
@@ -32,11 +32,17 @@ lvchange -r 640 $vg/$lv
 check lv_field $vg/$lv lv_read_ahead 640 --units s --nosuffix
 lvremove -ff $vg
 
+#See bsc#1043040
+default_ra=$(blockdev --getra "$dev1")
 #COMM "read ahead is properly inherited from underlying PV"
 blockdev --setra 768 "$dev1"
 vgscan
 lvcreate -n $lv -L4m $vg "$dev1"
-test "$(blockdev --getra "$DM_DEV_DIR/$vg/$lv")" -eq 768
+if [ "$default_ra" -lt 768 ]; then
+	test "$(blockdev --getra "$DM_DEV_DIR/$vg/$lv")" -eq 768
+else
+	test $(blockdev --getra "$DM_DEV_DIR/$vg/$lv") -eq "$default_ra"
+fi
 lvremove -ff $vg
 
 # Check default, active/inactive values for read_ahead / kernel_read_ahead
-- 
2.10.2