[PATCH] common/dmthin: Fix grep command for finding exact value

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



Sometimes there are multiple occurances of meta_name, pool_name,
data_name in dmsetup command which causes failures while adding
in next line. This patch greps for names at start of line.

Signed-off-by: Harish <harish@xxxxxxxxxxxxxxxxxx>
---
 common/dmthin | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/common/dmthin b/common/dmthin
index e774175..baab628 100644
--- a/common/dmthin
+++ b/common/dmthin
@@ -178,12 +178,12 @@ _dmthin_grow()
 	local blk_dev_size=`blockdev --getsz $dm_backing_dev`
 
 	# Get current sizes & values
-	local   meta_dev_size=`$DMSETUP_PROG table | grep $DMTHIN_META_NAME | awk '{print $3}'`
-	local meta_dev_offset=`$DMSETUP_PROG table | grep $DMTHIN_META_NAME | awk '{print $6}'`
-	local   data_dev_size=`$DMSETUP_PROG table | grep $DMTHIN_DATA_NAME | awk '{print $3}'`
-	local   pool_dev_size=`$DMSETUP_PROG table | grep $DMTHIN_POOL_NAME | awk '{print $3}'`
-	local    cluster_size=`$DMSETUP_PROG table | grep $DMTHIN_POOL_NAME | awk '{print $7}'`
-	local       low_water=`$DMSETUP_PROG table | grep $DMTHIN_POOL_NAME | awk '{print $8}'`
+	local   meta_dev_size=`$DMSETUP_PROG table | grep ^$DMTHIN_META_NAME | awk '{print $3}'`
+	local meta_dev_offset=`$DMSETUP_PROG table | grep ^$DMTHIN_META_NAME | awk '{print $6}'`
+	local   data_dev_size=`$DMSETUP_PROG table | grep ^$DMTHIN_DATA_NAME | awk '{print $3}'`
+	local   pool_dev_size=`$DMSETUP_PROG table | grep ^$DMTHIN_POOL_NAME | awk '{print $3}'`
+	local    cluster_size=`$DMSETUP_PROG table | grep ^$DMTHIN_POOL_NAME | awk '{print $7}'`
+	local       low_water=`$DMSETUP_PROG table | grep ^$DMTHIN_POOL_NAME | awk '{print $8}'`
 
 	# default to 25% growth
 	if [ -z "$add_sectors" ]; then
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux