@@ -930,6 +930,7 @@ _scratch_mkfs_sized()
local fssize=$1
local blocksize=$2
local def_blksz
+ local blocksize_opt
case $FSTYP in
xfs)
@@ -950,6 +951,13 @@ _scratch_mkfs_sized()
jfs)
def_blksz=4096
;;
+ bcachefs)
+ def_blksz=`echo $MKFS_OPTIONS | sed -rn 's/.*(--block_size)[ =]?+([0-9]+).*/\2/p'`
+ [ -n "$def_blksize" ] && blocksize_opt="--block_size=$def_blksize"
+ [ -n "$blocksize" ] && blocksize_opt="--block_size=$blocksize"
+ # If no block size is given by local.confg or parameter, blocksize_opt is empty.
+ # Let MKFS_BCACHEFS_PROG decide block size on its own.
+ ;;
esac
[ -n "$def_blksz" ] && blocksize=$def_blksz
@@ -1051,7 +1059,7 @@ _scratch_mkfs_sized()
export MOUNT_OPTIONS="-o size=$fssize $TMPFS_MOUNT_OPTIONS"
;;
bcachefs)
- $MKFS_BCACHEFS_PROG $MKFS_OPTIONS --fs_size=$fssize --block_size=$blocksize $SCRATCH_DEV
+ $MKFS_BCACHEFS_PROG $MKFS_OPTIONS --fs_size=$fssize $blocksize_opt $SCRATCH_DEV
;;
*)
_notrun "Filesystem $FSTYP not supported in _scratch_mkfs_sized"