From nobody@FreeBSD.org  Sun Apr  4 22:53:20 2010
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BBF79106564A
	for <freebsd-gnats-submit@FreeBSD.org>; 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 <freebsd-gnats-submit@FreeBSD.org>; 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 <freebsd-gnats-submit@FreeBSD.org>; 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 <Alex.Bakhtin@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [nanobsd] [patch] Extremely slow nanobsd disk image creation and 100% disk load on zfs
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         145395
>Category:       misc
>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:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Apr 04 23:00:13 UTC 2010
>Closed-Date:    Fri May 13 13:45:04 MDT 2011
>Last-Modified:  Wed May 25 20:20:06 UTC 2011
>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:

From: Alex Bakhtin <alex.bakhtin@gmail.com>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: misc/145395: [nanobsd] [patch] Extremely slow nanobsd disk image 
	creation and 100% disk load on zfs
Date: Tue, 6 Apr 2010 13:11:28 +0400

 --0016e6db66f9ac3cdc04838dd4ed
 Content-Type: multipart/alternative; boundary=0016e6db66f9ac3cd504838dd4eb
 
 --0016e6db66f9ac3cd504838dd4eb
 Content-Type: text/plain; charset=ISO-8859-1
 
 Sorry, the patch submitted was not fully tested and has errors.
 Please look into attached path with fixes.
 
 Alex Bakhtin
 
 --0016e6db66f9ac3cd504838dd4eb
 Content-Type: text/html; charset=ISO-8859-1
 
 Sorry, the patch submitted was not fully tested and has errors.<br>Please look into attached path with fixes.<br><br>Alex Bakhtin<br><br>
 
 --0016e6db66f9ac3cd504838dd4eb--
 --0016e6db66f9ac3cdc04838dd4ed
 Content-Type: text/plain; charset=US-ASCII; name="nanobsd_1.patch.txt"
 Content-Disposition: attachment; filename="nanobsd_1.patch.txt"
 Content-Transfer-Encoding: base64
 X-Attachment-Id: f_g7ohpl2q0
 
 LS0tIC91c3Ivc3JjL3Rvb2xzL3Rvb2xzL25hbm9ic2QvbmFub2JzZC5zaAkyMDEwLTA0LTAyIDAz
 OjQyOjQ3LjAwMDAwMDAwMCArMDAwMAorKysgbmFub2JzZC5zaAkyMDEwLTA0LTA2IDE3OjA0OjU0
 LjAwMDAwMDAwMCArMDAwMApAQCAtMTI4LDYgKzEyOCwxMCBAQAogIyBDYW4gYmUgImZpbGUiIG9y
 ICJzd2FwIgogTkFOT19NRF9CQUNLSU5HPSJmaWxlIgogCisjIDAgLT4gVXNlIGRlZmF1bHQgb3B0
 aW9ucyBmb3IgbWRjb25maWcKKyMgMSAtPiBVc2UgLW8gYXN5bmMgb3B0aW9uIGZvciBtZGNvbmZ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
State-Changed-By: imp 
State-Changed-When: Fri May 13 13:44:33 MDT 2011 
State-Changed-Why:  
We've been doing async for a while now.  Bug OBE. 


http://www.freebsd.org/cgi/query-pr.cgi?pr=145395 

From: Alex Bakhtin <alex.bakhtin@gmail.com>
To: bug-followup@freebsd.org, imp@freebsd.org
Cc:  
Subject: Re: misc/145395: [nanobsd] [patch] Extremely slow nanobsd disk image
 creation and 100% disk load on zfs
Date: Wed, 25 May 2011 17:35:50 +0400

 Hello,
 
 
 >From-To:open->closed
 >By:imp When:Fri May 13 13:44:33 MDT 2011
 >Why:We've been doing async for a while now. Bug OBE.
 
    I'm really sorry, but today I have tested the nanobsd.sh from
 9-CURRENT and I'm completely sure that the problem WAS NOT fixed. I
 discovered that building image is still extremelly slow and produces
 great disk load. After checking deeply, I found that image is not
 mounted in async mode.
 
 /dev/md2s1a on /mnt/system/obj/amtkit/_.mnt (ufs, local, soft-updates)
 
    I tried to mout in async manually - and it seems that async option
 is ignored for MD-backed filesystem:
 
 bakhtin@tarzan(14) /mnt/system/nanobsd/amtkit
 > sudo umount /mnt/system/obj/amtkit/_.mnt
 
 bakhtin@tarzan(14) /mnt/system/nanobsd/amtkit
 > sudo mount -o async /dev/md2s1a //mnt/system/obj/amtkit/_.mnt
 
 > mount | grep md
 /dev/md0 on /etc (ufs, local)
 /dev/md1 on /var (ufs, local)
 /dev/md2s1a on /mnt/system/obj/amtkit/_.mnt (ufs, local, soft-updates)
 
 As you can see - md2s1a is not mounted in async mode, and this causes
 extremely bad performance on ZFS.
 
 I'm pretty sure that attaching MD in async mode fixes this problem.
 Please review my patch and this bug.
 
 
 --
 ---
 Alex Bakhtin

From: Alex Bakhtin <alex.bakhtin@gmail.com>
To: bug-followup@freebsd.org, imp@freebsd.org
Cc:  
Subject: Re: misc/145395: [nanobsd] [patch] Extremely slow nanobsd disk image
 creation and 100% disk load on zfs
Date: Wed, 25 May 2011 21:33:23 +0400

 I made some additional performance testing.
 
 Original 9-current nanobsd.sh:
 > sudo ./create.sh
 00:00:00 # NanoBSD image amtkit build starting
 00:00:00 ## Skipping buildworld (as instructed)
 00:00:00 ## Skipping buildkernel (as instructed)
 00:00:00 ## Clean and create world directory (/mnt/system/obj/amtkit/_.w)
 00:00:09 ## Construct install make.conf
 (/mnt/system/obj/amtkit/make.conf.install)
 00:00:09 ## installworld
 00:00:09 ### log: /mnt/system/obj/amtkit/_.iw
 00:02:55 ## install /etc
 00:02:55 ### log: /mnt/system/obj/amtkit/_.etc
 00:02:56 ## configure nanobsd /etc
 00:02:56 ## install kernel (GENERIC_FWD)
 00:02:56 ### log: /mnt/system/obj/amtkit/_.ik
 00:03:00 ## run customize scripts
 00:03:00 ## customize "cust_allow_ssh_root"
 00:03:00 ### log: /mnt/system/obj/amtkit/_.cust.cust_allow_ssh_root
 00:03:00 ## customize "cust_install_files"
 00:03:00 ### log: /mnt/system/obj/amtkit/_.cust.cust_install_files
 00:03:00 ## customize "cust_ld32_cfg"
 00:03:00 ### log: /mnt/system/obj/amtkit/_.cust.cust_ld32_cfg
 00:03:00 ## customize "cust_install_packages"
 00:03:00 ### log: /mnt/system/obj/amtkit/_.cust.cust_install_packages
 00:04:00 ## customize "cust_etc_cfg"
 00:04:00 ### log: /mnt/system/obj/amtkit/_.cust.cust_etc_cfg
 00:04:00 ## configure nanobsd setup
 00:04:00 ### log: /mnt/system/obj/amtkit/_.dl
 00:04:05 ## run late customize scripts
 00:04:05 ## late customize "cust_dir_cfg"
 00:04:05 ### log: /mnt/system/obj/amtkit/_.late_cust.cust_dir_cfg
 00:04:05 ## late customize "copy_sources"
 00:04:05 ### log: /mnt/system/obj/amtkit/_.late_cust.copy_sources
 00:04:57 ## build diskimage
 00:04:57 ### log: /mnt/system/obj/amtkit/_.di
 Gzipping disk image.
 00:41:02 # NanoBSD image amtkit completed
 
 
 The same nanobsd, my patch applied to 9-current nanobsd.sh and NANO_MD_ASYN=
 C=3D1:
 
 00:00:00 # NanoBSD image amtkit build starting
 00:00:00 ## Skipping buildworld (as instructed)
 00:00:00 ## Skipping buildkernel (as instructed)
 00:00:00 ## Clean and create world directory (/mnt/system/obj/amtkit/_.w)
 00:00:18 ## Construct install make.conf
 (/mnt/system/obj/amtkit/make.conf.install)
 00:00:18 ## installworld
 00:00:18 ### log: /mnt/system/obj/amtkit/_.iw
 00:02:26 ## install /etc
 00:02:26 ### log: /mnt/system/obj/amtkit/_.etc
 00:02:28 ## configure nanobsd /etc
 00:02:28 ## install kernel (GENERIC_FWD)
 00:02:28 ### log: /mnt/system/obj/amtkit/_.ik
 00:02:30 ## run customize scripts
 00:02:30 ## customize "cust_allow_ssh_root"
 00:02:30 ### log: /mnt/system/obj/amtkit/_.cust.cust_allow_ssh_root
 00:02:30 ## customize "cust_install_files"
 00:02:30 ### log: /mnt/system/obj/amtkit/_.cust.cust_install_files
 00:02:30 ## customize "cust_ld32_cfg"
 00:02:30 ### log: /mnt/system/obj/amtkit/_.cust.cust_ld32_cfg
 00:02:30 ## customize "cust_install_packages"
 00:02:30 ### log: /mnt/system/obj/amtkit/_.cust.cust_install_packages
 00:03:23 ## customize "cust_etc_cfg"
 00:03:23 ### log: /mnt/system/obj/amtkit/_.cust.cust_etc_cfg
 00:03:23 ## configure nanobsd setup
 00:03:23 ### log: /mnt/system/obj/amtkit/_.dl
 00:03:26 ## run late customize scripts
 00:03:26 ## late customize "cust_dir_cfg"
 00:03:26 ### log: /mnt/system/obj/amtkit/_.late_cust.cust_dir_cfg
 00:03:26 ## late customize "copy_sources"
 00:03:26 ### log: /mnt/system/obj/amtkit/_.late_cust.copy_sources
 00:04:56 ## build diskimage
 00:04:56 ### log: /mnt/system/obj/amtkit/_.di
 Gzipping disk image.
 00:09:34 # NanoBSD image amtkit completed
 
     4.5 minutes to buld and gzip disk image with patched nanobsd.sh
 and 36 minutes to build and gzip disk image with original.
 
 Alex Bakhtin
 
 2011/5/25 Alex Bakhtin <alex.bakhtin@gmail.com>:
 > Hello,
 >
 >
 >>From-To:open->closed
 >>By:imp When:Fri May 13 13:44:33 MDT 2011
 >>Why:We've been doing async for a while now. Bug OBE.
 >
 > =C2=A0 I'm really sorry, but today I have tested the nanobsd.sh from
 > 9-CURRENT and I'm completely sure that the problem WAS NOT fixed. I
 > discovered that building image is still extremelly slow and produces
 > great disk load. After checking deeply, I found that image is not
 > mounted in async mode.
 >
 > /dev/md2s1a on /mnt/system/obj/amtkit/_.mnt (ufs, local, soft-updates)
 >
 > =C2=A0 I tried to mout in async manually - and it seems that async option
 > is ignored for MD-backed filesystem:
 >
 > bakhtin@tarzan(14) /mnt/system/nanobsd/amtkit
 >> sudo umount /mnt/system/obj/amtkit/_.mnt
 >
 > bakhtin@tarzan(14) /mnt/system/nanobsd/amtkit
 >> sudo mount -o async /dev/md2s1a //mnt/system/obj/amtkit/_.mnt
 >
 >> mount | grep md
 > /dev/md0 on /etc (ufs, local)
 > /dev/md1 on /var (ufs, local)
 > /dev/md2s1a on /mnt/system/obj/amtkit/_.mnt (ufs, local, soft-updates)
 >
 > As you can see - md2s1a is not mounted in async mode, and this causes
 > extremely bad performance on ZFS.
 >
 > I'm pretty sure that attaching MD in async mode fixes this problem.
 > Please review my patch and this bug.
 >
 >
 > --
 > ---
 > Alex Bakhtin
 >
 
 
 
 --=20
 ---
 Alex Bakhtin

From: Warner Losh <imp@bsdimp.com>
To: Alex Bakhtin <alex.bakhtin@gmail.com>
Cc: bug-followup@FreeBSD.org, imp@FreeBSD.org
Subject: Re: misc/145395: [nanobsd] [patch] Extremely slow nanobsd disk image creation and 100% disk load on zfs
Date: Wed, 25 May 2011 11:38:46 -0600

 If you are doing soft updates, you can't do async.  They are mutually =
 exclusive.  Soft updates usually are a big win for creation, but might =
 need to be turned off for async operations.
 
 If you have an updated patch against -current, please let me know.
 
 Warner
 
 On May 25, 2011, at 7:35 AM, Alex Bakhtin wrote:
 
 > Hello,
 >=20
 >=20
 >> From-To:open->closed
 >> By:imp When:Fri May 13 13:44:33 MDT 2011
 >> Why:We've been doing async for a while now. Bug OBE.
 >=20
 >   I'm really sorry, but today I have tested the nanobsd.sh from
 > 9-CURRENT and I'm completely sure that the problem WAS NOT fixed. I
 > discovered that building image is still extremelly slow and produces
 > great disk load. After checking deeply, I found that image is not
 > mounted in async mode.
 >=20
 > /dev/md2s1a on /mnt/system/obj/amtkit/_.mnt (ufs, local, soft-updates)
 >=20
 >   I tried to mout in async manually - and it seems that async option
 > is ignored for MD-backed filesystem:
 >=20
 > bakhtin@tarzan(14) /mnt/system/nanobsd/amtkit
 >> sudo umount /mnt/system/obj/amtkit/_.mnt
 >=20
 > bakhtin@tarzan(14) /mnt/system/nanobsd/amtkit
 >> sudo mount -o async /dev/md2s1a //mnt/system/obj/amtkit/_.mnt
 >=20
 >> mount | grep md
 > /dev/md0 on /etc (ufs, local)
 > /dev/md1 on /var (ufs, local)
 > /dev/md2s1a on /mnt/system/obj/amtkit/_.mnt (ufs, local, soft-updates)
 >=20
 > As you can see - md2s1a is not mounted in async mode, and this causes
 > extremely bad performance on ZFS.
 >=20
 > I'm pretty sure that attaching MD in async mode fixes this problem.
 > Please review my patch and this bug.
 >=20
 >=20
 > --
 > ---
 > Alex Bakhtin
 >=20
 >=20
 

From: Warner Losh <imp@bsdimp.com>
To: Alex Bakhtin <alex.bakhtin@gmail.com>
Cc: bug-followup@FreeBSD.org, imp@FreeBSD.org
Subject: Re: misc/145395: [nanobsd] [patch] Extremely slow nanobsd disk image creation and 100% disk load on zfs
Date: Wed, 25 May 2011 11:47:17 -0600

 Can you rebase your changes on the latest nanobsd.sh and resend?
 
 On May 25, 2011, at 11:33 AM, Alex Bakhtin wrote:
 
 > I made some additional performance testing.
 >=20
 > Original 9-current nanobsd.sh:
 >> sudo ./create.sh
 > 00:00:00 # NanoBSD image amtkit build starting
 > 00:00:00 ## Skipping buildworld (as instructed)
 > 00:00:00 ## Skipping buildkernel (as instructed)
 > 00:00:00 ## Clean and create world directory =
 (/mnt/system/obj/amtkit/_.w)
 > 00:00:09 ## Construct install make.conf
 > (/mnt/system/obj/amtkit/make.conf.install)
 > 00:00:09 ## installworld
 > 00:00:09 ### log: /mnt/system/obj/amtkit/_.iw
 > 00:02:55 ## install /etc
 > 00:02:55 ### log: /mnt/system/obj/amtkit/_.etc
 > 00:02:56 ## configure nanobsd /etc
 > 00:02:56 ## install kernel (GENERIC_FWD)
 > 00:02:56 ### log: /mnt/system/obj/amtkit/_.ik
 > 00:03:00 ## run customize scripts
 > 00:03:00 ## customize "cust_allow_ssh_root"
 > 00:03:00 ### log: /mnt/system/obj/amtkit/_.cust.cust_allow_ssh_root
 > 00:03:00 ## customize "cust_install_files"
 > 00:03:00 ### log: /mnt/system/obj/amtkit/_.cust.cust_install_files
 > 00:03:00 ## customize "cust_ld32_cfg"
 > 00:03:00 ### log: /mnt/system/obj/amtkit/_.cust.cust_ld32_cfg
 > 00:03:00 ## customize "cust_install_packages"
 > 00:03:00 ### log: /mnt/system/obj/amtkit/_.cust.cust_install_packages
 > 00:04:00 ## customize "cust_etc_cfg"
 > 00:04:00 ### log: /mnt/system/obj/amtkit/_.cust.cust_etc_cfg
 > 00:04:00 ## configure nanobsd setup
 > 00:04:00 ### log: /mnt/system/obj/amtkit/_.dl
 > 00:04:05 ## run late customize scripts
 > 00:04:05 ## late customize "cust_dir_cfg"
 > 00:04:05 ### log: /mnt/system/obj/amtkit/_.late_cust.cust_dir_cfg
 > 00:04:05 ## late customize "copy_sources"
 > 00:04:05 ### log: /mnt/system/obj/amtkit/_.late_cust.copy_sources
 > 00:04:57 ## build diskimage
 > 00:04:57 ### log: /mnt/system/obj/amtkit/_.di
 > Gzipping disk image.
 > 00:41:02 # NanoBSD image amtkit completed
 >=20
 >=20
 > The same nanobsd, my patch applied to 9-current nanobsd.sh and =
 NANO_MD_ASYNC=3D1:
 >=20
 > 00:00:00 # NanoBSD image amtkit build starting
 > 00:00:00 ## Skipping buildworld (as instructed)
 > 00:00:00 ## Skipping buildkernel (as instructed)
 > 00:00:00 ## Clean and create world directory =
 (/mnt/system/obj/amtkit/_.w)
 > 00:00:18 ## Construct install make.conf
 > (/mnt/system/obj/amtkit/make.conf.install)
 > 00:00:18 ## installworld
 > 00:00:18 ### log: /mnt/system/obj/amtkit/_.iw
 > 00:02:26 ## install /etc
 > 00:02:26 ### log: /mnt/system/obj/amtkit/_.etc
 > 00:02:28 ## configure nanobsd /etc
 > 00:02:28 ## install kernel (GENERIC_FWD)
 > 00:02:28 ### log: /mnt/system/obj/amtkit/_.ik
 > 00:02:30 ## run customize scripts
 > 00:02:30 ## customize "cust_allow_ssh_root"
 > 00:02:30 ### log: /mnt/system/obj/amtkit/_.cust.cust_allow_ssh_root
 > 00:02:30 ## customize "cust_install_files"
 > 00:02:30 ### log: /mnt/system/obj/amtkit/_.cust.cust_install_files
 > 00:02:30 ## customize "cust_ld32_cfg"
 > 00:02:30 ### log: /mnt/system/obj/amtkit/_.cust.cust_ld32_cfg
 > 00:02:30 ## customize "cust_install_packages"
 > 00:02:30 ### log: /mnt/system/obj/amtkit/_.cust.cust_install_packages
 > 00:03:23 ## customize "cust_etc_cfg"
 > 00:03:23 ### log: /mnt/system/obj/amtkit/_.cust.cust_etc_cfg
 > 00:03:23 ## configure nanobsd setup
 > 00:03:23 ### log: /mnt/system/obj/amtkit/_.dl
 > 00:03:26 ## run late customize scripts
 > 00:03:26 ## late customize "cust_dir_cfg"
 > 00:03:26 ### log: /mnt/system/obj/amtkit/_.late_cust.cust_dir_cfg
 > 00:03:26 ## late customize "copy_sources"
 > 00:03:26 ### log: /mnt/system/obj/amtkit/_.late_cust.copy_sources
 > 00:04:56 ## build diskimage
 > 00:04:56 ### log: /mnt/system/obj/amtkit/_.di
 > Gzipping disk image.
 > 00:09:34 # NanoBSD image amtkit completed
 >=20
 >    4.5 minutes to buld and gzip disk image with patched nanobsd.sh
 > and 36 minutes to build and gzip disk image with original.
 >=20
 > Alex Bakhtin
 >=20
 > 2011/5/25 Alex Bakhtin <alex.bakhtin@gmail.com>:
 >> Hello,
 >>=20
 >>=20
 >>> From-To:open->closed
 >>> By:imp When:Fri May 13 13:44:33 MDT 2011
 >>> Why:We've been doing async for a while now. Bug OBE.
 >>=20
 >>   I'm really sorry, but today I have tested the nanobsd.sh from
 >> 9-CURRENT and I'm completely sure that the problem WAS NOT fixed. I
 >> discovered that building image is still extremelly slow and produces
 >> great disk load. After checking deeply, I found that image is not
 >> mounted in async mode.
 >>=20
 >> /dev/md2s1a on /mnt/system/obj/amtkit/_.mnt (ufs, local, =
 soft-updates)
 >>=20
 >>   I tried to mout in async manually - and it seems that async option
 >> is ignored for MD-backed filesystem:
 >>=20
 >> bakhtin@tarzan(14) /mnt/system/nanobsd/amtkit
 >>> sudo umount /mnt/system/obj/amtkit/_.mnt
 >>=20
 >> bakhtin@tarzan(14) /mnt/system/nanobsd/amtkit
 >>> sudo mount -o async /dev/md2s1a //mnt/system/obj/amtkit/_.mnt
 >>=20
 >>> mount | grep md
 >> /dev/md0 on /etc (ufs, local)
 >> /dev/md1 on /var (ufs, local)
 >> /dev/md2s1a on /mnt/system/obj/amtkit/_.mnt (ufs, local, =
 soft-updates)
 >>=20
 >> As you can see - md2s1a is not mounted in async mode, and this causes
 >> extremely bad performance on ZFS.
 >>=20
 >> I'm pretty sure that attaching MD in async mode fixes this problem.
 >> Please review my patch and this bug.
 >>=20
 >>=20
 >> --
 >> ---
 >> Alex Bakhtin
 >>=20
 >=20
 >=20
 >=20
 > --=20
 > ---
 > Alex Bakhtin
 >=20
 >=20
 

From: Alex Bakhtin <alex.bakhtin@gmail.com>
To: Warner Losh <imp@bsdimp.com>, bug-followup@freebsd.org
Cc:  
Subject: Re: misc/145395: [nanobsd] [patch] Extremely slow nanobsd disk image
 creation and 100% disk load on zfs
Date: Thu, 26 May 2011 00:08:25 +0400

 --000e0cd22f5e95771b04a41f45de
 Content-Type: text/plain; charset=UTF-8
 Content-Transfer-Encoding: quoted-printable
 
 Warner,
 
     I tested it against head, attached.
 
 {bakhtin_nb_fbsd}/mnt/home/bakhtin/work/nanobsd/head>svn info
 Path: .
 URL: http://svn.freebsd.org/base/head/tools/tools/nanobsd
 Repository Root: http://svn.freebsd.org/base
 Repository UUID: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
 Revision: 222287
 Node Kind: directory
 Schedule: normal
 Last Changed Author: imp
 Last Changed Rev: 221877
 Last Changed Date: 2011-05-14 08:32:30 +0400 (=D1=81=D0=B1, 14 =D0=BC=D0=B0=
 =D0=B9 2011)
 
 
 
 2011/5/25 Warner Losh <imp@bsdimp.com>:
 > Can you rebase your changes on the latest nanobsd.sh and resend?
 >
 
 
 -----
 Alex Bakhtin
 
 --000e0cd22f5e95771b04a41f45de
 Content-Type: text/plain; charset=US-ASCII; name="nanobsd_async_head.patch.txt"
 Content-Disposition: attachment; filename="nanobsd_async_head.patch.txt"
 Content-Transfer-Encoding: base64
 X-Attachment-Id: f_go4pfioq0
 
 SW5kZXg6IG5hbm9ic2Quc2gKPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
 PT09PT09PT09PT09PT09PT09PT09PT09PT09PQotLS0gbmFub2JzZC5zaAkocmV2aXNpb24gMjIy
 Mjg3KQorKysgbmFub2JzZC5zaAkod29ya2luZyBjb3B5KQpAQCAtMTM1LDYgKzEzNSwxMCBAQAog
 IyBDYW4gYmUgImZpbGUiIG9yICJzd2FwIgogTkFOT19NRF9CQUNLSU5HPSJmaWxlIgogCisjIDAg
 LT4gVXNlIGRlZmF1bHQgb3B0aW9ucyBmb3IgbWRjb25maWcKKyMgMSAtPiBVc2UgLW8gYXN5bmMg
 b3B0aW9uIGZvciBtZGNvbmZpZyAoaW1wcm92ZSBwZXJmb3JtYW5jZSBvbiB6ZnMpCitOQU5PX01E
 X0FTWU5DPTAKKwogIyBQcm9ncmVzcyBQcmludCBsZXZlbAogUFBMRVZFTD0zCiAKQEAgLTUwOCw2
 ICs1MTIsMTEgQEAKIAlNTlQ9JHtOQU5PX09CSn0vXy5tbnQKIAlta2RpciAtcCAke01OVH0KIAor
 CV9OQU5PX01EQ09ORklHX09QVElP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