summaryrefslogtreecommitdiffstats
path: root/Tools/portbuild
diff options
context:
space:
mode:
authorkris <kris@FreeBSD.org>2005-10-11 03:52:37 +0000
committerkris <kris@FreeBSD.org>2005-10-11 03:52:37 +0000
commite028d879e5fa9326f62de77de080d9b2a771a98d (patch)
treed0694885013373b4f754bec8bfa70b46369c7a66 /Tools/portbuild
parent875604970091794edd7a9ba0a606fc8d3b2e340d (diff)
downloadFreeBSD-ports-e028d879e5fa9326f62de77de080d9b2a771a98d.zip
FreeBSD-ports-e028d879e5fa9326f62de77de080d9b2a771a98d.tar.gz
Add support for use_md_swap. When this variable is set in a
portbuild.conf, builds will each be done in a separate swap-backed md. This dramatically improves build performance since * Every transaction is not written to disk, so disk bandwidth is not a bottleneck * Multiple builds do not contend with each other for the same set of filesystem locks and other per-device resources The size of the md devices is controlled by the md_size variable. '2g' seems to be a good size. Currently we mdconfig -u each device after each port build, since otherwise dirty blocks accumulate and the md eventually uses a full amount of backing store (2g in the above example). This is a problem if there is unsufficient swap backing to accomodate them all. XXX This should be made configurable to avoid the performance penalty on systems that do have enough swap backing
Diffstat (limited to 'Tools/portbuild')
-rwxr-xr-xTools/portbuild/scripts/claim-chroot22
1 files changed, 18 insertions, 4 deletions
diff --git a/Tools/portbuild/scripts/claim-chroot b/Tools/portbuild/scripts/claim-chroot
index 3fd4a70..c03283f 100755
--- a/Tools/portbuild/scripts/claim-chroot
+++ b/Tools/portbuild/scripts/claim-chroot
@@ -40,10 +40,24 @@ done
chrootnum=$$
# If we didn't find a pre-existing directory, create and claim a new one.
while [ ${found} != 1 ]; do
- chrootnum=$(($chrootnum+1))
- chroot=${chrootdir}/${chrootnum}
- mkdir -p ${chroot} 2>/dev/null || continue
- mkdir ${chroot}/used 2>/dev/null || continue
+ if [ "${use_md_swap}" = "1" ]; then
+ unit=$(mdconfig -a -t swap -s ${md_size})
+ newfs /dev/${unit} > /dev/null
+ chrootnum=$(echo ${unit} | sed 's,md,,')
+ chroot=${chrootdir}/${chrootnum}
+ mkdir -p ${chroot}/used 2>/dev/null || continue
+ # Need to make sure that used/ is also present after mounting the fresh md so as to not leave open any races
+ mount /dev/${unit} ${chroot}/used
+ mkdir ${chroot}/used/used
+ touch ${chroot}/used/used/${pkgname}
+ umount ${chroot}/used
+ mount /dev/${unit} ${chroot}/
+ else
+ chrootnum=$(($chrootnum+1))
+ chroot=${chrootdir}/${chrootnum}
+ mkdir -p ${chroot} 2>/dev/null || continue
+ mkdir ${chroot}/used 2>/dev/null || continue
+ fi
touch ${chroot}/used/${pkgname}
touch ${chroot}/.notready
found=1
OpenPOWER on IntegriCloud