generic/312: fix dev_blocks calculation
authorXiong Zhou <xzhou@redhat.com>
Mon, 2 Nov 2015 00:00:51 +0000 (11:00 +1100)
committerDave Chinner <david@fromorbit.com>
Mon, 2 Nov 2015 00:00:51 +0000 (11:00 +1100)
commit8deb635098404f31af009d7cf1b12cdce15c6ab2
tree59f8d4c41b568cdfff1ec293e021da8c506bc3d9
parent17f7ca2c115e6fa366e7214c80537551720d2970
generic/312: fix dev_blocks calculation

Current calculation fails when there are many same type of devices
with the testing device, eg sda1 sda2 ... sda10, sda11, sda12 ..
$(grep sda1 /proc/partitions) gets multiple numbers.

$ grep ram1 /proc/partitions
   1        1   10485760 ram1
   1       10   10485760 ram10
   1       11   10485760 ram11
   1       12   10485760 ram12
   1       13   10485760 ram13
   1       14   10485760 ram14
   1       15   10485760 ram15
$ grep -w ram1 /proc/partitions
   1        1   10485760 ram1

Fix this by adding the -w option to grep to match the block device
exactly.

Signed-off-by: Xiong Zhou <xzhou@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
tests/generic/312