[oe-commits] [openembedded-core] 11/13: initscripts: read-only-rootfs-hook: Use overlay if available
git at git.openembedded.org
git at git.openembedded.org
Thu Oct 11 22:23:34 UTC 2018
This is an automated email from the git hooks/post-receive script.
rpurdie pushed a commit to branch master-next
in repository openembedded-core.
commit 1fbb08deb9e32d70be5272390ef7a75368579eba
Author: Joshua Watt <jpewhacker at gmail.com>
AuthorDate: Thu Oct 11 13:09:04 2018 -0500
initscripts: read-only-rootfs-hook: Use overlay if available
Copying files from the read-only /var/lib to tmpfs can be slow and waste
memory. If the kernel supports the overlay file system, use it to mount
a writable tmpfs on top of the read-only /var/lib and avoid the file
copy.
Signed-off-by: Joshua Watt <JPEWhacker at gmail.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
.../initscripts/initscripts-1.0/read-only-rootfs-hook.sh | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh b/meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh
index 1a0328d..bd445dd 100644
--- a/meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh
+++ b/meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh
@@ -31,8 +31,13 @@ if [ "$1" = "start" ] ; then
if [ `is_on_read_only_partition /var/lib` = "yes" ]; then
grep -q "tmpfs /var/volatile" /proc/mounts || mount /var/volatile
mkdir -p /var/volatile/lib
- cp -a /var/lib/* /var/volatile/lib
- mount --bind /var/volatile/lib /var/lib
+ mkdir -p /var/volatile/.lib-work
+ # Try to mount using overlay, which is much faster than copying
+ # files. If that fails, fallback to the slower copy
+ if ! mount -t overlay overlay -olowerdir=/var/lib,upperdir=/var/volatile/lib,workdir=/var/volatile/.lib-work /var/lib > /dev/null 2>&1; then
+ cp -a /var/lib/* /var/volatile/lib
+ mount --bind /var/volatile/lib /var/lib
+ fi
fi
fi
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Openembedded-commits
mailing list