1#!/bin/sh 2# Copyright (C) 2008 Red Hat, Inc. All rights reserved. 3# 4# This copyrighted material is made available to anyone wishing to use, 5# modify, copy, or redistribute it subject to the terms and conditions 6# of the GNU General Public License v.2. 7# 8# You should have received a copy of the GNU General Public License 9# along with this program; if not, write to the Free Software Foundation, 10# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 12# 13# tests basic functionality of read-ahead and ra regressions 14# 15 16test_description='Test read-ahead functionality' 17 18. ./test-utils.sh 19 20 21get_lvs_() { 22 lvs --units s --nosuffix --noheadings -o $1 "$vg"/"$lv" 23} 24 25check_lvs_() { 26 case $(get_lvs_ $1) in 27 *$2) true ;; 28 *) false ;; 29 esac 30} 31 32aux prepare_vg 5 33 34#COMM "test various read ahead settings (bz450922)" 35lvcreate -n "$lv" -l 100%FREE -i5 -I256 "$vg" 36ra="$(get_lvs_ lv_kernel_read_ahead)" 37test "$(( ( $ra / 5 ) * 5 ))" -eq $ra 38lvdisplay "$vg"/"$lv" 39lvchange -r auto "$vg"/"$lv" 2>&1 | grep auto 40check_lvs_ lv_read_ahead auto 41check_lvs_ lv_kernel_read_ahead 5120 42lvchange -r 640 "$vg/$lv" 43check_lvs_ lv_read_ahead 640 44lvremove -ff "$vg" 45 46#COMM "read ahead is properly inherited from underlying PV" 47blockdev --setra 768 $dev1 48lvcreate -n $lv -L4m $vg $dev1 49test $(blockdev --getra $G_dev_/$vg/$lv) -eq 768 50lvremove -ff $vg 51 52# Check default, active/inactive values for read_ahead / kernel_read_ahead 53lvcreate -n $lv -l 50%FREE $vg 54lvchange -an $vg/$lv 55check_lv_field_ $vg/$lv lv_read_ahead auto 56check_lv_field_ $vg/$lv lv_kernel_read_ahead -1 57lvchange -r 512 $vg/$lv 58lvchange -ay $vg/$lv 59check_lv_field_ $vg/$lv lv_read_ahead 256.00k 60check_lv_field_ $vg/$lv lv_kernel_read_ahead 256.00k 61lvremove -ff $vg 62