From owner-freebsd-bugs@FreeBSD.ORG Sun Apr 4 23:00:14 2010 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A051E106566B for ; Sun, 4 Apr 2010 23:00:14 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 4EFF18FC16 for ; Sun, 4 Apr 2010 23:00:14 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o34N0EQY065768 for ; Sun, 4 Apr 2010 23:00:14 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id o34N0ENT065767; Sun, 4 Apr 2010 23:00:14 GMT (envelope-from gnats) Resent-Date: Sun, 4 Apr 2010 23:00:14 GMT Resent-Message-Id: <201004042300.o34N0ENT065767@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Alex Bakhtin Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BBF79106564A for ; Sun, 4 Apr 2010 22:53:20 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id AA60A8FC18 for ; Sun, 4 Apr 2010 22:53:20 +0000 (UTC) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o34MrKdj019283 for ; Sun, 4 Apr 2010 22:53:20 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id o34MrKJk019282; Sun, 4 Apr 2010 22:53:20 GMT (envelope-from nobody) Message-Id: <201004042253.o34MrKJk019282@www.freebsd.org> Date: Sun, 4 Apr 2010 22:53:20 GMT From: Alex Bakhtin To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: bin/145395: [nanobsd] [patch] Extremely slow nanobsd disk image creation and 100% disk load on zfs X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Apr 2010 23:00:14 -0000 >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@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: