Skip to contentSkip to conversation

common/dmthin: Fix grep command for finding exact value

PATCH In review Harish 2 participants 3 messages Mar 16, 2017 1 message not in the archive

lore
Share & tools
lore

Harish

author
#0 lore raw

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

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

---
 common/dmthin | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
common/dmthin +2 -2
index e774175..fe48eef 100644
@@ -180,8 +180,8 @@ _dmthin_grow()
 	# 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   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}'`
 
Signature · 1 line
2.7.4
#1 lore raw
Quoted 14 lines · Harish

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

---
 common/dmthin | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
common/dmthin +0 -0
index e774175..fe48eef 100644

common/dmthin _dmthin_grow() · line 184

Quoted 7 lines
common/dmthin +2 -2
@@ -180,8 +180,8 @@ _dmthin_grow()
 	# 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   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}'`

Do we need to do the same to all other $DMTHIN_.*_NAME, not only DMTHIN_DATA_NAME and DMTHIN_POOL_NAME?

Thanks,
Eryu

Quoted 10 lines
common/dmthin +0 -0
 	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}'`
 
Signature · 6 lines
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#3 lore raw
In reply to a message not in the archive
Quoted 26 lines · Harish

On 03/16/2017 12:54 PM, Eryu Guan wrote:

On Thu, Mar 16, 2017 at 10:18:50AM +0530, Harish wrote:

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

---
common/dmthin | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/dmthin b/common/dmthin
index e774175..fe48eef 100644
--- a/common/dmthin
+++ b/common/dmthin
@@ -180,8 +180,8 @@ _dmthin_grow()
# 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 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}'

Quoted 5 lines

Do we need to do the same to all other $DMTHIN_.*_NAME, not only DMTHIN_DATA_NAME and DMTHIN_POOL_NAME?

Just added the cases which failed. we may get the issue with others as well. Can i resend adding for others?

That'd be great, thanks!

Eryu