common: _scratch_mkfs_sized inherent default block size from MKFS_OPTIONS
authorDmitry Monakhov <dmonakhov@openvz.org>
Mon, 8 Sep 2014 10:49:26 +0000 (20:49 +1000)
committerDave Chinner <david@fromorbit.com>
Mon, 8 Sep 2014 10:49:26 +0000 (20:49 +1000)
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>
common/rc

index fca845899f346bd643606829178aa6080acb9d5e..40356988ad873b0e596055de1df285dd2a76fa36 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -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."