diff mbox series

[v1.1,1/5] populate: export the metadump description name

Message ID Y0mowyuRHSivs3ho@magnolia (mailing list archive)
State New, archived
Headers show
Series [v1.1,1/5] populate: export the metadump description name | expand

Commit Message

Darrick J. Wong Oct. 14, 2022, 6:21 p.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

Make the variable that holds the contents of the metadump description
file a local variable since we don't need it outside of that function.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
---
v1.1: dont export POPULATE_METADUMP; change the description a bit
---
 common/populate |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Zorro Lang Oct. 15, 2022, 5:01 a.m. UTC | #1
On Fri, Oct 14, 2022 at 11:21:55AM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> Make the variable that holds the contents of the metadump description
> file a local variable since we don't need it outside of that function.
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> Reviewed-by: Zorro Lang <zlang@redhat.com>
> ---
> v1.1: dont export POPULATE_METADUMP; change the description a bit
> ---

So you don't need to export the POPULATE_METADUMP anymore? I remembered you
said something broken and "exporting the variable made it work". Before I
merge this patch, hope to double check with you.

Thanks,
Zorro

>  common/populate |    8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/common/populate b/common/populate
> index cfdaf766f0..ba34ca5844 100644
> --- a/common/populate
> +++ b/common/populate
> @@ -868,15 +868,15 @@ _scratch_populate_cached() {
>  	local meta_tag="$(echo "${meta_descr}" | md5sum - | cut -d ' ' -f 1)"
>  	local metadump_stem="${TEST_DIR}/__populate.${FSTYP}.${meta_tag}"
>  
> -	# These variables are shared outside this function
> +	# This variable is shared outside this function
>  	POPULATE_METADUMP="${metadump_stem}.metadump"
> -	POPULATE_METADUMP_DESCR="${metadump_stem}.txt"
> +	local populate_metadump_descr="${metadump_stem}.txt"
>  
>  	# Don't keep metadata images cached for more 48 hours...
>  	rm -rf "$(find "${POPULATE_METADUMP}" -mtime +2 2>/dev/null)"
>  
>  	# Throw away cached image if it doesn't match our spec.
> -	cmp -s "${POPULATE_METADUMP_DESCR}" <(echo "${meta_descr}") || \
> +	cmp -s "${populate_metadump_descr}" <(echo "${meta_descr}") || \
>  		rm -rf "${POPULATE_METADUMP}"
>  
>  	# Try to restore from the metadump
> @@ -885,7 +885,7 @@ _scratch_populate_cached() {
>  
>  	# Oh well, just create one from scratch
>  	_scratch_mkfs
> -	echo "${meta_descr}" > "${POPULATE_METADUMP_DESCR}"
> +	echo "${meta_descr}" > "${populate_metadump_descr}"
>  	case "${FSTYP}" in
>  	"xfs")
>  		_scratch_xfs_populate $@
>
Zorro Lang Oct. 15, 2022, 5:10 a.m. UTC | #2
On Sat, Oct 15, 2022 at 01:01:44PM +0800, Zorro Lang wrote:
> On Fri, Oct 14, 2022 at 11:21:55AM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> > 
> > Make the variable that holds the contents of the metadump description
> > file a local variable since we don't need it outside of that function.
> > 
> > Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> > Reviewed-by: Zorro Lang <zlang@redhat.com>
> > ---
> > v1.1: dont export POPULATE_METADUMP; change the description a bit
> > ---
> 
> So you don't need to export the POPULATE_METADUMP anymore? I remembered you
> said something broken and "exporting the variable made it work". Before I
> merge this patch, hope to double check with you.

And the subject is still "populate: export the metadump description name", I
think it's not suit for this change. Anyway, as this patch is not depended by
others, I can merge other 4 patches at first. To give you enough time to think
about what do you really like to change :)

Thanks,
Zorro

> 
> Thanks,
> Zorro
> 
> >  common/populate |    8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> > 
> > diff --git a/common/populate b/common/populate
> > index cfdaf766f0..ba34ca5844 100644
> > --- a/common/populate
> > +++ b/common/populate
> > @@ -868,15 +868,15 @@ _scratch_populate_cached() {
> >  	local meta_tag="$(echo "${meta_descr}" | md5sum - | cut -d ' ' -f 1)"
> >  	local metadump_stem="${TEST_DIR}/__populate.${FSTYP}.${meta_tag}"
> >  
> > -	# These variables are shared outside this function
> > +	# This variable is shared outside this function
> >  	POPULATE_METADUMP="${metadump_stem}.metadump"
> > -	POPULATE_METADUMP_DESCR="${metadump_stem}.txt"
> > +	local populate_metadump_descr="${metadump_stem}.txt"
> >  
> >  	# Don't keep metadata images cached for more 48 hours...
> >  	rm -rf "$(find "${POPULATE_METADUMP}" -mtime +2 2>/dev/null)"
> >  
> >  	# Throw away cached image if it doesn't match our spec.
> > -	cmp -s "${POPULATE_METADUMP_DESCR}" <(echo "${meta_descr}") || \
> > +	cmp -s "${populate_metadump_descr}" <(echo "${meta_descr}") || \
> >  		rm -rf "${POPULATE_METADUMP}"
> >  
> >  	# Try to restore from the metadump
> > @@ -885,7 +885,7 @@ _scratch_populate_cached() {
> >  
> >  	# Oh well, just create one from scratch
> >  	_scratch_mkfs
> > -	echo "${meta_descr}" > "${POPULATE_METADUMP_DESCR}"
> > +	echo "${meta_descr}" > "${populate_metadump_descr}"
> >  	case "${FSTYP}" in
> >  	"xfs")
> >  		_scratch_xfs_populate $@
> > 
>
Darrick J. Wong Oct. 15, 2022, 7:23 a.m. UTC | #3
On Sat, Oct 15, 2022 at 01:01:44PM +0800, Zorro Lang wrote:
> On Fri, Oct 14, 2022 at 11:21:55AM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> > 
> > Make the variable that holds the contents of the metadump description
> > file a local variable since we don't need it outside of that function.
> > 
> > Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> > Reviewed-by: Zorro Lang <zlang@redhat.com>
> > ---
> > v1.1: dont export POPULATE_METADUMP; change the description a bit
> > ---
> 
> So you don't need to export the POPULATE_METADUMP anymore? I remembered you
> said something broken and "exporting the variable made it work". Before I
> merge this patch, hope to double check with you.

Yeah, I can't figure out why I ever decided that it had to be exported.
I probably did it in desperation late one night because I have too many
things on my plate and bash scripts suck. :/

IOWs it was a classic "BILD DAMMIT".  But we could lowercase the shoutly
local var :)

--D

> Thanks,
> Zorro
> 
> >  common/populate |    8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> > 
> > diff --git a/common/populate b/common/populate
> > index cfdaf766f0..ba34ca5844 100644
> > --- a/common/populate
> > +++ b/common/populate
> > @@ -868,15 +868,15 @@ _scratch_populate_cached() {
> >  	local meta_tag="$(echo "${meta_descr}" | md5sum - | cut -d ' ' -f 1)"
> >  	local metadump_stem="${TEST_DIR}/__populate.${FSTYP}.${meta_tag}"
> >  
> > -	# These variables are shared outside this function
> > +	# This variable is shared outside this function
> >  	POPULATE_METADUMP="${metadump_stem}.metadump"
> > -	POPULATE_METADUMP_DESCR="${metadump_stem}.txt"
> > +	local populate_metadump_descr="${metadump_stem}.txt"
> >  
> >  	# Don't keep metadata images cached for more 48 hours...
> >  	rm -rf "$(find "${POPULATE_METADUMP}" -mtime +2 2>/dev/null)"
> >  
> >  	# Throw away cached image if it doesn't match our spec.
> > -	cmp -s "${POPULATE_METADUMP_DESCR}" <(echo "${meta_descr}") || \
> > +	cmp -s "${populate_metadump_descr}" <(echo "${meta_descr}") || \
> >  		rm -rf "${POPULATE_METADUMP}"
> >  
> >  	# Try to restore from the metadump
> > @@ -885,7 +885,7 @@ _scratch_populate_cached() {
> >  
> >  	# Oh well, just create one from scratch
> >  	_scratch_mkfs
> > -	echo "${meta_descr}" > "${POPULATE_METADUMP_DESCR}"
> > +	echo "${meta_descr}" > "${populate_metadump_descr}"
> >  	case "${FSTYP}" in
> >  	"xfs")
> >  		_scratch_xfs_populate $@
> >
Darrick J. Wong Oct. 15, 2022, 7:28 a.m. UTC | #4
On Sat, Oct 15, 2022 at 01:10:09PM +0800, Zorro Lang wrote:
> On Sat, Oct 15, 2022 at 01:01:44PM +0800, Zorro Lang wrote:
> > On Fri, Oct 14, 2022 at 11:21:55AM -0700, Darrick J. Wong wrote:
> > > From: Darrick J. Wong <djwong@kernel.org>
> > > 
> > > Make the variable that holds the contents of the metadump description
> > > file a local variable since we don't need it outside of that function.
> > > 
> > > Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> > > Reviewed-by: Zorro Lang <zlang@redhat.com>
> > > ---
> > > v1.1: dont export POPULATE_METADUMP; change the description a bit
> > > ---
> > 
> > So you don't need to export the POPULATE_METADUMP anymore? I remembered you
> > said something broken and "exporting the variable made it work". Before I
> > merge this patch, hope to double check with you.
> 
> And the subject is still "populate: export the metadump description name", I
> think it's not suit for this change. Anyway, as this patch is not depended by
> others, I can merge other 4 patches at first. To give you enough time to think
> about what do you really like to change :)

<sigh> I updated the commit message in git and forgot to copy-paste the
new subject into the email.  Sorry about all this stupid crap, bash is a
terrible language and email is a godawful process and both should be
smote off the planet.

--D

> Thanks,
> Zorro
> 
> > 
> > Thanks,
> > Zorro
> > 
> > >  common/populate |    8 ++++----
> > >  1 file changed, 4 insertions(+), 4 deletions(-)
> > > 
> > > diff --git a/common/populate b/common/populate
> > > index cfdaf766f0..ba34ca5844 100644
> > > --- a/common/populate
> > > +++ b/common/populate
> > > @@ -868,15 +868,15 @@ _scratch_populate_cached() {
> > >  	local meta_tag="$(echo "${meta_descr}" | md5sum - | cut -d ' ' -f 1)"
> > >  	local metadump_stem="${TEST_DIR}/__populate.${FSTYP}.${meta_tag}"
> > >  
> > > -	# These variables are shared outside this function
> > > +	# This variable is shared outside this function
> > >  	POPULATE_METADUMP="${metadump_stem}.metadump"
> > > -	POPULATE_METADUMP_DESCR="${metadump_stem}.txt"
> > > +	local populate_metadump_descr="${metadump_stem}.txt"
> > >  
> > >  	# Don't keep metadata images cached for more 48 hours...
> > >  	rm -rf "$(find "${POPULATE_METADUMP}" -mtime +2 2>/dev/null)"
> > >  
> > >  	# Throw away cached image if it doesn't match our spec.
> > > -	cmp -s "${POPULATE_METADUMP_DESCR}" <(echo "${meta_descr}") || \
> > > +	cmp -s "${populate_metadump_descr}" <(echo "${meta_descr}") || \
> > >  		rm -rf "${POPULATE_METADUMP}"
> > >  
> > >  	# Try to restore from the metadump
> > > @@ -885,7 +885,7 @@ _scratch_populate_cached() {
> > >  
> > >  	# Oh well, just create one from scratch
> > >  	_scratch_mkfs
> > > -	echo "${meta_descr}" > "${POPULATE_METADUMP_DESCR}"
> > > +	echo "${meta_descr}" > "${populate_metadump_descr}"
> > >  	case "${FSTYP}" in
> > >  	"xfs")
> > >  		_scratch_xfs_populate $@
> > > 
> > 
>
Zorro Lang Oct. 15, 2022, 8:21 a.m. UTC | #5
On Sat, Oct 15, 2022 at 12:28:09AM -0700, Darrick J. Wong wrote:
> On Sat, Oct 15, 2022 at 01:10:09PM +0800, Zorro Lang wrote:
> > On Sat, Oct 15, 2022 at 01:01:44PM +0800, Zorro Lang wrote:
> > > On Fri, Oct 14, 2022 at 11:21:55AM -0700, Darrick J. Wong wrote:
> > > > From: Darrick J. Wong <djwong@kernel.org>
> > > > 
> > > > Make the variable that holds the contents of the metadump description
> > > > file a local variable since we don't need it outside of that function.
> > > > 
> > > > Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> > > > Reviewed-by: Zorro Lang <zlang@redhat.com>
> > > > ---
> > > > v1.1: dont export POPULATE_METADUMP; change the description a bit
> > > > ---
> > > 
> > > So you don't need to export the POPULATE_METADUMP anymore? I remembered you
> > > said something broken and "exporting the variable made it work". Before I
> > > merge this patch, hope to double check with you.
> > 
> > And the subject is still "populate: export the metadump description name", I
> > think it's not suit for this change. Anyway, as this patch is not depended by
> > others, I can merge other 4 patches at first. To give you enough time to think
> > about what do you really like to change :)
> 
> <sigh> I updated the commit message in git and forgot to copy-paste the
> new subject into the email.  Sorry about all this stupid crap, bash is a
> terrible language and email is a godawful process and both should be
> smote off the planet.

I can help to change this subject if you're sure this change is fine for you.

BTW, if the POPULATE_METADUMP isn't affect your test anymore, I think we're
not hurry to have this patch which only make a variable to be local. How about
I merge other 4 patches at first, then you can have more time to watch your
later testing results, and think about if you need more changes?

Thanks,
Zorro

> 
> --D
> 
> > Thanks,
> > Zorro
> > 
> > > 
> > > Thanks,
> > > Zorro
> > > 
> > > >  common/populate |    8 ++++----
> > > >  1 file changed, 4 insertions(+), 4 deletions(-)
> > > > 
> > > > diff --git a/common/populate b/common/populate
> > > > index cfdaf766f0..ba34ca5844 100644
> > > > --- a/common/populate
> > > > +++ b/common/populate
> > > > @@ -868,15 +868,15 @@ _scratch_populate_cached() {
> > > >  	local meta_tag="$(echo "${meta_descr}" | md5sum - | cut -d ' ' -f 1)"
> > > >  	local metadump_stem="${TEST_DIR}/__populate.${FSTYP}.${meta_tag}"
> > > >  
> > > > -	# These variables are shared outside this function
> > > > +	# This variable is shared outside this function
> > > >  	POPULATE_METADUMP="${metadump_stem}.metadump"
> > > > -	POPULATE_METADUMP_DESCR="${metadump_stem}.txt"
> > > > +	local populate_metadump_descr="${metadump_stem}.txt"
> > > >  
> > > >  	# Don't keep metadata images cached for more 48 hours...
> > > >  	rm -rf "$(find "${POPULATE_METADUMP}" -mtime +2 2>/dev/null)"
> > > >  
> > > >  	# Throw away cached image if it doesn't match our spec.
> > > > -	cmp -s "${POPULATE_METADUMP_DESCR}" <(echo "${meta_descr}") || \
> > > > +	cmp -s "${populate_metadump_descr}" <(echo "${meta_descr}") || \
> > > >  		rm -rf "${POPULATE_METADUMP}"
> > > >  
> > > >  	# Try to restore from the metadump
> > > > @@ -885,7 +885,7 @@ _scratch_populate_cached() {
> > > >  
> > > >  	# Oh well, just create one from scratch
> > > >  	_scratch_mkfs
> > > > -	echo "${meta_descr}" > "${POPULATE_METADUMP_DESCR}"
> > > > +	echo "${meta_descr}" > "${populate_metadump_descr}"
> > > >  	case "${FSTYP}" in
> > > >  	"xfs")
> > > >  		_scratch_xfs_populate $@
> > > > 
> > > 
> > 
>
diff mbox series

Patch

diff --git a/common/populate b/common/populate
index cfdaf766f0..ba34ca5844 100644
--- a/common/populate
+++ b/common/populate
@@ -868,15 +868,15 @@  _scratch_populate_cached() {
 	local meta_tag="$(echo "${meta_descr}" | md5sum - | cut -d ' ' -f 1)"
 	local metadump_stem="${TEST_DIR}/__populate.${FSTYP}.${meta_tag}"
 
-	# These variables are shared outside this function
+	# This variable is shared outside this function
 	POPULATE_METADUMP="${metadump_stem}.metadump"
-	POPULATE_METADUMP_DESCR="${metadump_stem}.txt"
+	local populate_metadump_descr="${metadump_stem}.txt"
 
 	# Don't keep metadata images cached for more 48 hours...
 	rm -rf "$(find "${POPULATE_METADUMP}" -mtime +2 2>/dev/null)"
 
 	# Throw away cached image if it doesn't match our spec.
-	cmp -s "${POPULATE_METADUMP_DESCR}" <(echo "${meta_descr}") || \
+	cmp -s "${populate_metadump_descr}" <(echo "${meta_descr}") || \
 		rm -rf "${POPULATE_METADUMP}"
 
 	# Try to restore from the metadump
@@ -885,7 +885,7 @@  _scratch_populate_cached() {
 
 	# Oh well, just create one from scratch
 	_scratch_mkfs
-	echo "${meta_descr}" > "${POPULATE_METADUMP_DESCR}"
+	echo "${meta_descr}" > "${populate_metadump_descr}"
 	case "${FSTYP}" in
 	"xfs")
 		_scratch_xfs_populate $@