linux-bcachefs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] Improved .gitignore
@ 2021-05-25 22:19 Kent Overstreet
  2021-05-25 22:19 ` [PATCH 2/4] Initial bcachefs support Kent Overstreet
                   ` (6 more replies)
  0 siblings, 7 replies; 12+ messages in thread
From: Kent Overstreet @ 2021-05-25 22:19 UTC (permalink / raw)
  To: fstests, linux-fsdevel, linux-bcachefs; +Cc: Kent Overstreet

Ignore dotfiles, tags, and verifier state.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
---
 .gitignore | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/.gitignore b/.gitignore
index 4cc9c80724..64e4ed253f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,6 +4,9 @@
 .dep
 .libs
 .ltdep
+.*
+*.state
+tags
 
 /local.config
 /results
-- 
2.32.0.rc0


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

* [PATCH 2/4] Initial bcachefs support
  2021-05-25 22:19 [PATCH 1/4] Improved .gitignore Kent Overstreet
@ 2021-05-25 22:19 ` Kent Overstreet
  2021-05-25 22:19 ` [PATCH 3/4] generic/{455,457,482}: make dmlogwrites tests work on bcachefs Kent Overstreet
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 12+ messages in thread
From: Kent Overstreet @ 2021-05-25 22:19 UTC (permalink / raw)
  To: fstests, linux-fsdevel, linux-bcachefs; +Cc: Kent Overstreet

To get started, you'll need to get bcachefs from the kernel repository
  https://evilpiepirate.org/git/bcachefs.git/

and tools from
  https://evilpiepirate.org/git/bcache-tools.git/

Build kernel as normal, enabling CONFIG_BCACHEFS_FS (and probably
CONFIG_BCACHEFS_DEBUG), and build and install tools. Then running
fstests is exactly the same as other local filesystems - just set
FSTYP=bcachefs

Also see https://evilpiepirate.org/git/ktest.git/ for a tool for
conveniently building kernel and running fstests inside a qemu VM.

This patch also updates generic/441 to run the more thorough test on
bcachefs, and generic/425 to not run on bcachefs (since bcachefs does
not store xattrs in blocks)

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
---
 common/attr       |  6 ++++++
 common/config     |  3 +++
 common/quota      |  4 ++--
 common/rc         | 11 +++++++++++
 tests/generic/425 |  3 +++
 tests/generic/441 |  2 +-
 6 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/common/attr b/common/attr
index 669909d600..42ceab9233 100644
--- a/common/attr
+++ b/common/attr
@@ -33,6 +33,9 @@ _acl_get_max()
 			echo 506
 		fi
 		;;
+	bcachefs)
+		echo 251
+		;;
 	*)
 		echo 0
 		;;
@@ -273,6 +276,9 @@ pvfs2)
 9p|ceph|nfs)
 	MAX_ATTRVAL_SIZE=65536
 	;;
+bcachefs)
+	MAX_ATTRVAL_SIZE=1024
+	;;
 *)
 	# Assume max ~1 block of attrs
 	BLOCK_SIZE=`_get_block_size $TEST_DIR`
diff --git a/common/config b/common/config
index 1a26934985..ad1c9eb092 100644
--- a/common/config
+++ b/common/config
@@ -416,6 +416,9 @@ _mkfs_opts()
 	btrfs)
 		export MKFS_OPTIONS="$BTRFS_MKFS_OPTIONS"
 		;;
+	bcachefs)
+		export MKFS_OPTIONS=$BCACHEFS_MKFS_OPTIONS
+		;;
 	*)
 		;;
 	esac
diff --git a/common/quota b/common/quota
index 32a9a55593..883a28a20d 100644
--- a/common/quota
+++ b/common/quota
@@ -17,7 +17,7 @@ _require_quota()
 	    _notrun "Installed kernel does not support quotas"
 	fi
 	;;
-    gfs2|ocfs2)
+    gfs2|ocfs2|bcachefs)
 	;;
     xfs)
 	if [ ! -f /proc/fs/xfs/xqmstat ]; then
@@ -278,7 +278,7 @@ _check_quota_usage()
 
 	VFS_QUOTA=0
 	case $FSTYP in
-	ext2|ext3|ext4|ext4dev|f2fs|reiserfs|gfs2)
+	ext2|ext3|ext4|ext4dev|f2fs|reiserfs|gfs2|bcachefs)
 		VFS_QUOTA=1
 		quotaon -f -u -g $SCRATCH_MNT 2>/dev/null
 		;;
diff --git a/common/rc b/common/rc
index b18cf61e8a..a0aa7300dc 100644
--- a/common/rc
+++ b/common/rc
@@ -1065,6 +1065,9 @@ _scratch_mkfs_sized()
 		fi
 		export MOUNT_OPTIONS="-o size=$fssize $TMPFS_MOUNT_OPTIONS"
 		;;
+	bcachefs)
+		$MKFS_PROG -t $FSTYP -- $MKFS_OPTIONS --fs_size=$fssize --block_size=$blocksize $SCRATCH_DEV
+		;;
 	*)
 		_notrun "Filesystem $FSTYP not supported in _scratch_mkfs_sized"
 		;;
@@ -1133,6 +1136,9 @@ _scratch_mkfs_blocksized()
     ocfs2)
 	yes | ${MKFS_PROG} -t $FSTYP -F $MKFS_OPTIONS -b $blocksize -C $blocksize $SCRATCH_DEV
 	;;
+    bcachefs)
+	${MKFS_PROG} -t $FSTYP $MKFS_OPTIONS --block_size=$blocksize $SCRATCH_DEV
+	;;
     *)
 	_notrun "Filesystem $FSTYP not supported in _scratch_mkfs_blocksized"
 	;;
@@ -1179,6 +1185,11 @@ _repair_scratch_fs()
 	fi
 	return $res
         ;;
+    bcachefs)
+	# With bcachefs, if fsck detects any errors we consider it a bug and we
+	# want the test to fail:
+	_check_scratch_fs
+	;;
     *)
 	local dev=$SCRATCH_DEV
 	local fstyp=$FSTYP
diff --git a/tests/generic/425 b/tests/generic/425
index 51cbe1c67d..be2bc1b02e 100755
--- a/tests/generic/425
+++ b/tests/generic/425
@@ -30,6 +30,9 @@ _cleanup()
 
 # real QA test starts here
 _supported_fs generic
+
+[ $FSTYP = bcachefs ] && _notrun "bcachefs does not store xattrs in blocks"
+
 _require_scratch
 _require_attrs
 _require_xfs_io_command "fiemap" "-a"
diff --git a/tests/generic/441 b/tests/generic/441
index bedbcb0817..814387b2a9 100755
--- a/tests/generic/441
+++ b/tests/generic/441
@@ -40,7 +40,7 @@ case $FSTYP in
 	btrfs)
 		_notrun "btrfs has a specialized test for this"
 		;;
-	ext3|ext4|xfs)
+	ext3|ext4|xfs|bcachefs)
 		# Do the more thorough test if we have a logdev
 		_has_logdev && sflag=''
 		;;
-- 
2.32.0.rc0


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

* [PATCH 3/4] generic/{455,457,482}: make dmlogwrites tests work on bcachefs
  2021-05-25 22:19 [PATCH 1/4] Improved .gitignore Kent Overstreet
  2021-05-25 22:19 ` [PATCH 2/4] Initial bcachefs support Kent Overstreet
@ 2021-05-25 22:19 ` Kent Overstreet
  2021-05-25 22:19 ` [PATCH 4/4] generic/269: add _check_scratch_fs Kent Overstreet
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 12+ messages in thread
From: Kent Overstreet @ 2021-05-25 22:19 UTC (permalink / raw)
  To: fstests, linux-fsdevel, linux-bcachefs; +Cc: Kent Overstreet

bcachefs has log structured btree nodes, in addition to a regular
journal, which means that unless we replay to markers in the log in the
same order that they happened and are careful to avoid writing in
between replaying to different events - we need to wipe and start fresh
each time.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
---
 tests/generic/455 | 14 ++++++++++++++
 tests/generic/457 | 14 ++++++++++++++
 tests/generic/482 | 27 ++++++++++++++++++++-------
 3 files changed, 48 insertions(+), 7 deletions(-)

diff --git a/tests/generic/455 b/tests/generic/455
index 5b4b242e74..6dc46c3c72 100755
--- a/tests/generic/455
+++ b/tests/generic/455
@@ -35,6 +35,17 @@ _require_dm_target thin-pool
 
 rm -f $seqres.full
 
+_reset_dmthin()
+{
+    # With bcachefs, we need to wipe and start fresh every time we replay to a
+    # different point in time - if we see metadata from a future point in time,
+    # or an unrelated mount, bcachefs will get confused:
+    if [ "$FSTYP" = "bcachefs" ]; then
+	_dmthin_cleanup
+	_dmthin_init $devsize $devsize $csize $lowspace
+    fi
+}
+
 check_files()
 {
 	local name=$1
@@ -44,6 +55,7 @@ check_files()
 		local filename=$(basename $i)
 		local mark="${filename##*.}"
 		echo "checking $filename" >> $seqres.full
+		_reset_dmthin
 		_log_writes_replay_log $filename $DMTHIN_VOL_DEV
 		_dmthin_mount
 		local expected_md5=$(_md5_checksum $i)
@@ -101,6 +113,7 @@ _dmthin_check_fs
 
 # check pre umount
 echo "checking pre umount" >> $seqres.full
+_reset_dmthin
 _log_writes_replay_log last $DMTHIN_VOL_DEV
 _dmthin_mount
 _dmthin_check_fs
@@ -111,6 +124,7 @@ done
 
 # Check the end
 echo "checking post umount" >> $seqres.full
+_reset_dmthin
 _log_writes_replay_log end $DMTHIN_VOL_DEV
 _dmthin_mount
 for j in `seq 0 $((NUM_FILES-1))`; do
diff --git a/tests/generic/457 b/tests/generic/457
index ddbd90cf0c..f17d4e4430 100755
--- a/tests/generic/457
+++ b/tests/generic/457
@@ -37,6 +37,17 @@ _require_dm_target thin-pool
 
 rm -f $seqres.full
 
+_reset_dmthin()
+{
+    # With bcachefs, we need to wipe and start fresh every time we replay to a
+    # different point in time - if we see metadata from a future point in time,
+    # or an unrelated mount, bcachefs will get confused:
+    if [ "$FSTYP" = "bcachefs" ]; then
+	_dmthin_cleanup
+	_dmthin_init $devsize $devsize $csize $lowspace
+    fi
+}
+
 check_files()
 {
 	local name=$1
@@ -46,6 +57,7 @@ check_files()
 		local filename=$(basename $i)
 		local mark="${filename##*.}"
 		echo "checking $filename" >> $seqres.full
+		_reset_dmthin
 		_log_writes_replay_log $filename $DMTHIN_VOL_DEV
 		_dmthin_mount
 		local expected_md5=$(_md5_checksum $i)
@@ -105,6 +117,7 @@ _dmthin_check_fs
 
 # check pre umount
 echo "checking pre umount" >> $seqres.full
+_reset_dmthin
 _log_writes_replay_log last $DMTHIN_VOL_DEV
 _dmthin_mount
 _dmthin_check_fs
@@ -115,6 +128,7 @@ done
 
 # Check the end
 echo "checking post umount" >> $seqres.full
+_reset_dmthin
 _log_writes_replay_log end $DMTHIN_VOL_DEV
 _dmthin_mount
 for j in `seq 0 $((NUM_FILES-1))`; do
diff --git a/tests/generic/482 b/tests/generic/482
index 86941e8468..3cbe187f2e 100755
--- a/tests/generic/482
+++ b/tests/generic/482
@@ -77,16 +77,29 @@ prev=$(_log_writes_mark_to_entry_number mkfs)
 cur=$(_log_writes_find_next_fua $prev)
 [ -z "$cur" ] && _fail "failed to locate next FUA write"
 
+if [ "$FSTYP" = "bcachefs" ]; then
+    _dmthin_cleanup
+    _dmthin_init $devsize $devsize $csize $lowspace
+fi
+
 while [ ! -z "$cur" ]; do
 	_log_writes_replay_log_range $cur $DMTHIN_VOL_DEV >> $seqres.full
 
-	# Here we need extra mount to replay the log, mainly for journal based
-	# fs, as their fsck will report dirty log as error.
-	# We don't care to preserve any data on the replay dev, as we can replay
-	# back to the point we need, and in fact sometimes creating/deleting
-	# snapshots repeatedly can be slower than replaying the log.
-	_dmthin_mount
-	_dmthin_check_fs
+	if [ "$FSTYP" = "bcachefs" ]; then
+	    # bcachefs will get confused if fsck does writes to replay the log,
+	    # but then we replay writes from an earlier point in time on the
+	    # same fs - but  fsck in -n mode won't do any writes:
+	    _check_scratch_fs -n $DMTHIN_VOL_DEV
+	else
+	    # Here we need extra mount to replay the log, mainly for journal based
+	    # fs, as their fsck will report dirty log as error.
+	    # We don't care to preserve any data on the replay dev, as we can replay
+	    # back to the point we need, and in fact sometimes creating/deleting
+	    # snapshots repeatedly can be slower than replaying the log.
+
+	    _dmthin_mount
+	    _dmthin_check_fs
+	fi
 
 	prev=$cur
 	cur=$(_log_writes_find_next_fua $(($cur + 1)))
-- 
2.32.0.rc0


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

* [PATCH 4/4] generic/269: add _check_scratch_fs
  2021-05-25 22:19 [PATCH 1/4] Improved .gitignore Kent Overstreet
  2021-05-25 22:19 ` [PATCH 2/4] Initial bcachefs support Kent Overstreet
  2021-05-25 22:19 ` [PATCH 3/4] generic/{455,457,482}: make dmlogwrites tests work on bcachefs Kent Overstreet
@ 2021-05-25 22:19 ` Kent Overstreet
  2021-05-25 22:19 ` [PATCH v2 1/4] Improved .gitignore Kent Overstreet
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 12+ messages in thread
From: Kent Overstreet @ 2021-05-25 22:19 UTC (permalink / raw)
  To: fstests, linux-fsdevel, linux-bcachefs; +Cc: Kent Overstreet

This probably should be in every test that uses the scratch device.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
---
 tests/generic/269 | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/generic/269 b/tests/generic/269
index aec573c06a..484a26f89f 100755
--- a/tests/generic/269
+++ b/tests/generic/269
@@ -63,5 +63,7 @@ if ! _scratch_unmount; then
 	status=1
 	exit
 fi
+
+_check_scratch_fs
 status=0
 exit
-- 
2.32.0.rc0


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

* [PATCH v2 1/4] Improved .gitignore
  2021-05-25 22:19 [PATCH 1/4] Improved .gitignore Kent Overstreet
                   ` (2 preceding siblings ...)
  2021-05-25 22:19 ` [PATCH 4/4] generic/269: add _check_scratch_fs Kent Overstreet
@ 2021-05-25 22:19 ` Kent Overstreet
  2021-05-25 22:19 ` [PATCH v2 2/4] Initial bcachefs support Kent Overstreet
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 12+ messages in thread
From: Kent Overstreet @ 2021-05-25 22:19 UTC (permalink / raw)
  To: fstests, linux-fsdevel, linux-bcachefs; +Cc: Kent Overstreet

Ignore dotfiles, tags, and verifier state.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
---
 .gitignore | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/.gitignore b/.gitignore
index 4cc9c80724..64e4ed253f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,6 +4,9 @@
 .dep
 .libs
 .ltdep
+.*
+*.state
+tags
 
 /local.config
 /results
-- 
2.32.0.rc0


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

* [PATCH v2 2/4] Initial bcachefs support
  2021-05-25 22:19 [PATCH 1/4] Improved .gitignore Kent Overstreet
                   ` (3 preceding siblings ...)
  2021-05-25 22:19 ` [PATCH v2 1/4] Improved .gitignore Kent Overstreet
@ 2021-05-25 22:19 ` Kent Overstreet
  2021-05-25 22:19 ` [PATCH v2 3/4] generic/{455,457,482}: make dmlogwrites tests work on bcachefs Kent Overstreet
  2021-05-25 22:19 ` [PATCH v2 4/4] generic/269: add _check_scratch_fs Kent Overstreet
  6 siblings, 0 replies; 12+ messages in thread
From: Kent Overstreet @ 2021-05-25 22:19 UTC (permalink / raw)
  To: fstests, linux-fsdevel, linux-bcachefs; +Cc: Kent Overstreet

To get started, you'll need to get bcachefs from the kernel repository
  https://evilpiepirate.org/git/bcachefs.git/

and tools from
  https://evilpiepirate.org/git/bcache-tools.git/

Build kernel as normal, enabling CONFIG_BCACHEFS_FS (and probably
CONFIG_BCACHEFS_DEBUG), and build and install tools. Then running
fstests is exactly the same as other local filesystems - just set
FSTYP=bcachefs

Also see https://evilpiepirate.org/git/ktest.git/ for a tool for
conveniently building kernel and running fstests inside a qemu VM.

This patch also updates generic/441 to run the more thorough test on
bcachefs, and generic/425 to not run on bcachefs (since bcachefs does
not store xattrs in blocks)

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
---
 common/attr       |  6 ++++++
 common/config     |  3 +++
 common/quota      |  4 ++--
 common/rc         | 11 +++++++++++
 tests/generic/425 |  3 +++
 tests/generic/441 |  2 +-
 6 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/common/attr b/common/attr
index 669909d600..42ceab9233 100644
--- a/common/attr
+++ b/common/attr
@@ -33,6 +33,9 @@ _acl_get_max()
 			echo 506
 		fi
 		;;
+	bcachefs)
+		echo 251
+		;;
 	*)
 		echo 0
 		;;
@@ -273,6 +276,9 @@ pvfs2)
 9p|ceph|nfs)
 	MAX_ATTRVAL_SIZE=65536
 	;;
+bcachefs)
+	MAX_ATTRVAL_SIZE=1024
+	;;
 *)
 	# Assume max ~1 block of attrs
 	BLOCK_SIZE=`_get_block_size $TEST_DIR`
diff --git a/common/config b/common/config
index 1a26934985..ad1c9eb092 100644
--- a/common/config
+++ b/common/config
@@ -416,6 +416,9 @@ _mkfs_opts()
 	btrfs)
 		export MKFS_OPTIONS="$BTRFS_MKFS_OPTIONS"
 		;;
+	bcachefs)
+		export MKFS_OPTIONS=$BCACHEFS_MKFS_OPTIONS
+		;;
 	*)
 		;;
 	esac
diff --git a/common/quota b/common/quota
index 32a9a55593..883a28a20d 100644
--- a/common/quota
+++ b/common/quota
@@ -17,7 +17,7 @@ _require_quota()
 	    _notrun "Installed kernel does not support quotas"
 	fi
 	;;
-    gfs2|ocfs2)
+    gfs2|ocfs2|bcachefs)
 	;;
     xfs)
 	if [ ! -f /proc/fs/xfs/xqmstat ]; then
@@ -278,7 +278,7 @@ _check_quota_usage()
 
 	VFS_QUOTA=0
 	case $FSTYP in
-	ext2|ext3|ext4|ext4dev|f2fs|reiserfs|gfs2)
+	ext2|ext3|ext4|ext4dev|f2fs|reiserfs|gfs2|bcachefs)
 		VFS_QUOTA=1
 		quotaon -f -u -g $SCRATCH_MNT 2>/dev/null
 		;;
diff --git a/common/rc b/common/rc
index b18cf61e8a..a0aa7300dc 100644
--- a/common/rc
+++ b/common/rc
@@ -1065,6 +1065,9 @@ _scratch_mkfs_sized()
 		fi
 		export MOUNT_OPTIONS="-o size=$fssize $TMPFS_MOUNT_OPTIONS"
 		;;
+	bcachefs)
+		$MKFS_PROG -t $FSTYP -- $MKFS_OPTIONS --fs_size=$fssize --block_size=$blocksize $SCRATCH_DEV
+		;;
 	*)
 		_notrun "Filesystem $FSTYP not supported in _scratch_mkfs_sized"
 		;;
@@ -1133,6 +1136,9 @@ _scratch_mkfs_blocksized()
     ocfs2)
 	yes | ${MKFS_PROG} -t $FSTYP -F $MKFS_OPTIONS -b $blocksize -C $blocksize $SCRATCH_DEV
 	;;
+    bcachefs)
+	${MKFS_PROG} -t $FSTYP $MKFS_OPTIONS --block_size=$blocksize $SCRATCH_DEV
+	;;
     *)
 	_notrun "Filesystem $FSTYP not supported in _scratch_mkfs_blocksized"
 	;;
@@ -1179,6 +1185,11 @@ _repair_scratch_fs()
 	fi
 	return $res
         ;;
+    bcachefs)
+	# With bcachefs, if fsck detects any errors we consider it a bug and we
+	# want the test to fail:
+	_check_scratch_fs
+	;;
     *)
 	local dev=$SCRATCH_DEV
 	local fstyp=$FSTYP
diff --git a/tests/generic/425 b/tests/generic/425
index 51cbe1c67d..be2bc1b02e 100755
--- a/tests/generic/425
+++ b/tests/generic/425
@@ -30,6 +30,9 @@ _cleanup()
 
 # real QA test starts here
 _supported_fs generic
+
+[ $FSTYP = bcachefs ] && _notrun "bcachefs does not store xattrs in blocks"
+
 _require_scratch
 _require_attrs
 _require_xfs_io_command "fiemap" "-a"
diff --git a/tests/generic/441 b/tests/generic/441
index bedbcb0817..814387b2a9 100755
--- a/tests/generic/441
+++ b/tests/generic/441
@@ -40,7 +40,7 @@ case $FSTYP in
 	btrfs)
 		_notrun "btrfs has a specialized test for this"
 		;;
-	ext3|ext4|xfs)
+	ext3|ext4|xfs|bcachefs)
 		# Do the more thorough test if we have a logdev
 		_has_logdev && sflag=''
 		;;
-- 
2.32.0.rc0


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

* [PATCH v2 3/4] generic/{455,457,482}: make dmlogwrites tests work on bcachefs
  2021-05-25 22:19 [PATCH 1/4] Improved .gitignore Kent Overstreet
                   ` (4 preceding siblings ...)
  2021-05-25 22:19 ` [PATCH v2 2/4] Initial bcachefs support Kent Overstreet
@ 2021-05-25 22:19 ` Kent Overstreet
  2021-05-30 13:18   ` Eryu Guan
  2021-05-25 22:19 ` [PATCH v2 4/4] generic/269: add _check_scratch_fs Kent Overstreet
  6 siblings, 1 reply; 12+ messages in thread
From: Kent Overstreet @ 2021-05-25 22:19 UTC (permalink / raw)
  To: fstests, linux-fsdevel, linux-bcachefs; +Cc: Kent Overstreet

bcachefs has log structured btree nodes, in addition to a regular
journal, which means that unless we replay to markers in the log in the
same order that they happened and are careful to avoid writing in
between replaying to different events - we need to wipe and start fresh
each time.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
---
 tests/generic/455 | 14 ++++++++++++++
 tests/generic/457 | 14 ++++++++++++++
 tests/generic/482 | 27 ++++++++++++++++++++-------
 3 files changed, 48 insertions(+), 7 deletions(-)

diff --git a/tests/generic/455 b/tests/generic/455
index 5b4b242e74..6dc46c3c72 100755
--- a/tests/generic/455
+++ b/tests/generic/455
@@ -35,6 +35,17 @@ _require_dm_target thin-pool
 
 rm -f $seqres.full
 
+_reset_dmthin()
+{
+    # With bcachefs, we need to wipe and start fresh every time we replay to a
+    # different point in time - if we see metadata from a future point in time,
+    # or an unrelated mount, bcachefs will get confused:
+    if [ "$FSTYP" = "bcachefs" ]; then
+	_dmthin_cleanup
+	_dmthin_init $devsize $devsize $csize $lowspace
+    fi
+}
+
 check_files()
 {
 	local name=$1
@@ -44,6 +55,7 @@ check_files()
 		local filename=$(basename $i)
 		local mark="${filename##*.}"
 		echo "checking $filename" >> $seqres.full
+		_reset_dmthin
 		_log_writes_replay_log $filename $DMTHIN_VOL_DEV
 		_dmthin_mount
 		local expected_md5=$(_md5_checksum $i)
@@ -101,6 +113,7 @@ _dmthin_check_fs
 
 # check pre umount
 echo "checking pre umount" >> $seqres.full
+_reset_dmthin
 _log_writes_replay_log last $DMTHIN_VOL_DEV
 _dmthin_mount
 _dmthin_check_fs
@@ -111,6 +124,7 @@ done
 
 # Check the end
 echo "checking post umount" >> $seqres.full
+_reset_dmthin
 _log_writes_replay_log end $DMTHIN_VOL_DEV
 _dmthin_mount
 for j in `seq 0 $((NUM_FILES-1))`; do
diff --git a/tests/generic/457 b/tests/generic/457
index ddbd90cf0c..f17d4e4430 100755
--- a/tests/generic/457
+++ b/tests/generic/457
@@ -37,6 +37,17 @@ _require_dm_target thin-pool
 
 rm -f $seqres.full
 
+_reset_dmthin()
+{
+    # With bcachefs, we need to wipe and start fresh every time we replay to a
+    # different point in time - if we see metadata from a future point in time,
+    # or an unrelated mount, bcachefs will get confused:
+    if [ "$FSTYP" = "bcachefs" ]; then
+	_dmthin_cleanup
+	_dmthin_init $devsize $devsize $csize $lowspace
+    fi
+}
+
 check_files()
 {
 	local name=$1
@@ -46,6 +57,7 @@ check_files()
 		local filename=$(basename $i)
 		local mark="${filename##*.}"
 		echo "checking $filename" >> $seqres.full
+		_reset_dmthin
 		_log_writes_replay_log $filename $DMTHIN_VOL_DEV
 		_dmthin_mount
 		local expected_md5=$(_md5_checksum $i)
@@ -105,6 +117,7 @@ _dmthin_check_fs
 
 # check pre umount
 echo "checking pre umount" >> $seqres.full
+_reset_dmthin
 _log_writes_replay_log last $DMTHIN_VOL_DEV
 _dmthin_mount
 _dmthin_check_fs
@@ -115,6 +128,7 @@ done
 
 # Check the end
 echo "checking post umount" >> $seqres.full
+_reset_dmthin
 _log_writes_replay_log end $DMTHIN_VOL_DEV
 _dmthin_mount
 for j in `seq 0 $((NUM_FILES-1))`; do
diff --git a/tests/generic/482 b/tests/generic/482
index 86941e8468..3cbe187f2e 100755
--- a/tests/generic/482
+++ b/tests/generic/482
@@ -77,16 +77,29 @@ prev=$(_log_writes_mark_to_entry_number mkfs)
 cur=$(_log_writes_find_next_fua $prev)
 [ -z "$cur" ] && _fail "failed to locate next FUA write"
 
+if [ "$FSTYP" = "bcachefs" ]; then
+    _dmthin_cleanup
+    _dmthin_init $devsize $devsize $csize $lowspace
+fi
+
 while [ ! -z "$cur" ]; do
 	_log_writes_replay_log_range $cur $DMTHIN_VOL_DEV >> $seqres.full
 
-	# Here we need extra mount to replay the log, mainly for journal based
-	# fs, as their fsck will report dirty log as error.
-	# We don't care to preserve any data on the replay dev, as we can replay
-	# back to the point we need, and in fact sometimes creating/deleting
-	# snapshots repeatedly can be slower than replaying the log.
-	_dmthin_mount
-	_dmthin_check_fs
+	if [ "$FSTYP" = "bcachefs" ]; then
+	    # bcachefs will get confused if fsck does writes to replay the log,
+	    # but then we replay writes from an earlier point in time on the
+	    # same fs - but  fsck in -n mode won't do any writes:
+	    _check_scratch_fs -n $DMTHIN_VOL_DEV
+	else
+	    # Here we need extra mount to replay the log, mainly for journal based
+	    # fs, as their fsck will report dirty log as error.
+	    # We don't care to preserve any data on the replay dev, as we can replay
+	    # back to the point we need, and in fact sometimes creating/deleting
+	    # snapshots repeatedly can be slower than replaying the log.
+
+	    _dmthin_mount
+	    _dmthin_check_fs
+	fi
 
 	prev=$cur
 	cur=$(_log_writes_find_next_fua $(($cur + 1)))
-- 
2.32.0.rc0


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

* [PATCH v2 4/4] generic/269: add _check_scratch_fs
  2021-05-25 22:19 [PATCH 1/4] Improved .gitignore Kent Overstreet
                   ` (5 preceding siblings ...)
  2021-05-25 22:19 ` [PATCH v2 3/4] generic/{455,457,482}: make dmlogwrites tests work on bcachefs Kent Overstreet
@ 2021-05-25 22:19 ` Kent Overstreet
  2021-05-26  1:34   ` Darrick J. Wong
  6 siblings, 1 reply; 12+ messages in thread
From: Kent Overstreet @ 2021-05-25 22:19 UTC (permalink / raw)
  To: fstests, linux-fsdevel, linux-bcachefs; +Cc: Kent Overstreet

This probably should be in every test that uses the scratch device.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
---
 tests/generic/269 | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/generic/269 b/tests/generic/269
index aec573c06a..484a26f89f 100755
--- a/tests/generic/269
+++ b/tests/generic/269
@@ -63,5 +63,7 @@ if ! _scratch_unmount; then
 	status=1
 	exit
 fi
+
+_check_scratch_fs
 status=0
 exit
-- 
2.32.0.rc0


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

* Re: [PATCH v2 4/4] generic/269: add _check_scratch_fs
  2021-05-25 22:19 ` [PATCH v2 4/4] generic/269: add _check_scratch_fs Kent Overstreet
@ 2021-05-26  1:34   ` Darrick J. Wong
  2021-05-26  1:53     ` Kent Overstreet
  0 siblings, 1 reply; 12+ messages in thread
From: Darrick J. Wong @ 2021-05-26  1:34 UTC (permalink / raw)
  To: Kent Overstreet; +Cc: fstests, linux-fsdevel, linux-bcachefs

On Tue, May 25, 2021 at 06:19:55PM -0400, Kent Overstreet wrote:
> This probably should be in every test that uses the scratch device.

Um, it is -- ./check runs fsck on the test and scratch devices if you
_require_test or _require_scratch'd them (which this test does).  What
weird output did you see?

--D

> Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
> ---
>  tests/generic/269 | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/tests/generic/269 b/tests/generic/269
> index aec573c06a..484a26f89f 100755
> --- a/tests/generic/269
> +++ b/tests/generic/269
> @@ -63,5 +63,7 @@ if ! _scratch_unmount; then
>  	status=1
>  	exit
>  fi
> +
> +_check_scratch_fs
>  status=0
>  exit
> -- 
> 2.32.0.rc0
> 

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

* Re: [PATCH v2 4/4] generic/269: add _check_scratch_fs
  2021-05-26  1:34   ` Darrick J. Wong
@ 2021-05-26  1:53     ` Kent Overstreet
  0 siblings, 0 replies; 12+ messages in thread
From: Kent Overstreet @ 2021-05-26  1:53 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: fstests, linux-fsdevel, linux-bcachefs

On Tue, May 25, 2021 at 06:34:18PM -0700, Darrick J. Wong wrote:
> On Tue, May 25, 2021 at 06:19:55PM -0400, Kent Overstreet wrote:
> > This probably should be in every test that uses the scratch device.
> 
> Um, it is -- ./check runs fsck on the test and scratch devices if you
> _require_test or _require_scratch'd them (which this test does).  What
> weird output did you see?

I could've sworn I had generic/269 pass until I adedd that, but I just rechecked
and it's doing what you describe - my bad, I'll drop this one.

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

* Re: [PATCH v2 3/4] generic/{455,457,482}: make dmlogwrites tests work on bcachefs
  2021-05-25 22:19 ` [PATCH v2 3/4] generic/{455,457,482}: make dmlogwrites tests work on bcachefs Kent Overstreet
@ 2021-05-30 13:18   ` Eryu Guan
  2021-06-01 18:50     ` Kent Overstreet
  0 siblings, 1 reply; 12+ messages in thread
From: Eryu Guan @ 2021-05-30 13:18 UTC (permalink / raw)
  To: Kent Overstreet; +Cc: fstests, linux-fsdevel, linux-bcachefs

On Tue, May 25, 2021 at 06:19:54PM -0400, Kent Overstreet wrote:
> bcachefs has log structured btree nodes, in addition to a regular
> journal, which means that unless we replay to markers in the log in the
> same order that they happened and are careful to avoid writing in
> between replaying to different events - we need to wipe and start fresh
> each time.
> 
> Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
> ---
>  tests/generic/455 | 14 ++++++++++++++
>  tests/generic/457 | 14 ++++++++++++++
>  tests/generic/482 | 27 ++++++++++++++++++++-------
>  3 files changed, 48 insertions(+), 7 deletions(-)
> 
> diff --git a/tests/generic/455 b/tests/generic/455
> index 5b4b242e74..6dc46c3c72 100755
> --- a/tests/generic/455
> +++ b/tests/generic/455
> @@ -35,6 +35,17 @@ _require_dm_target thin-pool
>  
>  rm -f $seqres.full
>  
> +_reset_dmthin()
> +{
> +    # With bcachefs, we need to wipe and start fresh every time we replay to a
> +    # different point in time - if we see metadata from a future point in time,
> +    # or an unrelated mount, bcachefs will get confused:
> +    if [ "$FSTYP" = "bcachefs" ]; then
> +	_dmthin_cleanup
> +	_dmthin_init $devsize $devsize $csize $lowspace
> +    fi
> +}

I think we probably could make it a common helper, and currently only
bcachefs needs reset, and more log structured filesystems may be
supported in the future.

Thanks,
Eryu

> +
>  check_files()
>  {
>  	local name=$1
> @@ -44,6 +55,7 @@ check_files()
>  		local filename=$(basename $i)
>  		local mark="${filename##*.}"
>  		echo "checking $filename" >> $seqres.full
> +		_reset_dmthin
>  		_log_writes_replay_log $filename $DMTHIN_VOL_DEV
>  		_dmthin_mount
>  		local expected_md5=$(_md5_checksum $i)
> @@ -101,6 +113,7 @@ _dmthin_check_fs
>  
>  # check pre umount
>  echo "checking pre umount" >> $seqres.full
> +_reset_dmthin
>  _log_writes_replay_log last $DMTHIN_VOL_DEV
>  _dmthin_mount
>  _dmthin_check_fs
> @@ -111,6 +124,7 @@ done
>  
>  # Check the end
>  echo "checking post umount" >> $seqres.full
> +_reset_dmthin
>  _log_writes_replay_log end $DMTHIN_VOL_DEV
>  _dmthin_mount
>  for j in `seq 0 $((NUM_FILES-1))`; do
> diff --git a/tests/generic/457 b/tests/generic/457
> index ddbd90cf0c..f17d4e4430 100755
> --- a/tests/generic/457
> +++ b/tests/generic/457
> @@ -37,6 +37,17 @@ _require_dm_target thin-pool
>  
>  rm -f $seqres.full
>  
> +_reset_dmthin()
> +{
> +    # With bcachefs, we need to wipe and start fresh every time we replay to a
> +    # different point in time - if we see metadata from a future point in time,
> +    # or an unrelated mount, bcachefs will get confused:
> +    if [ "$FSTYP" = "bcachefs" ]; then
> +	_dmthin_cleanup
> +	_dmthin_init $devsize $devsize $csize $lowspace
> +    fi
> +}
> +
>  check_files()
>  {
>  	local name=$1
> @@ -46,6 +57,7 @@ check_files()
>  		local filename=$(basename $i)
>  		local mark="${filename##*.}"
>  		echo "checking $filename" >> $seqres.full
> +		_reset_dmthin
>  		_log_writes_replay_log $filename $DMTHIN_VOL_DEV
>  		_dmthin_mount
>  		local expected_md5=$(_md5_checksum $i)
> @@ -105,6 +117,7 @@ _dmthin_check_fs
>  
>  # check pre umount
>  echo "checking pre umount" >> $seqres.full
> +_reset_dmthin
>  _log_writes_replay_log last $DMTHIN_VOL_DEV
>  _dmthin_mount
>  _dmthin_check_fs
> @@ -115,6 +128,7 @@ done
>  
>  # Check the end
>  echo "checking post umount" >> $seqres.full
> +_reset_dmthin
>  _log_writes_replay_log end $DMTHIN_VOL_DEV
>  _dmthin_mount
>  for j in `seq 0 $((NUM_FILES-1))`; do
> diff --git a/tests/generic/482 b/tests/generic/482
> index 86941e8468..3cbe187f2e 100755
> --- a/tests/generic/482
> +++ b/tests/generic/482
> @@ -77,16 +77,29 @@ prev=$(_log_writes_mark_to_entry_number mkfs)
>  cur=$(_log_writes_find_next_fua $prev)
>  [ -z "$cur" ] && _fail "failed to locate next FUA write"
>  
> +if [ "$FSTYP" = "bcachefs" ]; then
> +    _dmthin_cleanup
> +    _dmthin_init $devsize $devsize $csize $lowspace
> +fi
> +
>  while [ ! -z "$cur" ]; do
>  	_log_writes_replay_log_range $cur $DMTHIN_VOL_DEV >> $seqres.full
>  
> -	# Here we need extra mount to replay the log, mainly for journal based
> -	# fs, as their fsck will report dirty log as error.
> -	# We don't care to preserve any data on the replay dev, as we can replay
> -	# back to the point we need, and in fact sometimes creating/deleting
> -	# snapshots repeatedly can be slower than replaying the log.
> -	_dmthin_mount
> -	_dmthin_check_fs
> +	if [ "$FSTYP" = "bcachefs" ]; then
> +	    # bcachefs will get confused if fsck does writes to replay the log,
> +	    # but then we replay writes from an earlier point in time on the
> +	    # same fs - but  fsck in -n mode won't do any writes:
> +	    _check_scratch_fs -n $DMTHIN_VOL_DEV
> +	else
> +	    # Here we need extra mount to replay the log, mainly for journal based
> +	    # fs, as their fsck will report dirty log as error.
> +	    # We don't care to preserve any data on the replay dev, as we can replay
> +	    # back to the point we need, and in fact sometimes creating/deleting
> +	    # snapshots repeatedly can be slower than replaying the log.
> +
> +	    _dmthin_mount
> +	    _dmthin_check_fs
> +	fi
>  
>  	prev=$cur
>  	cur=$(_log_writes_find_next_fua $(($cur + 1)))
> -- 
> 2.32.0.rc0

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

* Re: [PATCH v2 3/4] generic/{455,457,482}: make dmlogwrites tests work on bcachefs
  2021-05-30 13:18   ` Eryu Guan
@ 2021-06-01 18:50     ` Kent Overstreet
  0 siblings, 0 replies; 12+ messages in thread
From: Kent Overstreet @ 2021-06-01 18:50 UTC (permalink / raw)
  To: Eryu Guan; +Cc: fstests, linux-fsdevel, linux-bcachefs

On Sun, May 30, 2021 at 09:18:49PM +0800, Eryu Guan wrote:
> On Tue, May 25, 2021 at 06:19:54PM -0400, Kent Overstreet wrote:
> > bcachefs has log structured btree nodes, in addition to a regular
> > journal, which means that unless we replay to markers in the log in the
> > same order that they happened and are careful to avoid writing in
> > between replaying to different events - we need to wipe and start fresh
> > each time.
> > 
> > Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
> > ---
> >  tests/generic/455 | 14 ++++++++++++++
> >  tests/generic/457 | 14 ++++++++++++++
> >  tests/generic/482 | 27 ++++++++++++++++++++-------
> >  3 files changed, 48 insertions(+), 7 deletions(-)
> > 
> > diff --git a/tests/generic/455 b/tests/generic/455
> > index 5b4b242e74..6dc46c3c72 100755
> > --- a/tests/generic/455
> > +++ b/tests/generic/455
> > @@ -35,6 +35,17 @@ _require_dm_target thin-pool
> >  
> >  rm -f $seqres.full
> >  
> > +_reset_dmthin()
> > +{
> > +    # With bcachefs, we need to wipe and start fresh every time we replay to a
> > +    # different point in time - if we see metadata from a future point in time,
> > +    # or an unrelated mount, bcachefs will get confused:
> > +    if [ "$FSTYP" = "bcachefs" ]; then
> > +	_dmthin_cleanup
> > +	_dmthin_init $devsize $devsize $csize $lowspace
> > +    fi
> > +}
> 
> I think we probably could make it a common helper, and currently only
> bcachefs needs reset, and more log structured filesystems may be
> supported in the future.

I think it might be better to wait until we have more dmlogwrites tests or
another filesystem that needs this - I don't think this would be a good common
helper as is, it's too coupled to what the tests are doing - factoring out
helpers just because you spot identical code is an anti pattern when there isn't
a good notion of what you're abstracting

Right now 455 and 457 are basically identical anyways, factoring out a single
helper and ignoring the rest doesn't make much sense to me.

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

end of thread, other threads:[~2021-06-01 18:50 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-25 22:19 [PATCH 1/4] Improved .gitignore Kent Overstreet
2021-05-25 22:19 ` [PATCH 2/4] Initial bcachefs support Kent Overstreet
2021-05-25 22:19 ` [PATCH 3/4] generic/{455,457,482}: make dmlogwrites tests work on bcachefs Kent Overstreet
2021-05-25 22:19 ` [PATCH 4/4] generic/269: add _check_scratch_fs Kent Overstreet
2021-05-25 22:19 ` [PATCH v2 1/4] Improved .gitignore Kent Overstreet
2021-05-25 22:19 ` [PATCH v2 2/4] Initial bcachefs support Kent Overstreet
2021-05-25 22:19 ` [PATCH v2 3/4] generic/{455,457,482}: make dmlogwrites tests work on bcachefs Kent Overstreet
2021-05-30 13:18   ` Eryu Guan
2021-06-01 18:50     ` Kent Overstreet
2021-05-25 22:19 ` [PATCH v2 4/4] generic/269: add _check_scratch_fs Kent Overstreet
2021-05-26  1:34   ` Darrick J. Wong
2021-05-26  1:53     ` Kent Overstreet

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).