fstests: initial bcachefs support
authorKent Overstreet <kent.overstreet@gmail.com>
Tue, 25 May 2021 22:19:53 +0000 (18:19 -0400)
committerEryu Guan <guaneryu@gmail.com>
Sun, 30 May 2021 13:16:10 +0000 (21:16 +0800)
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>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
common/attr
common/config
common/quota
common/rc
tests/generic/425
tests/generic/441

index 669909d6007233df73517ba8da1d5ee776373f63..42ceab92335a9b198b6989a09238aed7aa9dc32c 100644 (file)
@@ -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`
index 1a26934985dd6417f9d2d999556cd0b69aa2a47a..ad1c9eb0925277917fb64f2d692495307e7624a8 100644 (file)
@@ -416,6 +416,9 @@ _mkfs_opts()
        btrfs)
                export MKFS_OPTIONS="$BTRFS_MKFS_OPTIONS"
                ;;
+       bcachefs)
+               export MKFS_OPTIONS=$BCACHEFS_MKFS_OPTIONS
+               ;;
        *)
                ;;
        esac
index 32a9a55593d5352f1a1227c41698271719deee93..883a28a20d7c95e9b22ac008cdc32df88dd8950e 100644 (file)
@@ -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
                ;;
index b18cf61e8a96d9fdb8636d4793a3b88fabe839f8..a0aa7300dc94906034562b0d35012b7be5383467 100644 (file)
--- 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
index 51cbe1c67dacafe7bfa92d56fe487c63fded47ad..be2bc1b02ee263d780829e0f6e3c50d3fc088e92 100755 (executable)
@@ -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"
index bedbcb081791ce03e7f13a2586edd6ac181e093a..814387b2a9456ed18c6c9fce8182b507d30c15b4 100755 (executable)
@@ -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=''
                ;;