All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] common/rc: Introduce new helpers for DAX mount options and FS_XFLAG_DAX
@ 2020-06-03 14:01 Xiao Yang
  2020-06-03 14:01 ` [PATCH 2/4] fstests: Use _require_scratch_dax_mountopt() and _require_scratch_daX_iflag() Xiao Yang
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Xiao Yang @ 2020-06-03 14:01 UTC (permalink / raw)
  To: fstests; +Cc: darrick.wong, ira.weiny, Xiao Yang

1) _require_scratch_dax_mountopt() checks both old and new DAX mount option
2) _require_scratch_daX_iflag() checks FS_XFLAG_DAX

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
---
 common/rc | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/common/rc b/common/rc
index a6967831..ec7c19e4 100644
--- a/common/rc
+++ b/common/rc
@@ -3188,6 +3188,41 @@ _require_scratch_dax()
 	_scratch_unmount
 }
 
+_require_scratch_dax_mountopt()
+{
+	local mountopt=$1
+	local output
+
+	_require_scratch
+	_scratch_mkfs > /dev/null 2>&1
+	_try_scratch_mount -o "$mountopt" || \
+		_notrun "mount $SCRATCH_DEV with $mountopt failed"
+
+	output=$(_fs_options $SCRATCH_DEV)
+
+	# For new dax mount option, /proc/mounts shows different outputs if we
+	# mount with -o dax=inode on ext4 and xfs so skip checking it.
+	# /proc/mounts shows 'dax=inode' on ext4 but shows nothing on xfs.
+	if [ "$mountopt" != "dax=inode" ]; then
+		echo $output | grep -qw "$mountopt" || \
+			_notrun "$SCRATCH_DEV $FSTYP does not support -o $mountopt"
+	fi
+
+	# For new dax mount option, /proc/mounts shows "dax=never" if we
+	# mount with -o dax on xfs and underlying device doesn't support dax.
+	if [ "$mountopt" = "dax" ]; then
+		echo $output | grep -qw "dax=never" && \
+			_notrun "$SCRATCH_DEV $FSTYP does not support -o $mountopt"
+	fi
+
+	_scratch_unmount
+}
+
+_require_scratch_dax_iflag()
+{
+	_require_xfs_io_command "chattr" "x"
+}
+
 # Does norecovery support by this fs?
 _require_norecovery()
 {
-- 
2.21.0




^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 2/4] fstests: Use _require_scratch_dax_mountopt() and _require_scratch_daX_iflag()
  2020-06-03 14:01 [PATCH 1/4] common/rc: Introduce new helpers for DAX mount options and FS_XFLAG_DAX Xiao Yang
@ 2020-06-03 14:01 ` Xiao Yang
  2020-06-03 14:01 ` [PATCH 3/4] common/rc: Remove unused _require_scratch_dax() Xiao Yang
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 13+ messages in thread
From: Xiao Yang @ 2020-06-03 14:01 UTC (permalink / raw)
  To: fstests; +Cc: darrick.wong, ira.weiny, Xiao Yang

Make related tests use _require_scratch_dax_mountopt() and _require_scratch_daX_iflag()

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
---
 tests/ext4/030    | 2 +-
 tests/ext4/031    | 4 ++--
 tests/generic/413 | 2 +-
 tests/generic/462 | 2 +-
 tests/xfs/260     | 4 ++--
 5 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/tests/ext4/030 b/tests/ext4/030
index 93bbca86..fb5cf451 100755
--- a/tests/ext4/030
+++ b/tests/ext4/030
@@ -33,7 +33,7 @@ rm -f $seqres.full
 # Modify as appropriate.
 _supported_os Linux
 _supported_fs ext4
-_require_scratch_dax
+_require_scratch_dax_mountopt "dax"
 _require_test_program "t_ext4_dax_journal_corruption"
 _require_command "$CHATTR_PROG" chattr
 
diff --git a/tests/ext4/031 b/tests/ext4/031
index dc58214e..20e2fab7 100755
--- a/tests/ext4/031
+++ b/tests/ext4/031
@@ -37,7 +37,7 @@ MOUNT_OPTIONS=""
 # Modify as appropriate.
 _supported_os Linux
 _supported_fs ext4
-_require_scratch_dax
+_require_scratch_dax_mountopt "dax"
 _require_test_program "t_ext4_dax_inline_corruption"
 _require_scratch_ext4_feature "inline_data"
 
@@ -56,7 +56,7 @@ _scratch_unmount >> $seqres.full 2>&1
 _try_scratch_mount "-o dax" >> $seqres.full 2>&1
 
 if [[ $? != 0 ]]; then
-	# _require_scratch_dax already verified that we could mount with DAX.
+	# _require_scratch_dax_mountopt already verified that we could mount with DAX.
 	# Failure here is expected because we have inline data.
 	echo "Silence is golden"
 	status=0
diff --git a/tests/generic/413 b/tests/generic/413
index 1ce89aff..19e1b926 100755
--- a/tests/generic/413
+++ b/tests/generic/413
@@ -31,7 +31,7 @@ rm -f $seqres.full
 _supported_fs generic
 _supported_os Linux
 _require_test
-_require_scratch_dax
+_require_scratch_dax_mountopt "dax"
 _require_test_program "feature"
 _require_test_program "t_mmap_dio"
 _require_xfs_io_command "falloc"
diff --git a/tests/generic/462 b/tests/generic/462
index 1ab6cadc..4a940239 100755
--- a/tests/generic/462
+++ b/tests/generic/462
@@ -37,7 +37,7 @@ rm -f $seqres.full
 _supported_fs generic
 _supported_os Linux
 _require_test
-_require_scratch_dax
+_require_scratch_dax_mountopt "dax"
 _require_test_program "t_mmap_write_ro"
 # running by unpriviliged user is not necessary to reproduce
 # this bug, just trying to test more.
diff --git a/tests/xfs/260 b/tests/xfs/260
index 3464ffef..fbdc4cd8 100755
--- a/tests/xfs/260
+++ b/tests/xfs/260
@@ -30,10 +30,10 @@ rm -f $seqres.full
 
 _supported_fs xfs
 _supported_os Linux
-_require_scratch_dax
+_require_scratch_dax_mountopt "dax"
 _require_test_program "feature"
 _require_test_program "t_mmap_dio"
-_require_xfs_io_command "chattr" "x"
+_require_scratch_dax_iflag
 _require_xfs_io_command "falloc"
 
 prep_files()
-- 
2.21.0




^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 3/4] common/rc: Remove unused _require_scratch_dax()
  2020-06-03 14:01 [PATCH 1/4] common/rc: Introduce new helpers for DAX mount options and FS_XFLAG_DAX Xiao Yang
  2020-06-03 14:01 ` [PATCH 2/4] fstests: Use _require_scratch_dax_mountopt() and _require_scratch_daX_iflag() Xiao Yang
@ 2020-06-03 14:01 ` Xiao Yang
  2020-06-03 14:01 ` [PATCH 4/4] xfs/260: Move xfs/260 to generic Xiao Yang
  2020-06-09 16:39 ` [PATCH 1/4] common/rc: Introduce new helpers for DAX mount options and FS_XFLAG_DAX Darrick J. Wong
  3 siblings, 0 replies; 13+ messages in thread
From: Xiao Yang @ 2020-06-03 14:01 UTC (permalink / raw)
  To: fstests; +Cc: darrick.wong, ira.weiny, Xiao Yang

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
---
 common/rc | 13 -------------
 1 file changed, 13 deletions(-)

diff --git a/common/rc b/common/rc
index ec7c19e4..dba52002 100644
--- a/common/rc
+++ b/common/rc
@@ -3175,19 +3175,6 @@ _require_scratch_shutdown()
 }
 
 # Does dax mount option work on this dev/fs?
-_require_scratch_dax()
-{
-	_require_scratch
-	_scratch_mkfs > /dev/null 2>&1
-	_try_scratch_mount -o dax || \
-		_notrun "mount $SCRATCH_DEV with dax failed"
-	# Check options to be sure. XFS ignores dax option
-	# and goes on if dev underneath does not support dax.
-	_fs_options $SCRATCH_DEV | grep -qw "dax" || \
-		_notrun "$SCRATCH_DEV $FSTYP does not support -o dax"
-	_scratch_unmount
-}
-
 _require_scratch_dax_mountopt()
 {
 	local mountopt=$1
-- 
2.21.0




^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 4/4] xfs/260: Move xfs/260 to generic
  2020-06-03 14:01 [PATCH 1/4] common/rc: Introduce new helpers for DAX mount options and FS_XFLAG_DAX Xiao Yang
  2020-06-03 14:01 ` [PATCH 2/4] fstests: Use _require_scratch_dax_mountopt() and _require_scratch_daX_iflag() Xiao Yang
  2020-06-03 14:01 ` [PATCH 3/4] common/rc: Remove unused _require_scratch_dax() Xiao Yang
@ 2020-06-03 14:01 ` Xiao Yang
  2020-06-09 16:42   ` Darrick J. Wong
  2020-06-09 16:39 ` [PATCH 1/4] common/rc: Introduce new helpers for DAX mount options and FS_XFLAG_DAX Darrick J. Wong
  3 siblings, 1 reply; 13+ messages in thread
From: Xiao Yang @ 2020-06-03 14:01 UTC (permalink / raw)
  To: fstests; +Cc: darrick.wong, ira.weiny, Xiao Yang

Both ext4 and xfs support per-inode DAX flag now so move it to generic.

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
---
 tests/{xfs/260 => generic/602} | 12 ++++++++----
 tests/generic/602.out          |  2 ++
 tests/generic/group            |  1 +
 tests/xfs/260.out              |  2 --
 tests/xfs/group                |  1 -
 5 files changed, 11 insertions(+), 7 deletions(-)
 rename tests/{xfs/260 => generic/602} (91%)
 create mode 100644 tests/generic/602.out
 delete mode 100644 tests/xfs/260.out

diff --git a/tests/xfs/260 b/tests/generic/602
similarity index 91%
rename from tests/xfs/260
rename to tests/generic/602
index fbdc4cd8..0cd20f31 100755
--- a/tests/xfs/260
+++ b/tests/generic/602
@@ -2,7 +2,7 @@
 # SPDX-License-Identifier: GPL-2.0
 # Copyright (c) 2017 Red Hat Inc.  All Rights Reserved.
 #
-# FS QA Test 260
+# FS QA Test 602
 #
 # Test per-inode DAX flag by mmap direct/buffered IO.
 #
@@ -28,7 +28,7 @@ _cleanup()
 # remove previous $seqres.full before test
 rm -f $seqres.full
 
-_supported_fs xfs
+_supported_fs generic
 _supported_os Linux
 _require_scratch_dax_mountopt "dax"
 _require_test_program "feature"
@@ -121,8 +121,12 @@ do_tests()
 	t_dax_flag_mmap_dio $((64 * 1024 * 1024))
 }
 
-# make xfs 2Mb aligned for PMD fault testing
-_scratch_mkfs "-d su=2m,sw=1" > /dev/null 2>&1
+# make 2Mb aligned for PMD fault testing
+mkfs_opts=""
+[ "$FSTYP" = "ext4" ] && mkfs_opts="-E stride=512,stripe_width=1"
+[ "$FSTYP" = "xfs" ] && mkfs_opts="-d su=2m,sw=1"
+
+_scratch_mkfs "$mkfs_opts" > /dev/null 2>&1
 
 # mount with dax option
 _scratch_mount "-o dax"
diff --git a/tests/generic/602.out b/tests/generic/602.out
new file mode 100644
index 00000000..61976e5e
--- /dev/null
+++ b/tests/generic/602.out
@@ -0,0 +1,2 @@
+QA output created by 602
+Silence is golden
diff --git a/tests/generic/group b/tests/generic/group
index c6ce029c..4bda3772 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -604,3 +604,4 @@
 599 auto quick remount shutdown
 600 auto quick quota
 601 auto quick quota
+602 auto attr quick dax
diff --git a/tests/xfs/260.out b/tests/xfs/260.out
deleted file mode 100644
index 18ca517c..00000000
--- a/tests/xfs/260.out
+++ /dev/null
@@ -1,2 +0,0 @@
-QA output created by 260
-Silence is golden
diff --git a/tests/xfs/group b/tests/xfs/group
index daf54add..71c30898 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -257,7 +257,6 @@
 257 auto quick clone
 258 auto quick clone
 259 auto quick
-260 auto attr quick dax
 261 auto quick quota
 262 dangerous_fuzzers dangerous_scrub dangerous_online_repair
 263 auto quick quota
-- 
2.21.0




^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/4] common/rc: Introduce new helpers for DAX mount options and FS_XFLAG_DAX
  2020-06-03 14:01 [PATCH 1/4] common/rc: Introduce new helpers for DAX mount options and FS_XFLAG_DAX Xiao Yang
                   ` (2 preceding siblings ...)
  2020-06-03 14:01 ` [PATCH 4/4] xfs/260: Move xfs/260 to generic Xiao Yang
@ 2020-06-09 16:39 ` Darrick J. Wong
  2020-06-10  2:01   ` Xiao Yang
  3 siblings, 1 reply; 13+ messages in thread
From: Darrick J. Wong @ 2020-06-09 16:39 UTC (permalink / raw)
  To: Xiao Yang; +Cc: fstests, ira.weiny

Oh, this wasn't the cover letter. ;)

On Wed, Jun 03, 2020 at 10:01:12PM +0800, Xiao Yang wrote:
> 1) _require_scratch_dax_mountopt() checks both old and new DAX mount option
> 2) _require_scratch_daX_iflag() checks FS_XFLAG_DAX
> 
> Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
> ---
>  common/rc | 35 +++++++++++++++++++++++++++++++++++
>  1 file changed, 35 insertions(+)
> 
> diff --git a/common/rc b/common/rc
> index a6967831..ec7c19e4 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -3188,6 +3188,41 @@ _require_scratch_dax()
>  	_scratch_unmount
>  }
>  
> +_require_scratch_dax_mountopt()
> +{
> +	local mountopt=$1
> +	local output
> +
> +	_require_scratch
> +	_scratch_mkfs > /dev/null 2>&1
> +	_try_scratch_mount -o "$mountopt" || \
> +		_notrun "mount $SCRATCH_DEV with $mountopt failed"

What happens if MOUNT_OPTS already contains a dax option?  Should we
clear it out ala _qmount_option, on the assumption that a test that
cares about specific options probably wants to override whatever the
test runner passed in?

--D

> +
> +	output=$(_fs_options $SCRATCH_DEV)
> +
> +	# For new dax mount option, /proc/mounts shows different outputs if we
> +	# mount with -o dax=inode on ext4 and xfs so skip checking it.
> +	# /proc/mounts shows 'dax=inode' on ext4 but shows nothing on xfs.
> +	if [ "$mountopt" != "dax=inode" ]; then
> +		echo $output | grep -qw "$mountopt" || \
> +			_notrun "$SCRATCH_DEV $FSTYP does not support -o $mountopt"
> +	fi
> +
> +	# For new dax mount option, /proc/mounts shows "dax=never" if we
> +	# mount with -o dax on xfs and underlying device doesn't support dax.
> +	if [ "$mountopt" = "dax" ]; then
> +		echo $output | grep -qw "dax=never" && \
> +			_notrun "$SCRATCH_DEV $FSTYP does not support -o $mountopt"
> +	fi
> +
> +	_scratch_unmount
> +}
> +
> +_require_scratch_dax_iflag()
> +{
> +	_require_xfs_io_command "chattr" "x"
> +}
> +
>  # Does norecovery support by this fs?
>  _require_norecovery()
>  {
> -- 
> 2.21.0
> 
> 
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 4/4] xfs/260: Move xfs/260 to generic
  2020-06-03 14:01 ` [PATCH 4/4] xfs/260: Move xfs/260 to generic Xiao Yang
@ 2020-06-09 16:42   ` Darrick J. Wong
  2020-06-10  6:16     ` Xiao Yang
  0 siblings, 1 reply; 13+ messages in thread
From: Darrick J. Wong @ 2020-06-09 16:42 UTC (permalink / raw)
  To: Xiao Yang; +Cc: fstests, ira.weiny

On Wed, Jun 03, 2020 at 10:01:15PM +0800, Xiao Yang wrote:
> Both ext4 and xfs support per-inode DAX flag now so move it to generic.
> 
> Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
> ---
>  tests/{xfs/260 => generic/602} | 12 ++++++++----
>  tests/generic/602.out          |  2 ++
>  tests/generic/group            |  1 +
>  tests/xfs/260.out              |  2 --
>  tests/xfs/group                |  1 -
>  5 files changed, 11 insertions(+), 7 deletions(-)
>  rename tests/{xfs/260 => generic/602} (91%)
>  create mode 100644 tests/generic/602.out
>  delete mode 100644 tests/xfs/260.out
> 
> diff --git a/tests/xfs/260 b/tests/generic/602
> similarity index 91%
> rename from tests/xfs/260
> rename to tests/generic/602
> index fbdc4cd8..0cd20f31 100755
> --- a/tests/xfs/260
> +++ b/tests/generic/602
> @@ -2,7 +2,7 @@
>  # SPDX-License-Identifier: GPL-2.0
>  # Copyright (c) 2017 Red Hat Inc.  All Rights Reserved.
>  #
> -# FS QA Test 260
> +# FS QA Test 602
>  #
>  # Test per-inode DAX flag by mmap direct/buffered IO.
>  #
> @@ -28,7 +28,7 @@ _cleanup()
>  # remove previous $seqres.full before test
>  rm -f $seqres.full
>  
> -_supported_fs xfs
> +_supported_fs generic
>  _supported_os Linux
>  _require_scratch_dax_mountopt "dax"
>  _require_test_program "feature"
> @@ -121,8 +121,12 @@ do_tests()
>  	t_dax_flag_mmap_dio $((64 * 1024 * 1024))
>  }
>  
> -# make xfs 2Mb aligned for PMD fault testing
> -_scratch_mkfs "-d su=2m,sw=1" > /dev/null 2>&1
> +# make 2Mb aligned for PMD fault testing
> +mkfs_opts=""
> +[ "$FSTYP" = "ext4" ] && mkfs_opts="-E stride=512,stripe_width=1"
> +[ "$FSTYP" = "xfs" ] && mkfs_opts="-d su=2m,sw=1"

/me wonders if this ought to be smart enough to sniff out the hugepage
size on the test machine...

--D

> +
> +_scratch_mkfs "$mkfs_opts" > /dev/null 2>&1
>  
>  # mount with dax option
>  _scratch_mount "-o dax"
> diff --git a/tests/generic/602.out b/tests/generic/602.out
> new file mode 100644
> index 00000000..61976e5e
> --- /dev/null
> +++ b/tests/generic/602.out
> @@ -0,0 +1,2 @@
> +QA output created by 602
> +Silence is golden
> diff --git a/tests/generic/group b/tests/generic/group
> index c6ce029c..4bda3772 100644
> --- a/tests/generic/group
> +++ b/tests/generic/group
> @@ -604,3 +604,4 @@
>  599 auto quick remount shutdown
>  600 auto quick quota
>  601 auto quick quota
> +602 auto attr quick dax
> diff --git a/tests/xfs/260.out b/tests/xfs/260.out
> deleted file mode 100644
> index 18ca517c..00000000
> --- a/tests/xfs/260.out
> +++ /dev/null
> @@ -1,2 +0,0 @@
> -QA output created by 260
> -Silence is golden
> diff --git a/tests/xfs/group b/tests/xfs/group
> index daf54add..71c30898 100644
> --- a/tests/xfs/group
> +++ b/tests/xfs/group
> @@ -257,7 +257,6 @@
>  257 auto quick clone
>  258 auto quick clone
>  259 auto quick
> -260 auto attr quick dax
>  261 auto quick quota
>  262 dangerous_fuzzers dangerous_scrub dangerous_online_repair
>  263 auto quick quota
> -- 
> 2.21.0
> 
> 
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/4] common/rc: Introduce new helpers for DAX mount options and FS_XFLAG_DAX
  2020-06-09 16:39 ` [PATCH 1/4] common/rc: Introduce new helpers for DAX mount options and FS_XFLAG_DAX Darrick J. Wong
@ 2020-06-10  2:01   ` Xiao Yang
  2020-06-10 16:37     ` Darrick J. Wong
  0 siblings, 1 reply; 13+ messages in thread
From: Xiao Yang @ 2020-06-10  2:01 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: fstests, ira.weiny

Hi Darrick,

Thanks a lot for your comments.

On 2020/6/10 0:39, Darrick J. Wong wrote:
> Oh, this wasn't the cover letter. ;)

I will add the cover letter.

>
> On Wed, Jun 03, 2020 at 10:01:12PM +0800, Xiao Yang wrote:
>> 1) _require_scratch_dax_mountopt() checks both old and new DAX mount option
>> 2) _require_scratch_daX_iflag() checks FS_XFLAG_DAX
>>
>> Signed-off-by: Xiao Yang<yangx.jy@cn.fujitsu.com>
>> ---
>>   common/rc | 35 +++++++++++++++++++++++++++++++++++
>>   1 file changed, 35 insertions(+)
>>
>> diff --git a/common/rc b/common/rc
>> index a6967831..ec7c19e4 100644
>> --- a/common/rc
>> +++ b/common/rc
>> @@ -3188,6 +3188,41 @@ _require_scratch_dax()
>>   	_scratch_unmount
>>   }
>>
>> +_require_scratch_dax_mountopt()
>> +{
>> +	local mountopt=$1
>> +	local output
>> +
>> +	_require_scratch
>> +	_scratch_mkfs>  /dev/null 2>&1
>> +	_try_scratch_mount -o "$mountopt" || \
>> +		_notrun "mount $SCRATCH_DEV with $mountopt failed"
>
> What happens if MOUNT_OPTS already contains a dax option?  Should we
> clear it out ala _qmount_option, on the assumption that a test that
> cares about specific options probably wants to override whatever the
> test runner passed in?

Good point, but it seems that the last dax option is actually used if we 
mount with multiple dax options, as below:
----------------------------------------------
ext4:
# blkid /dev/pmem1
/dev/pmem1: UUID="cd2eb9f0-af2a-4c89-a381-4d2d9d2e8054" TYPE="ext4"
# mount -o dax -odax=inode /dev/pmem1 /mnt/xfstests/scratch/
# mount | grep pmem1
/dev/pmem1 on /mnt/xfstests/scratch type ext4 
(rw,relatime,seclabel,dax=inode)

# mount -o dax=never -odax=inode -odax=always /dev/pmem1 
/mnt/xfstests/scratch/
# mount | grep pmem1
/dev/pmem1 on /mnt/xfstests/scratch type ext4 
(rw,relatime,seclabel,dax=always)

# mount -o dax=never -odax /dev/pmem1 /mnt/xfstests/scratch/
# mount | grep pmem1
/dev/pmem1 on /mnt/xfstests/scratch type ext4 
(rw,relatime,seclabel,dax=always)


xfs:
# blkid /dev/pmem0
/dev/pmem0: UUID="bc830790-1ea8-48fb-9cda-7d5bb96b8961" TYPE="xfs"
# mount -o dax=never -o dax=always /dev/pmem0 /mnt/xfstests/test/
# mount | grep pmem0
/dev/pmem0 on /mnt/xfstests/test type xfs 
(rw,relatime,seclabel,attr2,dax=always,inode64,logbufs=8,logbsize=32k,noquota)

# mount -o dax=never -o dax=inode /dev/pmem0 /mnt/xfstests/test/
# mount | grep pmem0
/dev/pmem0 on /mnt/xfstests/test type xfs 
(rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noquota)

# mount -o dax=always -o dax=inode -o dax=never /dev/pmem0 
/mnt/xfstests/test/
# mount | grep pmem0
/dev/pmem0 on /mnt/xfstests/test type xfs 
(rw,relatime,seclabel,attr2,dax=never,inode64,logbufs=8,logbsize=32k,noquota)
----------------------------------------------
all dax options are exclusive, so do you think is it necessary to 
implement a function as _qmount_option?

Best Regards,
Xiao Yang
>
> --D
>
>> +
>> +	output=$(_fs_options $SCRATCH_DEV)
>> +
>> +	# For new dax mount option, /proc/mounts shows different outputs if we
>> +	# mount with -o dax=inode on ext4 and xfs so skip checking it.
>> +	# /proc/mounts shows 'dax=inode' on ext4 but shows nothing on xfs.
>> +	if [ "$mountopt" != "dax=inode" ]; then
>> +		echo $output | grep -qw "$mountopt" || \
>> +			_notrun "$SCRATCH_DEV $FSTYP does not support -o $mountopt"
>> +	fi
>> +
>> +	# For new dax mount option, /proc/mounts shows "dax=never" if we
>> +	# mount with -o dax on xfs and underlying device doesn't support dax.
>> +	if [ "$mountopt" = "dax" ]; then
>> +		echo $output | grep -qw "dax=never"&&  \
>> +			_notrun "$SCRATCH_DEV $FSTYP does not support -o $mountopt"
>> +	fi
>> +
>> +	_scratch_unmount
>> +}
>> +
>> +_require_scratch_dax_iflag()
>> +{
>> +	_require_xfs_io_command "chattr" "x"
>> +}
>> +
>>   # Does norecovery support by this fs?
>>   _require_norecovery()
>>   {
>> --
>> 2.21.0
>>
>>
>>
>
>
> .
>




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 4/4] xfs/260: Move xfs/260 to generic
  2020-06-09 16:42   ` Darrick J. Wong
@ 2020-06-10  6:16     ` Xiao Yang
  2020-06-10 15:59       ` Darrick J. Wong
  0 siblings, 1 reply; 13+ messages in thread
From: Xiao Yang @ 2020-06-10  6:16 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: fstests, ira.weiny

On 2020/6/10 0:42, Darrick J. Wong wrote:
> On Wed, Jun 03, 2020 at 10:01:15PM +0800, Xiao Yang wrote:
>> Both ext4 and xfs support per-inode DAX flag now so move it to generic.
>>
>> Signed-off-by: Xiao Yang<yangx.jy@cn.fujitsu.com>
>> ---
>>   tests/{xfs/260 =>  generic/602} | 12 ++++++++----
>>   tests/generic/602.out          |  2 ++
>>   tests/generic/group            |  1 +
>>   tests/xfs/260.out              |  2 --
>>   tests/xfs/group                |  1 -
>>   5 files changed, 11 insertions(+), 7 deletions(-)
>>   rename tests/{xfs/260 =>  generic/602} (91%)
>>   create mode 100644 tests/generic/602.out
>>   delete mode 100644 tests/xfs/260.out
>>
>> diff --git a/tests/xfs/260 b/tests/generic/602
>> similarity index 91%
>> rename from tests/xfs/260
>> rename to tests/generic/602
>> index fbdc4cd8..0cd20f31 100755
>> --- a/tests/xfs/260
>> +++ b/tests/generic/602
>> @@ -2,7 +2,7 @@
>>   # SPDX-License-Identifier: GPL-2.0
>>   # Copyright (c) 2017 Red Hat Inc.  All Rights Reserved.
>>   #
>> -# FS QA Test 260
>> +# FS QA Test 602
>>   #
>>   # Test per-inode DAX flag by mmap direct/buffered IO.
>>   #
>> @@ -28,7 +28,7 @@ _cleanup()
>>   # remove previous $seqres.full before test
>>   rm -f $seqres.full
>>
>> -_supported_fs xfs
>> +_supported_fs generic
>>   _supported_os Linux
>>   _require_scratch_dax_mountopt "dax"
>>   _require_test_program "feature"
>> @@ -121,8 +121,12 @@ do_tests()
>>   	t_dax_flag_mmap_dio $((64 * 1024 * 1024))
>>   }
>>
>> -# make xfs 2Mb aligned for PMD fault testing
>> -_scratch_mkfs "-d su=2m,sw=1">  /dev/null 2>&1
>> +# make 2Mb aligned for PMD fault testing
>> +mkfs_opts=""
>> +[ "$FSTYP" = "ext4" ]&&  mkfs_opts="-E stride=512,stripe_width=1"
>> +[ "$FSTYP" = "xfs" ]&&  mkfs_opts="-d su=2m,sw=1"
>
> /me wonders if this ought to be smart enough to sniff out the hugepage
> size on the test machine...
Hi Darrick,

PMD page is always 2M, I am not sure why we need to sniff out the 
hugepage size?  Could you give me an example?

Best Regards,
Xiao Yang
>
> --D
>
>> +
>> +_scratch_mkfs "$mkfs_opts">  /dev/null 2>&1
>>
>>   # mount with dax option
>>   _scratch_mount "-o dax"
>> diff --git a/tests/generic/602.out b/tests/generic/602.out
>> new file mode 100644
>> index 00000000..61976e5e
>> --- /dev/null
>> +++ b/tests/generic/602.out
>> @@ -0,0 +1,2 @@
>> +QA output created by 602
>> +Silence is golden
>> diff --git a/tests/generic/group b/tests/generic/group
>> index c6ce029c..4bda3772 100644
>> --- a/tests/generic/group
>> +++ b/tests/generic/group
>> @@ -604,3 +604,4 @@
>>   599 auto quick remount shutdown
>>   600 auto quick quota
>>   601 auto quick quota
>> +602 auto attr quick dax
>> diff --git a/tests/xfs/260.out b/tests/xfs/260.out
>> deleted file mode 100644
>> index 18ca517c..00000000
>> --- a/tests/xfs/260.out
>> +++ /dev/null
>> @@ -1,2 +0,0 @@
>> -QA output created by 260
>> -Silence is golden
>> diff --git a/tests/xfs/group b/tests/xfs/group
>> index daf54add..71c30898 100644
>> --- a/tests/xfs/group
>> +++ b/tests/xfs/group
>> @@ -257,7 +257,6 @@
>>   257 auto quick clone
>>   258 auto quick clone
>>   259 auto quick
>> -260 auto attr quick dax
>>   261 auto quick quota
>>   262 dangerous_fuzzers dangerous_scrub dangerous_online_repair
>>   263 auto quick quota
>> --
>> 2.21.0
>>
>>
>>
>
>
> .
>




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 4/4] xfs/260: Move xfs/260 to generic
  2020-06-10  6:16     ` Xiao Yang
@ 2020-06-10 15:59       ` Darrick J. Wong
  2020-06-11  8:33         ` Xiao Yang
  2020-06-11  9:13         ` Xiao Yang
  0 siblings, 2 replies; 13+ messages in thread
From: Darrick J. Wong @ 2020-06-10 15:59 UTC (permalink / raw)
  To: Xiao Yang; +Cc: fstests, ira.weiny

On Wed, Jun 10, 2020 at 02:16:45PM +0800, Xiao Yang wrote:
> On 2020/6/10 0:42, Darrick J. Wong wrote:
> > On Wed, Jun 03, 2020 at 10:01:15PM +0800, Xiao Yang wrote:
> > > Both ext4 and xfs support per-inode DAX flag now so move it to generic.
> > > 
> > > Signed-off-by: Xiao Yang<yangx.jy@cn.fujitsu.com>
> > > ---
> > >   tests/{xfs/260 =>  generic/602} | 12 ++++++++----
> > >   tests/generic/602.out          |  2 ++
> > >   tests/generic/group            |  1 +
> > >   tests/xfs/260.out              |  2 --
> > >   tests/xfs/group                |  1 -
> > >   5 files changed, 11 insertions(+), 7 deletions(-)
> > >   rename tests/{xfs/260 =>  generic/602} (91%)
> > >   create mode 100644 tests/generic/602.out
> > >   delete mode 100644 tests/xfs/260.out
> > > 
> > > diff --git a/tests/xfs/260 b/tests/generic/602
> > > similarity index 91%
> > > rename from tests/xfs/260
> > > rename to tests/generic/602
> > > index fbdc4cd8..0cd20f31 100755
> > > --- a/tests/xfs/260
> > > +++ b/tests/generic/602
> > > @@ -2,7 +2,7 @@
> > >   # SPDX-License-Identifier: GPL-2.0
> > >   # Copyright (c) 2017 Red Hat Inc.  All Rights Reserved.
> > >   #
> > > -# FS QA Test 260
> > > +# FS QA Test 602
> > >   #
> > >   # Test per-inode DAX flag by mmap direct/buffered IO.
> > >   #
> > > @@ -28,7 +28,7 @@ _cleanup()
> > >   # remove previous $seqres.full before test
> > >   rm -f $seqres.full
> > > 
> > > -_supported_fs xfs
> > > +_supported_fs generic
> > >   _supported_os Linux
> > >   _require_scratch_dax_mountopt "dax"
> > >   _require_test_program "feature"
> > > @@ -121,8 +121,12 @@ do_tests()
> > >   	t_dax_flag_mmap_dio $((64 * 1024 * 1024))
> > >   }
> > > 
> > > -# make xfs 2Mb aligned for PMD fault testing
> > > -_scratch_mkfs "-d su=2m,sw=1">  /dev/null 2>&1
> > > +# make 2Mb aligned for PMD fault testing
> > > +mkfs_opts=""
> > > +[ "$FSTYP" = "ext4" ]&&  mkfs_opts="-E stride=512,stripe_width=1"
> > > +[ "$FSTYP" = "xfs" ]&&  mkfs_opts="-d su=2m,sw=1"
> > 
> > /me wonders if this ought to be smart enough to sniff out the hugepage
> > size on the test machine...
> Hi Darrick,
> 
> PMD page is always 2M, I am not sure why we need to sniff out the hugepage
> size?  Could you give me an example?

arm64, which can have 512M hugepages.
ppc64, which can have 16M huge pages (I think?)

--D

> Best Regards,
> Xiao Yang
> > 
> > --D
> > 
> > > +
> > > +_scratch_mkfs "$mkfs_opts">  /dev/null 2>&1
> > > 
> > >   # mount with dax option
> > >   _scratch_mount "-o dax"
> > > diff --git a/tests/generic/602.out b/tests/generic/602.out
> > > new file mode 100644
> > > index 00000000..61976e5e
> > > --- /dev/null
> > > +++ b/tests/generic/602.out
> > > @@ -0,0 +1,2 @@
> > > +QA output created by 602
> > > +Silence is golden
> > > diff --git a/tests/generic/group b/tests/generic/group
> > > index c6ce029c..4bda3772 100644
> > > --- a/tests/generic/group
> > > +++ b/tests/generic/group
> > > @@ -604,3 +604,4 @@
> > >   599 auto quick remount shutdown
> > >   600 auto quick quota
> > >   601 auto quick quota
> > > +602 auto attr quick dax
> > > diff --git a/tests/xfs/260.out b/tests/xfs/260.out
> > > deleted file mode 100644
> > > index 18ca517c..00000000
> > > --- a/tests/xfs/260.out
> > > +++ /dev/null
> > > @@ -1,2 +0,0 @@
> > > -QA output created by 260
> > > -Silence is golden
> > > diff --git a/tests/xfs/group b/tests/xfs/group
> > > index daf54add..71c30898 100644
> > > --- a/tests/xfs/group
> > > +++ b/tests/xfs/group
> > > @@ -257,7 +257,6 @@
> > >   257 auto quick clone
> > >   258 auto quick clone
> > >   259 auto quick
> > > -260 auto attr quick dax
> > >   261 auto quick quota
> > >   262 dangerous_fuzzers dangerous_scrub dangerous_online_repair
> > >   263 auto quick quota
> > > --
> > > 2.21.0
> > > 
> > > 
> > > 
> > 
> > 
> > .
> > 
> 
> 
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/4] common/rc: Introduce new helpers for DAX mount options and FS_XFLAG_DAX
  2020-06-10  2:01   ` Xiao Yang
@ 2020-06-10 16:37     ` Darrick J. Wong
  0 siblings, 0 replies; 13+ messages in thread
From: Darrick J. Wong @ 2020-06-10 16:37 UTC (permalink / raw)
  To: Xiao Yang; +Cc: fstests, ira.weiny

On Wed, Jun 10, 2020 at 10:01:58AM +0800, Xiao Yang wrote:
> Hi Darrick,
> 
> Thanks a lot for your comments.
> 
> On 2020/6/10 0:39, Darrick J. Wong wrote:
> > Oh, this wasn't the cover letter. ;)
> 
> I will add the cover letter.
> 
> > 
> > On Wed, Jun 03, 2020 at 10:01:12PM +0800, Xiao Yang wrote:
> > > 1) _require_scratch_dax_mountopt() checks both old and new DAX mount option
> > > 2) _require_scratch_daX_iflag() checks FS_XFLAG_DAX
> > > 
> > > Signed-off-by: Xiao Yang<yangx.jy@cn.fujitsu.com>
> > > ---
> > >   common/rc | 35 +++++++++++++++++++++++++++++++++++
> > >   1 file changed, 35 insertions(+)
> > > 
> > > diff --git a/common/rc b/common/rc
> > > index a6967831..ec7c19e4 100644
> > > --- a/common/rc
> > > +++ b/common/rc
> > > @@ -3188,6 +3188,41 @@ _require_scratch_dax()
> > >   	_scratch_unmount
> > >   }
> > > 
> > > +_require_scratch_dax_mountopt()
> > > +{
> > > +	local mountopt=$1
> > > +	local output
> > > +
> > > +	_require_scratch
> > > +	_scratch_mkfs>  /dev/null 2>&1
> > > +	_try_scratch_mount -o "$mountopt" || \
> > > +		_notrun "mount $SCRATCH_DEV with $mountopt failed"
> > 
> > What happens if MOUNT_OPTS already contains a dax option?  Should we
> > clear it out ala _qmount_option, on the assumption that a test that
> > cares about specific options probably wants to override whatever the
> > test runner passed in?
> 
> Good point, but it seems that the last dax option is actually used if we
> mount with multiple dax options, as below:
> ----------------------------------------------
> ext4:
> # blkid /dev/pmem1
> /dev/pmem1: UUID="cd2eb9f0-af2a-4c89-a381-4d2d9d2e8054" TYPE="ext4"
> # mount -o dax -odax=inode /dev/pmem1 /mnt/xfstests/scratch/
> # mount | grep pmem1
> /dev/pmem1 on /mnt/xfstests/scratch type ext4
> (rw,relatime,seclabel,dax=inode)
> 
> # mount -o dax=never -odax=inode -odax=always /dev/pmem1
> /mnt/xfstests/scratch/
> # mount | grep pmem1
> /dev/pmem1 on /mnt/xfstests/scratch type ext4
> (rw,relatime,seclabel,dax=always)
> 
> # mount -o dax=never -odax /dev/pmem1 /mnt/xfstests/scratch/
> # mount | grep pmem1
> /dev/pmem1 on /mnt/xfstests/scratch type ext4
> (rw,relatime,seclabel,dax=always)
> 
> 
> xfs:
> # blkid /dev/pmem0
> /dev/pmem0: UUID="bc830790-1ea8-48fb-9cda-7d5bb96b8961" TYPE="xfs"
> # mount -o dax=never -o dax=always /dev/pmem0 /mnt/xfstests/test/
> # mount | grep pmem0
> /dev/pmem0 on /mnt/xfstests/test type xfs (rw,relatime,seclabel,attr2,dax=always,inode64,logbufs=8,logbsize=32k,noquota)
> 
> # mount -o dax=never -o dax=inode /dev/pmem0 /mnt/xfstests/test/
> # mount | grep pmem0
> /dev/pmem0 on /mnt/xfstests/test type xfs
> (rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noquota)
> 
> # mount -o dax=always -o dax=inode -o dax=never /dev/pmem0
> /mnt/xfstests/test/
> # mount | grep pmem0
> /dev/pmem0 on /mnt/xfstests/test type xfs
> (rw,relatime,seclabel,attr2,dax=never,inode64,logbufs=8,logbsize=32k,noquota)
> ----------------------------------------------
> all dax options are exclusive, so do you think is it necessary to implement
> a function as _qmount_option?

Heh, ok, I guess we don't complain about respecified mount options, so
(at least for fstests) the current behavior is ok.

Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> Best Regards,
> Xiao Yang
> > 
> > --D
> > 
> > > +
> > > +	output=$(_fs_options $SCRATCH_DEV)
> > > +
> > > +	# For new dax mount option, /proc/mounts shows different outputs if we
> > > +	# mount with -o dax=inode on ext4 and xfs so skip checking it.
> > > +	# /proc/mounts shows 'dax=inode' on ext4 but shows nothing on xfs.
> > > +	if [ "$mountopt" != "dax=inode" ]; then
> > > +		echo $output | grep -qw "$mountopt" || \
> > > +			_notrun "$SCRATCH_DEV $FSTYP does not support -o $mountopt"
> > > +	fi
> > > +
> > > +	# For new dax mount option, /proc/mounts shows "dax=never" if we
> > > +	# mount with -o dax on xfs and underlying device doesn't support dax.
> > > +	if [ "$mountopt" = "dax" ]; then
> > > +		echo $output | grep -qw "dax=never"&&  \
> > > +			_notrun "$SCRATCH_DEV $FSTYP does not support -o $mountopt"
> > > +	fi
> > > +
> > > +	_scratch_unmount
> > > +}
> > > +
> > > +_require_scratch_dax_iflag()
> > > +{
> > > +	_require_xfs_io_command "chattr" "x"
> > > +}
> > > +
> > >   # Does norecovery support by this fs?
> > >   _require_norecovery()
> > >   {
> > > --
> > > 2.21.0
> > > 
> > > 
> > > 
> > 
> > 
> > .
> > 
> 
> 
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 4/4] xfs/260: Move xfs/260 to generic
  2020-06-10 15:59       ` Darrick J. Wong
@ 2020-06-11  8:33         ` Xiao Yang
  2020-06-11  9:13         ` Xiao Yang
  1 sibling, 0 replies; 13+ messages in thread
From: Xiao Yang @ 2020-06-11  8:33 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: fstests, ira.weiny

On 2020/6/10 23:59, Darrick J. Wong wrote:
> On Wed, Jun 10, 2020 at 02:16:45PM +0800, Xiao Yang wrote:
>> On 2020/6/10 0:42, Darrick J. Wong wrote:
>>> On Wed, Jun 03, 2020 at 10:01:15PM +0800, Xiao Yang wrote:
>>>> Both ext4 and xfs support per-inode DAX flag now so move it to generic.
>>>>
>>>> Signed-off-by: Xiao Yang<yangx.jy@cn.fujitsu.com>
>>>> ---
>>>>    tests/{xfs/260 =>   generic/602} | 12 ++++++++----
>>>>    tests/generic/602.out          |  2 ++
>>>>    tests/generic/group            |  1 +
>>>>    tests/xfs/260.out              |  2 --
>>>>    tests/xfs/group                |  1 -
>>>>    5 files changed, 11 insertions(+), 7 deletions(-)
>>>>    rename tests/{xfs/260 =>   generic/602} (91%)
>>>>    create mode 100644 tests/generic/602.out
>>>>    delete mode 100644 tests/xfs/260.out
>>>>
>>>> diff --git a/tests/xfs/260 b/tests/generic/602
>>>> similarity index 91%
>>>> rename from tests/xfs/260
>>>> rename to tests/generic/602
>>>> index fbdc4cd8..0cd20f31 100755
>>>> --- a/tests/xfs/260
>>>> +++ b/tests/generic/602
>>>> @@ -2,7 +2,7 @@
>>>>    # SPDX-License-Identifier: GPL-2.0
>>>>    # Copyright (c) 2017 Red Hat Inc.  All Rights Reserved.
>>>>    #
>>>> -# FS QA Test 260
>>>> +# FS QA Test 602
>>>>    #
>>>>    # Test per-inode DAX flag by mmap direct/buffered IO.
>>>>    #
>>>> @@ -28,7 +28,7 @@ _cleanup()
>>>>    # remove previous $seqres.full before test
>>>>    rm -f $seqres.full
>>>>
>>>> -_supported_fs xfs
>>>> +_supported_fs generic
>>>>    _supported_os Linux
>>>>    _require_scratch_dax_mountopt "dax"
>>>>    _require_test_program "feature"
>>>> @@ -121,8 +121,12 @@ do_tests()
>>>>    	t_dax_flag_mmap_dio $((64 * 1024 * 1024))
>>>>    }
>>>>
>>>> -# make xfs 2Mb aligned for PMD fault testing
>>>> -_scratch_mkfs "-d su=2m,sw=1">   /dev/null 2>&1
>>>> +# make 2Mb aligned for PMD fault testing
>>>> +mkfs_opts=""
>>>> +[ "$FSTYP" = "ext4" ]&&   mkfs_opts="-E stride=512,stripe_width=1"
>>>> +[ "$FSTYP" = "xfs" ]&&   mkfs_opts="-d su=2m,sw=1"
>>>
>>> /me wonders if this ought to be smart enough to sniff out the hugepage
>>> size on the test machine...
>> Hi Darrick,
>>
>> PMD page is always 2M, I am not sure why we need to sniff out the hugepage
>> size?  Could you give me an example?
>
> arm64, which can have 512M hugepages.
> ppc64, which can have 16M huge pages (I think?)
Hi Darrick,

Sorry I don't understand what you mean.
I know different arches have different page size/hugepage size but I 
don't know the relationship between PMD page fault and hugepage.

Accodring to dax.txt in kernel, it seems that we have to format block 
device with a fixed block size which is equal to kernel's page size.
mount will fail or disable dax feature if block size is not equal to
kernel's page size, so do you mean this?

Best Regards,
Xiao Yang
>
> --D
>
>> Best Regards,
>> Xiao Yang
>>>
>>> --D
>>>
>>>> +
>>>> +_scratch_mkfs "$mkfs_opts">   /dev/null 2>&1
>>>>
>>>>    # mount with dax option
>>>>    _scratch_mount "-o dax"
>>>> diff --git a/tests/generic/602.out b/tests/generic/602.out
>>>> new file mode 100644
>>>> index 00000000..61976e5e
>>>> --- /dev/null
>>>> +++ b/tests/generic/602.out
>>>> @@ -0,0 +1,2 @@
>>>> +QA output created by 602
>>>> +Silence is golden
>>>> diff --git a/tests/generic/group b/tests/generic/group
>>>> index c6ce029c..4bda3772 100644
>>>> --- a/tests/generic/group
>>>> +++ b/tests/generic/group
>>>> @@ -604,3 +604,4 @@
>>>>    599 auto quick remount shutdown
>>>>    600 auto quick quota
>>>>    601 auto quick quota
>>>> +602 auto attr quick dax
>>>> diff --git a/tests/xfs/260.out b/tests/xfs/260.out
>>>> deleted file mode 100644
>>>> index 18ca517c..00000000
>>>> --- a/tests/xfs/260.out
>>>> +++ /dev/null
>>>> @@ -1,2 +0,0 @@
>>>> -QA output created by 260
>>>> -Silence is golden
>>>> diff --git a/tests/xfs/group b/tests/xfs/group
>>>> index daf54add..71c30898 100644
>>>> --- a/tests/xfs/group
>>>> +++ b/tests/xfs/group
>>>> @@ -257,7 +257,6 @@
>>>>    257 auto quick clone
>>>>    258 auto quick clone
>>>>    259 auto quick
>>>> -260 auto attr quick dax
>>>>    261 auto quick quota
>>>>    262 dangerous_fuzzers dangerous_scrub dangerous_online_repair
>>>>    263 auto quick quota
>>>> --
>>>> 2.21.0
>>>>
>>>>
>>>>
>>>
>>>
>>> .
>>>
>>
>>
>>
>
>
> .
>




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 4/4] xfs/260: Move xfs/260 to generic
  2020-06-10 15:59       ` Darrick J. Wong
  2020-06-11  8:33         ` Xiao Yang
@ 2020-06-11  9:13         ` Xiao Yang
  2020-06-11 14:19           ` Xiao Yang
  1 sibling, 1 reply; 13+ messages in thread
From: Xiao Yang @ 2020-06-11  9:13 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: fstests, ira.weiny

On 2020/6/10 23:59, Darrick J. Wong wrote:
> On Wed, Jun 10, 2020 at 02:16:45PM +0800, Xiao Yang wrote:
>> On 2020/6/10 0:42, Darrick J. Wong wrote:
>>> On Wed, Jun 03, 2020 at 10:01:15PM +0800, Xiao Yang wrote:
>>>> Both ext4 and xfs support per-inode DAX flag now so move it to generic.
>>>>
>>>> Signed-off-by: Xiao Yang<yangx.jy@cn.fujitsu.com>
>>>> ---
>>>>    tests/{xfs/260 =>   generic/602} | 12 ++++++++----
>>>>    tests/generic/602.out          |  2 ++
>>>>    tests/generic/group            |  1 +
>>>>    tests/xfs/260.out              |  2 --
>>>>    tests/xfs/group                |  1 -
>>>>    5 files changed, 11 insertions(+), 7 deletions(-)
>>>>    rename tests/{xfs/260 =>   generic/602} (91%)
>>>>    create mode 100644 tests/generic/602.out
>>>>    delete mode 100644 tests/xfs/260.out
>>>>
>>>> diff --git a/tests/xfs/260 b/tests/generic/602
>>>> similarity index 91%
>>>> rename from tests/xfs/260
>>>> rename to tests/generic/602
>>>> index fbdc4cd8..0cd20f31 100755
>>>> --- a/tests/xfs/260
>>>> +++ b/tests/generic/602
>>>> @@ -2,7 +2,7 @@
>>>>    # SPDX-License-Identifier: GPL-2.0
>>>>    # Copyright (c) 2017 Red Hat Inc.  All Rights Reserved.
>>>>    #
>>>> -# FS QA Test 260
>>>> +# FS QA Test 602
>>>>    #
>>>>    # Test per-inode DAX flag by mmap direct/buffered IO.
>>>>    #
>>>> @@ -28,7 +28,7 @@ _cleanup()
>>>>    # remove previous $seqres.full before test
>>>>    rm -f $seqres.full
>>>>
>>>> -_supported_fs xfs
>>>> +_supported_fs generic
>>>>    _supported_os Linux
>>>>    _require_scratch_dax_mountopt "dax"
>>>>    _require_test_program "feature"
>>>> @@ -121,8 +121,12 @@ do_tests()
>>>>    	t_dax_flag_mmap_dio $((64 * 1024 * 1024))
>>>>    }
>>>>
>>>> -# make xfs 2Mb aligned for PMD fault testing
>>>> -_scratch_mkfs "-d su=2m,sw=1">   /dev/null 2>&1
>>>> +# make 2Mb aligned for PMD fault testing
>>>> +mkfs_opts=""
>>>> +[ "$FSTYP" = "ext4" ]&&   mkfs_opts="-E stride=512,stripe_width=1"
>>>> +[ "$FSTYP" = "xfs" ]&&   mkfs_opts="-d su=2m,sw=1"
>>> /me wonders if this ought to be smart enough to sniff out the hugepage
>>> size on the test machine...
>> Hi Darrick,
>>
>> PMD page is always 2M, I am not sure why we need to sniff out the hugepage
>> size?  Could you give me an example?
> arm64, which can have 512M hugepages.
> ppc64, which can have 16M huge pages (I think?)
Hi Darrick,

After reading kernel xfs code, do you mean that PMD page fault is only 
used by hugepage?
----------------------------------------------------------------
xfs/xfs_file.c:
...
1223 static vm_fault_t
1224 xfs_filemap_fault(
1225         struct vm_fault         *vmf)
1226 {
1227         /* DAX can shortcut the normal fault path on write faults! */
1228         return __xfs_filemap_fault(vmf, PE_SIZE_PTE,
1229                         IS_DAX(file_inode(vmf->vma->vm_file)) &&
1230                         (vmf->flags & FAULT_FLAG_WRITE));
1231 }
1232
1233 static vm_fault_t
1234 xfs_filemap_huge_fault(
1235         struct vm_fault         *vmf,
1236         enum page_entry_size    pe_size)
1237 {
1238         if (!IS_DAX(file_inode(vmf->vma->vm_file)))
1239                 return VM_FAULT_FALLBACK;
1240
1241         /* DAX can shortcut the normal fault path on write faults! */
1242         return __xfs_filemap_fault(vmf, pe_size,
1243                         (vmf->flags & FAULT_FLAG_WRITE));
1244 }
...
----------------------------------------------------------------

Another qeustion: ext4 seems not use PMD page fault,does I miss something?
----------------------------------------------------------------
ext4/file.c:
...
705 static vm_fault_t ext4_dax_fault(struct vm_fault *vmf)
706 {
707         return ext4_dax_huge_fault(vmf, PE_SIZE_PTE);
708 }
709
710 static const struct vm_operations_struct ext4_dax_vm_ops = {
711         .fault          = ext4_dax_fault,
712         .huge_fault     = ext4_dax_huge_fault,
...
----------------------------------------------------------------

Best Regards,
Xiao Yang
> --D
>
>> Best Regards,
>> Xiao Yang
>>> --D
>>>
>>>> +
>>>> +_scratch_mkfs "$mkfs_opts">   /dev/null 2>&1
>>>>
>>>>    # mount with dax option
>>>>    _scratch_mount "-o dax"
>>>> diff --git a/tests/generic/602.out b/tests/generic/602.out
>>>> new file mode 100644
>>>> index 00000000..61976e5e
>>>> --- /dev/null
>>>> +++ b/tests/generic/602.out
>>>> @@ -0,0 +1,2 @@
>>>> +QA output created by 602
>>>> +Silence is golden
>>>> diff --git a/tests/generic/group b/tests/generic/group
>>>> index c6ce029c..4bda3772 100644
>>>> --- a/tests/generic/group
>>>> +++ b/tests/generic/group
>>>> @@ -604,3 +604,4 @@
>>>>    599 auto quick remount shutdown
>>>>    600 auto quick quota
>>>>    601 auto quick quota
>>>> +602 auto attr quick dax
>>>> diff --git a/tests/xfs/260.out b/tests/xfs/260.out
>>>> deleted file mode 100644
>>>> index 18ca517c..00000000
>>>> --- a/tests/xfs/260.out
>>>> +++ /dev/null
>>>> @@ -1,2 +0,0 @@
>>>> -QA output created by 260
>>>> -Silence is golden
>>>> diff --git a/tests/xfs/group b/tests/xfs/group
>>>> index daf54add..71c30898 100644
>>>> --- a/tests/xfs/group
>>>> +++ b/tests/xfs/group
>>>> @@ -257,7 +257,6 @@
>>>>    257 auto quick clone
>>>>    258 auto quick clone
>>>>    259 auto quick
>>>> -260 auto attr quick dax
>>>>    261 auto quick quota
>>>>    262 dangerous_fuzzers dangerous_scrub dangerous_online_repair
>>>>    263 auto quick quota
>>>> --
>>>> 2.21.0
>>>>
>>>>
>>>>
>>>
>>> .
>>>
>>
>>
>
> .
>




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 4/4] xfs/260: Move xfs/260 to generic
  2020-06-11  9:13         ` Xiao Yang
@ 2020-06-11 14:19           ` Xiao Yang
  0 siblings, 0 replies; 13+ messages in thread
From: Xiao Yang @ 2020-06-11 14:19 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: fstests, ira.weiny

On 2020/6/11 17:13, Xiao Yang wrote:
> On 2020/6/10 23:59, Darrick J. Wong wrote:
>> On Wed, Jun 10, 2020 at 02:16:45PM +0800, Xiao Yang wrote:
>>> On 2020/6/10 0:42, Darrick J. Wong wrote:
>>>> On Wed, Jun 03, 2020 at 10:01:15PM +0800, Xiao Yang wrote:
>>>>> Both ext4 and xfs support per-inode DAX flag now so move it to 
>>>>> generic.
>>>>>
>>>>> Signed-off-by: Xiao Yang<yangx.jy@cn.fujitsu.com>
>>>>> ---
>>>>>    tests/{xfs/260 =>   generic/602} | 12 ++++++++----
>>>>>    tests/generic/602.out          |  2 ++
>>>>>    tests/generic/group            |  1 +
>>>>>    tests/xfs/260.out              |  2 --
>>>>>    tests/xfs/group                |  1 -
>>>>>    5 files changed, 11 insertions(+), 7 deletions(-)
>>>>>    rename tests/{xfs/260 =>   generic/602} (91%)
>>>>>    create mode 100644 tests/generic/602.out
>>>>>    delete mode 100644 tests/xfs/260.out
>>>>>
>>>>> diff --git a/tests/xfs/260 b/tests/generic/602
>>>>> similarity index 91%
>>>>> rename from tests/xfs/260
>>>>> rename to tests/generic/602
>>>>> index fbdc4cd8..0cd20f31 100755
>>>>> --- a/tests/xfs/260
>>>>> +++ b/tests/generic/602
>>>>> @@ -2,7 +2,7 @@
>>>>>    # SPDX-License-Identifier: GPL-2.0
>>>>>    # Copyright (c) 2017 Red Hat Inc.  All Rights Reserved.
>>>>>    #
>>>>> -# FS QA Test 260
>>>>> +# FS QA Test 602
>>>>>    #
>>>>>    # Test per-inode DAX flag by mmap direct/buffered IO.
>>>>>    #
>>>>> @@ -28,7 +28,7 @@ _cleanup()
>>>>>    # remove previous $seqres.full before test
>>>>>    rm -f $seqres.full
>>>>>
>>>>> -_supported_fs xfs
>>>>> +_supported_fs generic
>>>>>    _supported_os Linux
>>>>>    _require_scratch_dax_mountopt "dax"
>>>>>    _require_test_program "feature"
>>>>> @@ -121,8 +121,12 @@ do_tests()
>>>>>        t_dax_flag_mmap_dio $((64 * 1024 * 1024))
>>>>>    }
>>>>>
>>>>> -# make xfs 2Mb aligned for PMD fault testing
>>>>> -_scratch_mkfs "-d su=2m,sw=1">   /dev/null 2>&1
>>>>> +# make 2Mb aligned for PMD fault testing
>>>>> +mkfs_opts=""
>>>>> +[ "$FSTYP" = "ext4" ]&&   mkfs_opts="-E stride=512,stripe_width=1"
>>>>> +[ "$FSTYP" = "xfs" ]&&   mkfs_opts="-d su=2m,sw=1"
>>>> /me wonders if this ought to be smart enough to sniff out the hugepage
>>>> size on the test machine...
>>> Hi Darrick,
>>>
>>> PMD page is always 2M, I am not sure why we need to sniff out the 
>>> hugepage
>>> size?  Could you give me an example?
>> arm64, which can have 512M hugepages.
>> ppc64, which can have 16M huge pages (I think?)
> Hi Darrick,
>
> After reading kernel xfs code, do you mean that PMD page fault is only 
> used by hugepage?
> ----------------------------------------------------------------
> xfs/xfs_file.c:
> ...
> 1223 static vm_fault_t
> 1224 xfs_filemap_fault(
> 1225         struct vm_fault         *vmf)
> 1226 {
> 1227         /* DAX can shortcut the normal fault path on write 
> faults! */
> 1228         return __xfs_filemap_fault(vmf, PE_SIZE_PTE,
> 1229                         IS_DAX(file_inode(vmf->vma->vm_file)) &&
> 1230                         (vmf->flags & FAULT_FLAG_WRITE));
> 1231 }
> 1232
> 1233 static vm_fault_t
> 1234 xfs_filemap_huge_fault(
> 1235         struct vm_fault         *vmf,
> 1236         enum page_entry_size    pe_size)
> 1237 {
> 1238         if (!IS_DAX(file_inode(vmf->vma->vm_file)))
> 1239                 return VM_FAULT_FALLBACK;
> 1240
> 1241         /* DAX can shortcut the normal fault path on write 
> faults! */
> 1242         return __xfs_filemap_fault(vmf, pe_size,
> 1243                         (vmf->flags & FAULT_FLAG_WRITE));
> 1244 }
> ...
> ----------------------------------------------------------------
>
> Another qeustion: ext4 seems not use PMD page fault,does I miss 
> something?
Hi,

Sorry, ext4 actually uses  PMD page fault as the following code does so 
please ignore the naive question. :-(

Thanks,
Xiao Yang
> ----------------------------------------------------------------
> ext4/file.c:
> ...
> 705 static vm_fault_t ext4_dax_fault(struct vm_fault *vmf)
> 706 {
> 707         return ext4_dax_huge_fault(vmf, PE_SIZE_PTE);
> 708 }
> 709
> 710 static const struct vm_operations_struct ext4_dax_vm_ops = {
> 711         .fault          = ext4_dax_fault,
> 712         .huge_fault     = ext4_dax_huge_fault,
> ...
> ----------------------------------------------------------------
>
> Best Regards,
> Xiao Yang
>> --D
>>
>>> Best Regards,
>>> Xiao Yang
>>>> --D
>>>>
>>>>> +
>>>>> +_scratch_mkfs "$mkfs_opts">   /dev/null 2>&1
>>>>>
>>>>>    # mount with dax option
>>>>>    _scratch_mount "-o dax"
>>>>> diff --git a/tests/generic/602.out b/tests/generic/602.out
>>>>> new file mode 100644
>>>>> index 00000000..61976e5e
>>>>> --- /dev/null
>>>>> +++ b/tests/generic/602.out
>>>>> @@ -0,0 +1,2 @@
>>>>> +QA output created by 602
>>>>> +Silence is golden
>>>>> diff --git a/tests/generic/group b/tests/generic/group
>>>>> index c6ce029c..4bda3772 100644
>>>>> --- a/tests/generic/group
>>>>> +++ b/tests/generic/group
>>>>> @@ -604,3 +604,4 @@
>>>>>    599 auto quick remount shutdown
>>>>>    600 auto quick quota
>>>>>    601 auto quick quota
>>>>> +602 auto attr quick dax
>>>>> diff --git a/tests/xfs/260.out b/tests/xfs/260.out
>>>>> deleted file mode 100644
>>>>> index 18ca517c..00000000
>>>>> --- a/tests/xfs/260.out
>>>>> +++ /dev/null
>>>>> @@ -1,2 +0,0 @@
>>>>> -QA output created by 260
>>>>> -Silence is golden
>>>>> diff --git a/tests/xfs/group b/tests/xfs/group
>>>>> index daf54add..71c30898 100644
>>>>> --- a/tests/xfs/group
>>>>> +++ b/tests/xfs/group
>>>>> @@ -257,7 +257,6 @@
>>>>>    257 auto quick clone
>>>>>    258 auto quick clone
>>>>>    259 auto quick
>>>>> -260 auto attr quick dax
>>>>>    261 auto quick quota
>>>>>    262 dangerous_fuzzers dangerous_scrub dangerous_online_repair
>>>>>    263 auto quick quota
>>>>> -- 
>>>>> 2.21.0
>>>>>
>>>>>
>>>>>
>>>>
>>>> .
>>>>
>>>
>>>
>>
>> .
>>
>
>
>
> .
>




^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2020-06-11 14:21 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-03 14:01 [PATCH 1/4] common/rc: Introduce new helpers for DAX mount options and FS_XFLAG_DAX Xiao Yang
2020-06-03 14:01 ` [PATCH 2/4] fstests: Use _require_scratch_dax_mountopt() and _require_scratch_daX_iflag() Xiao Yang
2020-06-03 14:01 ` [PATCH 3/4] common/rc: Remove unused _require_scratch_dax() Xiao Yang
2020-06-03 14:01 ` [PATCH 4/4] xfs/260: Move xfs/260 to generic Xiao Yang
2020-06-09 16:42   ` Darrick J. Wong
2020-06-10  6:16     ` Xiao Yang
2020-06-10 15:59       ` Darrick J. Wong
2020-06-11  8:33         ` Xiao Yang
2020-06-11  9:13         ` Xiao Yang
2020-06-11 14:19           ` Xiao Yang
2020-06-09 16:39 ` [PATCH 1/4] common/rc: Introduce new helpers for DAX mount options and FS_XFLAG_DAX Darrick J. Wong
2020-06-10  2:01   ` Xiao Yang
2020-06-10 16:37     ` Darrick J. Wong

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.