diff mbox series

[v2,5/8] common: add zoned block device checks

Message ID 20210811151232.3713733-6-naohiro.aota@wdc.com (mailing list archive)
State New, archived
Headers show
Series fstests: add checks for testing zoned btrfs | expand

Commit Message

Naohiro Aota Aug. 11, 2021, 3:12 p.m. UTC
dm-error and dm-snapshot does not have DM_TARGET_ZONED_HM nor
DM_TARGET_MIXED_ZONED_MODEL feature and does not implement
.report_zones(). So, it cannot pass the zone information from the down
layer (zoned device) to the upper layer.

Loop device also cannot pass the zone information.

This patch requires non-zoned block device for the tests using these
ones.

Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
---
 common/dmerror    | 3 +++
 common/dmhugedisk | 3 +++
 common/rc         | 7 +++++++
 3 files changed, 13 insertions(+)

Comments

Eryu Guan Aug. 15, 2021, 2:42 p.m. UTC | #1
On Thu, Aug 12, 2021 at 12:12:29AM +0900, Naohiro Aota wrote:
> dm-error and dm-snapshot does not have DM_TARGET_ZONED_HM nor
> DM_TARGET_MIXED_ZONED_MODEL feature and does not implement
> .report_zones(). So, it cannot pass the zone information from the down
> layer (zoned device) to the upper layer.
> 
> Loop device also cannot pass the zone information.
> 
> This patch requires non-zoned block device for the tests using these
> ones.
> 
> Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
> ---
>  common/dmerror    | 3 +++
>  common/dmhugedisk | 3 +++
>  common/rc         | 7 +++++++
>  3 files changed, 13 insertions(+)
> 
> diff --git a/common/dmerror b/common/dmerror
> index 01a4c8b5e52d..64ee78d85b95 100644
> --- a/common/dmerror
> +++ b/common/dmerror
> @@ -15,6 +15,9 @@ _dmerror_setup()
>  	export DMLINEAR_TABLE="0 $blk_dev_size linear $dm_backing_dev 0"
>  
>  	export DMERROR_TABLE="0 $blk_dev_size error $dm_backing_dev 0"
> +
> +	# dm-error cannot handle zone information
> +	_require_non_zoned_device "${dm_backing_dev}"

We should really do the check in _require rules not in _setup()
functions. Please see below.

>  }
>  
>  _dmerror_init()
> diff --git a/common/dmhugedisk b/common/dmhugedisk
> index 502f0243772d..715f95efde29 100644
> --- a/common/dmhugedisk
> +++ b/common/dmhugedisk
> @@ -16,6 +16,9 @@ _dmhugedisk_init()
>  	local dm_backing_dev=$SCRATCH_DEV
>  	local chunk_size="$2"
>  
> +	# We cannot ensure sequential writes on the backing device
> +	_require_non_zoned_device $dm_backing_dev
> +
>  	if [ -z "$chunk_size" ]; then
>  		chunk_size=512
>  	fi
> diff --git a/common/rc b/common/rc
> index 7b80820ff680..03b7e0310a84 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -1837,6 +1837,9 @@ _require_loop()
>      else
>  	_notrun "This test requires loopback device support"
>      fi
> +
> +    # loop device does not handle zone information
> +    _require_non_zoned_device ${TEST_DEV}
>  }
>  
>  # this test requires kernel support for a secondary filesystem
> @@ -1966,6 +1969,10 @@ _require_dm_target()
>  	if [ $? -ne 0 ]; then
>  		_notrun "This test requires dm $target support"
>  	fi
> +
> +	if [ $target = thin-pool ]; then
> +		_require_non_zoned_device ${SCRATCH_DEV}
> +	fi

I think we could move all check here, based on $target, e.g.

	case $target in
	thin-pool|error|snapshot)
		_require_non_zoned_device ${SCRATCH_DEV}
		;;
	esac

Thanks,
Eryu

>  }
>  
>  _zone_type()
> -- 
> 2.32.0
Naohiro Aota Aug. 16, 2021, 6:06 a.m. UTC | #2
On Sun, Aug 15, 2021 at 10:42:46PM +0800, Eryu Guan wrote:
> On Thu, Aug 12, 2021 at 12:12:29AM +0900, Naohiro Aota wrote:
> > dm-error and dm-snapshot does not have DM_TARGET_ZONED_HM nor
> > DM_TARGET_MIXED_ZONED_MODEL feature and does not implement
> > .report_zones(). So, it cannot pass the zone information from the down
> > layer (zoned device) to the upper layer.
> > 
> > Loop device also cannot pass the zone information.
> > 
> > This patch requires non-zoned block device for the tests using these
> > ones.
> > 
> > Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
> > ---
> >  common/dmerror    | 3 +++
> >  common/dmhugedisk | 3 +++
> >  common/rc         | 7 +++++++
> >  3 files changed, 13 insertions(+)
> > 
> > diff --git a/common/dmerror b/common/dmerror
> > index 01a4c8b5e52d..64ee78d85b95 100644
> > --- a/common/dmerror
> > +++ b/common/dmerror
> > @@ -15,6 +15,9 @@ _dmerror_setup()
> >  	export DMLINEAR_TABLE="0 $blk_dev_size linear $dm_backing_dev 0"
> >  
> >  	export DMERROR_TABLE="0 $blk_dev_size error $dm_backing_dev 0"
> > +
> > +	# dm-error cannot handle zone information
> > +	_require_non_zoned_device "${dm_backing_dev}"
> 
> We should really do the check in _require rules not in _setup()
> functions. Please see below.
> 
> >  }
> >  
> >  _dmerror_init()
> > diff --git a/common/dmhugedisk b/common/dmhugedisk
> > index 502f0243772d..715f95efde29 100644
> > --- a/common/dmhugedisk
> > +++ b/common/dmhugedisk
> > @@ -16,6 +16,9 @@ _dmhugedisk_init()
> >  	local dm_backing_dev=$SCRATCH_DEV
> >  	local chunk_size="$2"
> >  
> > +	# We cannot ensure sequential writes on the backing device
> > +	_require_non_zoned_device $dm_backing_dev
> > +
> >  	if [ -z "$chunk_size" ]; then
> >  		chunk_size=512
> >  	fi
> > diff --git a/common/rc b/common/rc
> > index 7b80820ff680..03b7e0310a84 100644
> > --- a/common/rc
> > +++ b/common/rc
> > @@ -1837,6 +1837,9 @@ _require_loop()
> >      else
> >  	_notrun "This test requires loopback device support"
> >      fi
> > +
> > +    # loop device does not handle zone information
> > +    _require_non_zoned_device ${TEST_DEV}
> >  }
> >  
> >  # this test requires kernel support for a secondary filesystem
> > @@ -1966,6 +1969,10 @@ _require_dm_target()
> >  	if [ $? -ne 0 ]; then
> >  		_notrun "This test requires dm $target support"
> >  	fi
> > +
> > +	if [ $target = thin-pool ]; then
> > +		_require_non_zoned_device ${SCRATCH_DEV}
> > +	fi
> 
> I think we could move all check here, based on $target, e.g.
> 
> 	case $target in
> 	thin-pool|error|snapshot)
> 		_require_non_zoned_device ${SCRATCH_DEV}
> 		;;
> 	esac

I see. It looks far better. I'll do so.

> Thanks,
> Eryu
> 
> >  }
> >  
> >  _zone_type()
> > -- 
> > 2.32.0
diff mbox series

Patch

diff --git a/common/dmerror b/common/dmerror
index 01a4c8b5e52d..64ee78d85b95 100644
--- a/common/dmerror
+++ b/common/dmerror
@@ -15,6 +15,9 @@  _dmerror_setup()
 	export DMLINEAR_TABLE="0 $blk_dev_size linear $dm_backing_dev 0"
 
 	export DMERROR_TABLE="0 $blk_dev_size error $dm_backing_dev 0"
+
+	# dm-error cannot handle zone information
+	_require_non_zoned_device "${dm_backing_dev}"
 }
 
 _dmerror_init()
diff --git a/common/dmhugedisk b/common/dmhugedisk
index 502f0243772d..715f95efde29 100644
--- a/common/dmhugedisk
+++ b/common/dmhugedisk
@@ -16,6 +16,9 @@  _dmhugedisk_init()
 	local dm_backing_dev=$SCRATCH_DEV
 	local chunk_size="$2"
 
+	# We cannot ensure sequential writes on the backing device
+	_require_non_zoned_device $dm_backing_dev
+
 	if [ -z "$chunk_size" ]; then
 		chunk_size=512
 	fi
diff --git a/common/rc b/common/rc
index 7b80820ff680..03b7e0310a84 100644
--- a/common/rc
+++ b/common/rc
@@ -1837,6 +1837,9 @@  _require_loop()
     else
 	_notrun "This test requires loopback device support"
     fi
+
+    # loop device does not handle zone information
+    _require_non_zoned_device ${TEST_DEV}
 }
 
 # this test requires kernel support for a secondary filesystem
@@ -1966,6 +1969,10 @@  _require_dm_target()
 	if [ $? -ne 0 ]; then
 		_notrun "This test requires dm $target support"
 	fi
+
+	if [ $target = thin-pool ]; then
+		_require_non_zoned_device ${SCRATCH_DEV}
+	fi
 }
 
 _zone_type()