~ubuntu-branches/ubuntu/vivid/lvm2/vivid

« back to all changes in this revision

Viewing changes to test/t-read-ahead.sh

  • Committer: Package Import Robot
  • Author(s): Bastian Blank
  • Date: 2012-05-01 20:27:50 UTC
  • mto: (3.1.23 sid)
  • mto: This revision was merged to the branch mainline in revision 72.
  • Revision ID: package-import@ubuntu.com-20120501202750-gljjjtblowwq9mw8
Tags: upstream-2.02.95
ImportĀ upstreamĀ versionĀ 2.02.95

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
 
16
 
test_description='Test read-ahead functionality'
17
 
 
18
 
. lib/test
19
 
 
20
 
 
21
 
get_lvs_() {
22
 
   lvs --units s --nosuffix --noheadings -o $1 "$vg"/"$lv"
23
 
}
24
 
 
25
 
check_lvs_() {
26
 
   case $(get_lvs_ $1) in
27
 
    *$2) true ;;
28
 
    *) false ;;
29
 
   esac
30
 
}
31
 
 
32
 
aux prepare_vg 5
33
 
 
34
 
#COMM "test various read ahead settings (bz450922)"
35
 
lvcreate -n "$lv" -l 100%FREE -i5 -I256 "$vg"
36
 
ra="$(get_lvs_ lv_kernel_read_ahead)"
37
 
test "$(( ( $ra / 5 ) * 5 ))" -eq $ra
38
 
lvdisplay "$vg"/"$lv"
39
 
not lvchange -r auto "$vg"/"$lv" 2>&1 | grep auto
40
 
check_lvs_ lv_read_ahead auto
41
 
check_lvs_ lv_kernel_read_ahead 5120
42
 
lvchange -r 640 "$vg/$lv"
43
 
check_lvs_ lv_read_ahead 640
44
 
lvremove -ff "$vg"
45
 
 
46
 
#COMM "read ahead is properly inherited from underlying PV"
47
 
blockdev --setra 768 $dev1
48
 
vgscan
49
 
lvcreate -n $lv -L4m $vg $dev1
50
 
test $(blockdev --getra $DM_DEV_DIR/$vg/$lv) -eq 768
51
 
lvremove -ff $vg
52
 
 
53
 
# Check default, active/inactive values for read_ahead / kernel_read_ahead
54
 
lvcreate -n $lv -l 50%FREE $vg
55
 
lvchange -an $vg/$lv
56
 
check lv_field $vg/$lv lv_read_ahead auto
57
 
check lv_field $vg/$lv lv_kernel_read_ahead -1
58
 
lvchange -r 512 $vg/$lv
59
 
lvchange -ay $vg/$lv
60
 
check lv_field $vg/$lv lv_read_ahead 256.00k
61
 
check lv_field $vg/$lv lv_kernel_read_ahead 256.00k
62
 
lvremove -ff $vg