public inbox for ipfire-scm@lists.ipfire.org
 help / color / mirror / Atom feed
From: Michael Tremer <git@ipfire.org>
To: ipfire-scm@lists.ipfire.org
Subject: [git.ipfire.org] IPFire 2.x development tree branch, next, updated. 6174b7b1c72cd5141e04ac2621eef90d86987a91
Date: Sun, 16 Dec 2018 16:52:34 +0000	[thread overview]
Message-ID: <20181216165234.E8BBA84FDD3@people01.i.ipfire.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 3791 bytes --]

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "IPFire 2.x development tree".

The branch, next has been updated
       via  6174b7b1c72cd5141e04ac2621eef90d86987a91 (commit)
      from  53ac9dd222aac232b35d0c1ce453eaf4cacc3419 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 6174b7b1c72cd5141e04ac2621eef90d86987a91
Author: Michael Tremer <michael.tremer(a)ipfire.org>
Date:   Sun Dec 16 16:50:13 2018 +0000

    make.sh: Build in ramdisk
    
    This is an experimental change that I want to trial to speed up
    the nightly builds. The build environment will be mounted in a
    ramdisk and the build will be performed in there.
    
    This will hopefully reduce IO on the (slow) replicated disks.
    
    If there is no significant performance gain from this, this
    commit will be reverted.
    
    To enable this, USE_RAMDISK must be set to 1 in .config.
    
    Signed-off-by: Michael Tremer <michael.tremer(a)ipfire.org>

-----------------------------------------------------------------------

Summary of changes:
 make.sh | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 68 insertions(+)

Difference in files:
diff --git a/make.sh b/make.sh
index fd626a999..fb529b669 100755
--- a/make.sh
+++ b/make.sh
@@ -290,6 +290,9 @@ stdumount() {
 	umount $BASEDIR/build/usr/src/lfs		2>/dev/null;
 	umount $BASEDIR/build/usr/src/log		2>/dev/null;
 	umount $BASEDIR/build/usr/src/src		2>/dev/null;
+
+	# Umount ramdisk
+	ramdisk_save "${BASEDIR}/build"
 }
 
 now() {
@@ -423,6 +426,68 @@ exiterror() {
 	exit 1
 }
 
+ramdisk_save() {
+	local path="${1}"
+
+	# Check if the ramdisk is actually mounted
+	if ! mountpoint "${path}" &>/dev/null; then
+		return 1
+	fi
+
+	# Remove the bind-mount
+	umount "${path}"
+
+	echo -n "Saving ramdisk (this might take a moment)..."
+
+	# Copy all data
+	mkdir -p "${path}.tmpfs"
+	if ! rsync -aHAXq --delete "${path}.tmpfs/" "${path}/"; then
+		print_status FAIL
+		return 1
+	fi
+
+	# Umount ramdisk
+	umount "${path}.tmpfs"
+	rm -rf "${path}.tmpfs"
+
+	print_status DONE
+}
+
+ramdisk_restore() {
+	local path="${1}"
+
+	# Don't do anything if ramdisk support isn't enabled
+	if [ "${USE_RAMDISK}" != "1" ]; then
+		return 1
+	fi
+
+	# Check for sufficient memory
+	# XXX TODO
+
+	echo -n "Restoring ramdisk (this might take a moment)..."
+
+	# Mount new ramdisk
+	mkdir -p "${path}.tmpfs"
+	if ! mount -t tmpfs none "${path}.tmpfs"; then
+		exiterror "Could not mount ramdisk"
+	fi
+
+	# Restore all data
+	if ! rsync -aHAXq --delete "${path}/" "${path}.tmpfs/"; then
+		umount "${path}.tmpfs"
+		rm -rf "${path}.tmpfs"
+
+		exiterror "Could not restore ramdisk"
+	fi
+
+	# Overlay the files on disk
+	# We would use "mount --move ..." but systemd is always
+	# mounting / as shared which doesn't allow moving anything
+	mount --bind "${path}.tmpfs" "${path}"
+
+	print_status DONE
+}
+
 prepareenv() {
 	# Are we running the right shell?
 	if [ -z "${BASH}" ]; then
@@ -472,6 +537,9 @@ prepareenv() {
 	export LFS LC_ALL CFLAGS CXXFLAGS MAKETUNING
 	unset CC CXX CPP LD_LIBRARY_PATH LD_PRELOAD
 
+	# Mount ramdisk (if requested)
+	ramdisk_restore "${BASEDIR}/build"
+
 	# Make some extra directories
 	mkdir -p "${BASEDIR}/build${TOOLS_DIR}" 2>/dev/null
 	mkdir -p $BASEDIR/build/{etc,usr/src} 2>/dev/null


hooks/post-receive
--
IPFire 2.x development tree

                 reply	other threads:[~2018-12-16 16:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181216165234.E8BBA84FDD3@people01.i.ipfire.org \
    --to=git@ipfire.org \
    --cc=ipfire-scm@lists.ipfire.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox