linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Cc: fstests@vger.kernel.org, linux-btrfs@vger.kernel.org,
	linux-xfs@vger.kernel.org, linux-ext4@vger.kernel.org,
	Naohiro Aota <naohiro.aota@wdc.com>,
	Johannes Thumshirn <johannes.thumshirn@wdc.com>,
	Damien Le Moal <damien.lemoal@opensource.wdc.com>
Subject: Re: [PATCH v2 6/6] common: factor out xfs unique part from _filter_mkfs
Date: Wed, 9 Feb 2022 14:32:34 -0800	[thread overview]
Message-ID: <20220209223234.GH8313@magnolia> (raw)
In-Reply-To: <20220209123305.253038-7-shinichiro.kawasaki@wdc.com>

On Wed, Feb 09, 2022 at 09:33:05PM +0900, Shin'ichiro Kawasaki wrote:
> Most of the code in the function _filter_mkfs is xfs unique. This is
> misleading that the function would be dedicated for xfs. Clean up the
> function by factoring out xfs unique part to _xfs_filter_mkfs in
> common/xfs. While at the same time, fix indent in _xfs_filter_mkfs to be
> consistent with other functions in common/xfs.
> 
> Suggested-by: Darrick J. Wong <djwong@kernel.org>
> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>

Thanks!!
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  common/filter | 40 +---------------------------------------
>  common/xfs    | 41 +++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 42 insertions(+), 39 deletions(-)
> 
> diff --git a/common/filter b/common/filter
> index c3db7a56..257227c2 100644
> --- a/common/filter
> +++ b/common/filter
> @@ -121,53 +121,15 @@ _filter_mkfs()
>  {
>      case $FSTYP in
>      xfs)
> +	_xfs_filter_mkfs "$@"
>  	;;
>      *)
>  	cat - >/dev/null
>  	perl -e 'print STDERR "dbsize=4096\nisize=256\n"'
>  	return ;;
>      esac
> -
> -    echo "_fs_has_crcs=0" >&2
> -    set -
> -    perl -ne '
> -    if (/^meta-data=([\w,|\/.-]+)\s+isize=(\d+)\s+agcount=(\d+), agsize=(\d+) blks/) {
> -	print STDERR "ddev=$1\nisize=$2\nagcount=$3\nagsize=$4\n";
> -	print STDOUT "meta-data=DDEV isize=XXX agcount=N, agsize=XXX blks\n";
> -    }
> -    if (/^\s+=\s+sectsz=(\d+)\s+attr=(\d+)/) {
> -        print STDERR "sectsz=$1\nattr=$2\n";
> -    }
> -    if (/^\s+=\s+crc=(\d)/) {
> -        print STDERR "_fs_has_crcs=$1\n";
> -    }
> -    if (/^data\s+=\s+bsize=(\d+)\s+blocks=(\d+), imaxpct=(\d+)/) {
> -	print STDERR "dbsize=$1\ndblocks=$2\nimaxpct=$3\n";
> -	print STDOUT "data     = bsize=XXX blocks=XXX, imaxpct=PCT\n";
> -    }
> -    if (/^\s+=\s+sunit=(\d+)\s+swidth=(\d+) blks/) {
> -        print STDERR "sunit=$1\nswidth=$2\nunwritten=1\n";
> -	print STDOUT "         = sunit=XXX swidth=XXX, unwritten=X\n";
> -    }
> -    if (/^naming\s+=version\s+(\d+)\s+bsize=(\d+)/) {
> -	print STDERR "dirversion=$1\ndirbsize=$2\n";
> -	print STDOUT "naming   =VERN bsize=XXX\n";
> -    }
> -    if (/^log\s+=(internal log|[\w|\/.-]+)\s+bsize=(\d+)\s+blocks=(\d+),\s+version=(\d+)/ ||
> -	/^log\s+=(internal log|[\w|\/.-]+)\s+bsize=(\d+)\s+blocks=(\d+)/) {
> -	print STDERR "ldev=\"$1\"\nlbsize=$2\nlblocks=$3\nlversion=$4\n";
> -	print STDOUT "log      =LDEV bsize=XXX blocks=XXX\n";
> -    }
> -    if (/^\s+=\s+sectsz=(\d+)\s+sunit=(\d+) blks/) {
> -	print STDERR "logsectsz=$1\nlogsunit=$2\n\n";
> -    }
> -    if (/^realtime\s+=([\w|\/.-]+)\s+extsz=(\d+)\s+blocks=(\d+), rtextents=(\d+)/) {
> -	print STDERR "rtdev=$1\nrtextsz=$2\nrtblocks=$3\nrtextents=$4\n";
> -	print STDOUT "realtime =RDEV extsz=XXX blocks=XXX, rtextents=XXX\n";
> -    }'
>  }
>  
> -
>  # prints the bits we care about in growfs
>  # 
>  _filter_growfs()
> diff --git a/common/xfs b/common/xfs
> index 713e9fe7..053b6189 100644
> --- a/common/xfs
> +++ b/common/xfs
> @@ -1275,3 +1275,44 @@ _require_scratch_xfs_bigtime()
>  		_notrun "bigtime feature not advertised on mount?"
>  	_scratch_unmount
>  }
> +
> +_xfs_filter_mkfs()
> +{
> +	echo "_fs_has_crcs=0" >&2
> +	set -
> +	perl -ne '
> +	if (/^meta-data=([\w,|\/.-]+)\s+isize=(\d+)\s+agcount=(\d+), agsize=(\d+) blks/) {
> +		print STDERR "ddev=$1\nisize=$2\nagcount=$3\nagsize=$4\n";
> +		print STDOUT "meta-data=DDEV isize=XXX agcount=N, agsize=XXX blks\n";
> +	}
> +	if (/^\s+=\s+sectsz=(\d+)\s+attr=(\d+)/) {
> +		print STDERR "sectsz=$1\nattr=$2\n";
> +	}
> +	if (/^\s+=\s+crc=(\d)/) {
> +		print STDERR "_fs_has_crcs=$1\n";
> +	}
> +	if (/^data\s+=\s+bsize=(\d+)\s+blocks=(\d+), imaxpct=(\d+)/) {
> +		print STDERR "dbsize=$1\ndblocks=$2\nimaxpct=$3\n";
> +		print STDOUT "data     = bsize=XXX blocks=XXX, imaxpct=PCT\n";
> +	}
> +	if (/^\s+=\s+sunit=(\d+)\s+swidth=(\d+) blks/) {
> +		print STDERR "sunit=$1\nswidth=$2\nunwritten=1\n";
> +		print STDOUT "         = sunit=XXX swidth=XXX, unwritten=X\n";
> +	}
> +	if (/^naming\s+=version\s+(\d+)\s+bsize=(\d+)/) {
> +		print STDERR "dirversion=$1\ndirbsize=$2\n";
> +		print STDOUT "naming   =VERN bsize=XXX\n";
> +	}
> +	if (/^log\s+=(internal log|[\w|\/.-]+)\s+bsize=(\d+)\s+blocks=(\d+),\s+version=(\d+)/ ||
> +		/^log\s+=(internal log|[\w|\/.-]+)\s+bsize=(\d+)\s+blocks=(\d+)/) {
> +		print STDERR "ldev=\"$1\"\nlbsize=$2\nlblocks=$3\nlversion=$4\n";
> +		print STDOUT "log      =LDEV bsize=XXX blocks=XXX\n";
> +	}
> +	if (/^\s+=\s+sectsz=(\d+)\s+sunit=(\d+) blks/) {
> +		print STDERR "logsectsz=$1\nlogsunit=$2\n\n";
> +	}
> +	if (/^realtime\s+=([\w|\/.-]+)\s+extsz=(\d+)\s+blocks=(\d+), rtextents=(\d+)/) {
> +		print STDERR "rtdev=$1\nrtextsz=$2\nrtblocks=$3\nrtextents=$4\n";
> +		print STDOUT "realtime =RDEV extsz=XXX blocks=XXX, rtextents=XXX\n";
> +	}'
> +}
> -- 
> 2.34.1
> 

      reply	other threads:[~2022-02-09 22:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-09 12:32 [PATCH v2 0/6] fstests: fix _scratch_mkfs_sized failure handling Shin'ichiro Kawasaki
2022-02-09 12:33 ` [PATCH v2 1/6] common/rc: fix btrfs mixed mode usage in _scratch_mkfs_sized Shin'ichiro Kawasaki
2022-02-15 15:53   ` Johannes Thumshirn
2022-02-09 12:33 ` [PATCH v2 2/6] generic/204: remove unnecessary _scratch_mkfs call Shin'ichiro Kawasaki
2022-02-09 22:31   ` Darrick J. Wong
2022-02-11  2:07     ` Shinichiro Kawasaki
2022-02-09 12:33 ` [PATCH v2 3/6] generic/{171,172,173,174}: check _scratch_mkfs_sized return code Shin'ichiro Kawasaki
2022-02-09 22:31   ` Darrick J. Wong
2022-02-09 12:33 ` [PATCH v2 4/6] ext4/021: " Shin'ichiro Kawasaki
2022-02-09 22:32   ` Darrick J. Wong
2022-02-09 12:33 ` [PATCH v2 5/6] xfs/015: " Shin'ichiro Kawasaki
2022-02-09 12:33 ` [PATCH v2 6/6] common: factor out xfs unique part from _filter_mkfs Shin'ichiro Kawasaki
2022-02-09 22:32   ` Darrick J. Wong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220209223234.GH8313@magnolia \
    --to=djwong@kernel.org \
    --cc=damien.lemoal@opensource.wdc.com \
    --cc=fstests@vger.kernel.org \
    --cc=johannes.thumshirn@wdc.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=naohiro.aota@wdc.com \
    --cc=shinichiro.kawasaki@wdc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).