diff mbox series

[3/3] xfstests: Move *_dump_log routines to common/xfs

Message ID 20210909174142.357719-4-catherine.hoang@oracle.com (mailing list archive)
State Deferred, archived
Headers show
Series Dump log cleanups | expand

Commit Message

Catherine Hoang Sept. 9, 2021, 5:41 p.m. UTC
Move _scratch_remount_dump_log and _test_remount_dump_log from
common/inject to common/xfs. These routines do not inject errors and
should be placed with other xfs common functions.

Signed-off-by: Catherine Hoang <catherine.hoang@oracle.com>
---
 common/inject | 26 --------------------------
 common/xfs    | 26 ++++++++++++++++++++++++++
 2 files changed, 26 insertions(+), 26 deletions(-)

Comments

Allison Henderson Sept. 11, 2021, 2:11 p.m. UTC | #1
On 9/9/21 10:41 AM, Catherine Hoang wrote:
> Move _scratch_remount_dump_log and _test_remount_dump_log from
> common/inject to common/xfs. These routines do not inject errors and
> should be placed with other xfs common functions.
> 
> Signed-off-by: Catherine Hoang <catherine.hoang@oracle.com>

Looks ok
Reviewed-by: Allison Henderson <allison.henderson@oracle.com>

> ---
>   common/inject | 26 --------------------------
>   common/xfs    | 26 ++++++++++++++++++++++++++
>   2 files changed, 26 insertions(+), 26 deletions(-)
> 
> diff --git a/common/inject b/common/inject
> index b5334d4a..6b590804 100644
> --- a/common/inject
> +++ b/common/inject
> @@ -111,29 +111,3 @@ _scratch_inject_error()
>   		_fail "Cannot inject error ${type} value ${value}."
>   	fi
>   }
> -
> -# Unmount and remount the scratch device, dumping the log
> -_scratch_remount_dump_log()
> -{
> -	local opts="$1"
> -
> -	if test -n "$opts"; then
> -		opts="-o $opts"
> -	fi
> -	_scratch_unmount
> -	_scratch_dump_log
> -	_scratch_mount "$opts"
> -}
> -
> -# Unmount and remount the test device, dumping the log
> -_test_remount_dump_log()
> -{
> -	local opts="$1"
> -
> -	if test -n "$opts"; then
> -		opts="-o $opts"
> -	fi
> -	_test_unmount
> -	_test_dump_log
> -	_test_mount "$opts"
> -}
> diff --git a/common/xfs b/common/xfs
> index bfb1bf1e..cda1f768 100644
> --- a/common/xfs
> +++ b/common/xfs
> @@ -1263,3 +1263,29 @@ _require_scratch_xfs_bigtime()
>   		_notrun "bigtime feature not advertised on mount?"
>   	_scratch_unmount
>   }
> +
> +# Unmount and remount the scratch device, dumping the log
> +_scratch_remount_dump_log()
> +{
> +	local opts="$1"
> +
> +	if test -n "$opts"; then
> +		opts="-o $opts"
> +	fi
> +	_scratch_unmount
> +	_scratch_dump_log
> +	_scratch_mount "$opts"
> +}
> +
> +# Unmount and remount the test device, dumping the log
> +_test_remount_dump_log()
> +{
> +	local opts="$1"
> +
> +	if test -n "$opts"; then
> +		opts="-o $opts"
> +	fi
> +	_test_unmount
> +	_test_dump_log
> +	_test_mount "$opts"
> +}
>
Eryu Guan Sept. 12, 2021, 8:13 a.m. UTC | #2
On Thu, Sep 09, 2021 at 05:41:42PM +0000, Catherine Hoang wrote:
> Move _scratch_remount_dump_log and _test_remount_dump_log from
> common/inject to common/xfs. These routines do not inject errors and
> should be placed with other xfs common functions.
> 
> Signed-off-by: Catherine Hoang <catherine.hoang@oracle.com>
> ---
>  common/inject | 26 --------------------------
>  common/xfs    | 26 ++++++++++++++++++++++++++
>  2 files changed, 26 insertions(+), 26 deletions(-)
> 
> diff --git a/common/inject b/common/inject
> index b5334d4a..6b590804 100644
> --- a/common/inject
> +++ b/common/inject
> @@ -111,29 +111,3 @@ _scratch_inject_error()
>  		_fail "Cannot inject error ${type} value ${value}."
>  	fi
>  }
> -
> -# Unmount and remount the scratch device, dumping the log
> -_scratch_remount_dump_log()
> -{
> -	local opts="$1"
> -
> -	if test -n "$opts"; then
> -		opts="-o $opts"
> -	fi
> -	_scratch_unmount
> -	_scratch_dump_log

This function is a common function that could handle multiple
filesystems, currently it supports xfs, ext4 and f2fs. So it's not a
xfs-specific function, and moving it to common/xfs doesn't seem correct.
Perhaps we should move it to common/log.

> -	_scratch_mount "$opts"
> -}
> -
> -# Unmount and remount the test device, dumping the log
> -_test_remount_dump_log()
> -{
> -	local opts="$1"
> -
> -	if test -n "$opts"; then
> -		opts="-o $opts"
> -	fi
> -	_test_unmount
> -	_test_dump_log

Same here.

Thanks,
Eryu

> -	_test_mount "$opts"
> -}
> diff --git a/common/xfs b/common/xfs
> index bfb1bf1e..cda1f768 100644
> --- a/common/xfs
> +++ b/common/xfs
> @@ -1263,3 +1263,29 @@ _require_scratch_xfs_bigtime()
>  		_notrun "bigtime feature not advertised on mount?"
>  	_scratch_unmount
>  }
> +
> +# Unmount and remount the scratch device, dumping the log
> +_scratch_remount_dump_log()
> +{
> +	local opts="$1"
> +
> +	if test -n "$opts"; then
> +		opts="-o $opts"
> +	fi
> +	_scratch_unmount
> +	_scratch_dump_log
> +	_scratch_mount "$opts"
> +}
> +
> +# Unmount and remount the test device, dumping the log
> +_test_remount_dump_log()
> +{
> +	local opts="$1"
> +
> +	if test -n "$opts"; then
> +		opts="-o $opts"
> +	fi
> +	_test_unmount
> +	_test_dump_log
> +	_test_mount "$opts"
> +}
> -- 
> 2.25.1
Darrick J. Wong Sept. 13, 2021, 5:08 p.m. UTC | #3
[add ext4 list to cc]

On Sun, Sep 12, 2021 at 04:13:33PM +0800, Eryu Guan wrote:
> On Thu, Sep 09, 2021 at 05:41:42PM +0000, Catherine Hoang wrote:
> > Move _scratch_remount_dump_log and _test_remount_dump_log from
> > common/inject to common/xfs. These routines do not inject errors and
> > should be placed with other xfs common functions.
> > 
> > Signed-off-by: Catherine Hoang <catherine.hoang@oracle.com>
> > ---
> >  common/inject | 26 --------------------------
> >  common/xfs    | 26 ++++++++++++++++++++++++++
> >  2 files changed, 26 insertions(+), 26 deletions(-)
> > 
> > diff --git a/common/inject b/common/inject
> > index b5334d4a..6b590804 100644
> > --- a/common/inject
> > +++ b/common/inject
> > @@ -111,29 +111,3 @@ _scratch_inject_error()
> >  		_fail "Cannot inject error ${type} value ${value}."
> >  	fi
> >  }
> > -
> > -# Unmount and remount the scratch device, dumping the log
> > -_scratch_remount_dump_log()
> > -{
> > -	local opts="$1"
> > -
> > -	if test -n "$opts"; then
> > -		opts="-o $opts"
> > -	fi
> > -	_scratch_unmount
> > -	_scratch_dump_log
> 
> This function is a common function that could handle multiple
> filesystems, currently it supports xfs, ext4 and f2fs. So it's not a

I don't think it even works correctly for ext*.  *_dump_log() calls
dumpe2fs -h, which displays the superblock contents, not the journal
contents themselves, which is (I think) what this helper is supposed to
do.

It really ought to do something along the lines of:

	echo 'logdump -a' | debugfs $SCRATCH_DEV

Though fixing this is probably something the ext4 developers should look
at...

> xfs-specific function, and moving it to common/xfs doesn't seem correct.
> Perhaps we should move it to common/log.

Agreed. ;)

--D

> > -	_scratch_mount "$opts"
> > -}
> > -
> > -# Unmount and remount the test device, dumping the log
> > -_test_remount_dump_log()
> > -{
> > -	local opts="$1"
> > -
> > -	if test -n "$opts"; then
> > -		opts="-o $opts"
> > -	fi
> > -	_test_unmount
> > -	_test_dump_log
> 
> Same here.
> 
> Thanks,
> Eryu
> 
> > -	_test_mount "$opts"
> > -}
> > diff --git a/common/xfs b/common/xfs
> > index bfb1bf1e..cda1f768 100644
> > --- a/common/xfs
> > +++ b/common/xfs
> > @@ -1263,3 +1263,29 @@ _require_scratch_xfs_bigtime()
> >  		_notrun "bigtime feature not advertised on mount?"
> >  	_scratch_unmount
> >  }
> > +
> > +# Unmount and remount the scratch device, dumping the log
> > +_scratch_remount_dump_log()
> > +{
> > +	local opts="$1"
> > +
> > +	if test -n "$opts"; then
> > +		opts="-o $opts"
> > +	fi
> > +	_scratch_unmount
> > +	_scratch_dump_log
> > +	_scratch_mount "$opts"
> > +}
> > +
> > +# Unmount and remount the test device, dumping the log
> > +_test_remount_dump_log()
> > +{
> > +	local opts="$1"
> > +
> > +	if test -n "$opts"; then
> > +		opts="-o $opts"
> > +	fi
> > +	_test_unmount
> > +	_test_dump_log
> > +	_test_mount "$opts"
> > +}
> > -- 
> > 2.25.1
Catherine Hoang Sept. 13, 2021, 5:41 p.m. UTC | #4
> On Sep 12, 2021, at 1:13 AM, Eryu Guan <guan@eryu.me> wrote:
> 
> On Thu, Sep 09, 2021 at 05:41:42PM +0000, Catherine Hoang wrote:
>> Move _scratch_remount_dump_log and _test_remount_dump_log from
>> common/inject to common/xfs. These routines do not inject errors and
>> should be placed with other xfs common functions.
>> 
>> Signed-off-by: Catherine Hoang <catherine.hoang@oracle.com>
>> ---
>> common/inject | 26 --------------------------
>> common/xfs    | 26 ++++++++++++++++++++++++++
>> 2 files changed, 26 insertions(+), 26 deletions(-)
>> 
>> diff --git a/common/inject b/common/inject
>> index b5334d4a..6b590804 100644
>> --- a/common/inject
>> +++ b/common/inject
>> @@ -111,29 +111,3 @@ _scratch_inject_error()
>> 		_fail "Cannot inject error ${type} value ${value}."
>> 	fi
>> }
>> -
>> -# Unmount and remount the scratch device, dumping the log
>> -_scratch_remount_dump_log()
>> -{
>> -	local opts="$1"
>> -
>> -	if test -n "$opts"; then
>> -		opts="-o $opts"
>> -	fi
>> -	_scratch_unmount
>> -	_scratch_dump_log
> 
> This function is a common function that could handle multiple
> filesystems, currently it supports xfs, ext4 and f2fs. So it's not a
> xfs-specific function, and moving it to common/xfs doesn't seem correct.
> Perhaps we should move it to common/log.
I see, I will move this to common/log on the next revision.
> 
>> -	_scratch_mount "$opts"
>> -}
>> -
>> -# Unmount and remount the test device, dumping the log
>> -_test_remount_dump_log()
>> -{
>> -	local opts="$1"
>> -
>> -	if test -n "$opts"; then
>> -		opts="-o $opts"
>> -	fi
>> -	_test_unmount
>> -	_test_dump_log
> 
> Same here.
> 
> Thanks,
> Eryu
Sure, will move this too. Thanks for the feedback!
Catherine
> 
>> -	_test_mount "$opts"
>> -}
>> diff --git a/common/xfs b/common/xfs
>> index bfb1bf1e..cda1f768 100644
>> --- a/common/xfs
>> +++ b/common/xfs
>> @@ -1263,3 +1263,29 @@ _require_scratch_xfs_bigtime()
>> 		_notrun "bigtime feature not advertised on mount?"
>> 	_scratch_unmount
>> }
>> +
>> +# Unmount and remount the scratch device, dumping the log
>> +_scratch_remount_dump_log()
>> +{
>> +	local opts="$1"
>> +
>> +	if test -n "$opts"; then
>> +		opts="-o $opts"
>> +	fi
>> +	_scratch_unmount
>> +	_scratch_dump_log
>> +	_scratch_mount "$opts"
>> +}
>> +
>> +# Unmount and remount the test device, dumping the log
>> +_test_remount_dump_log()
>> +{
>> +	local opts="$1"
>> +
>> +	if test -n "$opts"; then
>> +		opts="-o $opts"
>> +	fi
>> +	_test_unmount
>> +	_test_dump_log
>> +	_test_mount "$opts"
>> +}
>> -- 
>> 2.25.1
diff mbox series

Patch

diff --git a/common/inject b/common/inject
index b5334d4a..6b590804 100644
--- a/common/inject
+++ b/common/inject
@@ -111,29 +111,3 @@  _scratch_inject_error()
 		_fail "Cannot inject error ${type} value ${value}."
 	fi
 }
-
-# Unmount and remount the scratch device, dumping the log
-_scratch_remount_dump_log()
-{
-	local opts="$1"
-
-	if test -n "$opts"; then
-		opts="-o $opts"
-	fi
-	_scratch_unmount
-	_scratch_dump_log
-	_scratch_mount "$opts"
-}
-
-# Unmount and remount the test device, dumping the log
-_test_remount_dump_log()
-{
-	local opts="$1"
-
-	if test -n "$opts"; then
-		opts="-o $opts"
-	fi
-	_test_unmount
-	_test_dump_log
-	_test_mount "$opts"
-}
diff --git a/common/xfs b/common/xfs
index bfb1bf1e..cda1f768 100644
--- a/common/xfs
+++ b/common/xfs
@@ -1263,3 +1263,29 @@  _require_scratch_xfs_bigtime()
 		_notrun "bigtime feature not advertised on mount?"
 	_scratch_unmount
 }
+
+# Unmount and remount the scratch device, dumping the log
+_scratch_remount_dump_log()
+{
+	local opts="$1"
+
+	if test -n "$opts"; then
+		opts="-o $opts"
+	fi
+	_scratch_unmount
+	_scratch_dump_log
+	_scratch_mount "$opts"
+}
+
+# Unmount and remount the test device, dumping the log
+_test_remount_dump_log()
+{
+	local opts="$1"
+
+	if test -n "$opts"; then
+		opts="-o $opts"
+	fi
+	_test_unmount
+	_test_dump_log
+	_test_mount "$opts"
+}