mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
common: _scratch_mkfs_sized inherent default block size from MKFS_OPTIONS
Currently default block size is frozen to 4096 which is bad for various reasons. e.g: 1) It ignores MKFS_OPT 2) Does not work for architectures where PG_SIZE != 4096 Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
This commit is contained in:
committed by
Dave Chinner
parent
c931376982
commit
072a84581e
@@ -582,8 +582,20 @@ _scratch_mkfs_sized()
|
||||
{
|
||||
fssize=$1
|
||||
blocksize=$2
|
||||
|
||||
case $FSTYP in
|
||||
xfs)
|
||||
def_blksz=`echo $MKFS_OPTIONS|sed -rn 's/.*-b ?size= ?+([0-9]+).*/\1/p'`
|
||||
;;
|
||||
ext2|ext3|ext4|ext4dev|udf|btrfs)
|
||||
def_blksz=`echo $MKFS_OPTIONS| sed -rn 's/.*-b ?+([0-9]+).*/\1/p'`
|
||||
;;
|
||||
esac
|
||||
|
||||
[ -n "$def_blksz" ] && blocksize=$def_blksz
|
||||
[ -z "$blocksize" ] && blocksize=4096
|
||||
|
||||
|
||||
re='^[0-9]+$'
|
||||
if ! [[ $fssize =~ $re ]] ; then
|
||||
_notrun "error: _scratch_mkfs_sized: fs size \"$fssize\" not an integer."
|
||||
|
||||
Reference in New Issue
Block a user