bin/145395: [nanobsd] [patch] Extremely slow nanobsd disk image creation and 100% disk load on zfs

Alex Bakhtin Alex.Bakhtin at gmail.com
Sun Apr 4 23:00:14 UTC 2010


>Number:         145395
>Category:       bin
>Synopsis:       [nanobsd] [patch] Extremely slow nanobsd disk image creation and 100% disk load on zfs
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Apr 04 23:00:13 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Alex Bakhtin
>Release:        8.0-STABLE
>Organization:
>Environment:
FreeBSD tarzan-new.private.flydrag.ru 8.0-STABLE FreeBSD 8.0-STABLE #1: Sat Apr  3 04:54:06 UTC 2010     bakhtin at tarzan-new.private.flydrag.ru:/mnt/obj/usr/src.old/sys/DEBUG  amd64

>Description:
Extremely slow nanobsd disk image creation discovered on zfs. 
Image write speed is near 1 Megabyte/sec with 100% load of all zfs vdevs.
This is because default -o sync behavior of mdconfig causing zfs to syncronize on every write.

I think the best way to fix this is to provide an option in nanobsd.sh to allow user to switch to async mode (and use sync by default - POLA):

# Use -o async option for mdconfig
NANO_MD_ASYNC=0

After applying this patch image write speed is near 30 megs/sec on my HW.


>How-To-Repeat:
set NANO_OBJ to some zfs file system
check image creation/partition duplication speed and disk load (f.e. using gstat).

>Fix:


Patch attached with submission follows:

--- /usr/src/tools/tools/nanobsd/nanobsd.sh     2010-04-02 03:42:47.000000000 +0000
+++ nanobsd.sh  2010-04-05 06:43:41.000000000 +0000
@@ -128,6 +128,9 @@
 # Can be "file" or "swap"
 NANO_MD_BACKING="file"

+# Use -o async option for mdconfig
+NANO_MD_ASYNC=0
+
 # Progress Print level
 PPLEVEL=3

@@ -428,6 +431,11 @@
        MNT=${NANO_OBJ}/_.mnt
        mkdir -p ${MNT}

+       _NANO_MDCONFIG_OPTIONS=' '
+       if [ "${NANO_MD_ASYNC}" == 1 ] ; then
+               _NANO_MDCONFIG_OPTIONS="-o async"
+       fi
+
        if [ "${NANO_MD_BACKING}" = "swap" ] ; then
                MD=`mdconfig -a -t swap -s ${NANO_MEDIASIZE} -x ${NANO_SECTS} \
                        -y ${NANO_HEADS}`
@@ -436,7 +444,7 @@
                dd if=/dev/zero of=${IMG} bs=${NANO_SECTS}b \
                        count=`expr ${NANO_MEDIASIZE} / ${NANO_SECTS}`
                MD=`mdconfig -a -t vnode -f ${IMG} -x ${NANO_SECTS} \
-                       -y ${NANO_HEADS}`
+                       -y ${NANO_HEADS} ${_NANO_MDCONFIG_OPTIONS}`
        fi

        trap "echo 'Running exit trap code' ; df -i ${MNT} ; umount ${MNT} || true ; mdconfig -d -u $MD" 1 2 15 EXIT


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list