summaryrefslogtreecommitdiffstats
path: root/tests/05r1-internalbitmap-v1c
blob: e1e4472f0929f60b59c8a5946ea7ffa59506eb8b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#
# create a raid1 with an internal bitmap
#
mdadm --create --run $md0 --metadata=1.2 --level=1 -n2 --delay=1  --bitmap internal --bitmap-chunk 4 $dev1 $dev2
check wait
check bitmap
testdev $md0 1 $mdsize12 64
mdadm -S $md0

mdadm --assemble $md0 $dev1 $dev2
testdev $md0 1 $mdsize12 64
sleep 4
dirty1=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`

if [ $dirty1 -ne 0 ]
then  echo >&2 "ERROR bad 'dirty' counts: $dirty1"
  exit 1
fi
mdadm $md0 -f $dev1
testdev $md0 1 $mdsize12 64
sleep 4
total=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) bits.*/\1/p'`
dirty2=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`
if [ $dirty2 -ne $total ]
then  echo >&2 "ERROR bad 'dirty' counts: total $total, dirty2 $dirty2"
   exit 2
fi

mdadm -S $md0

mdadm --zero-superblock $dev1
mdadm --assemble -R $md0  $dev2
mdadm $md0 --add $dev1
check recovery

check wait
sleep 4
dirty3=`mdadm -X $dev2 | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`

if [ $dirty3 -ne 0 ]
then  echo >&2 "ERROR bad 'dirty' counts: $dirty3"
  exit 1
fi

mdadm -S $md0