Patchwork [v2,02/12] udev-cache: Compress the cache

login
register
mail settings
Submitter Richard Tollerton
Date Aug. 22, 2014, 9:30 p.m.
Message ID <72aeff0a55225db7ce2cab97b1780a47302f06af.1408742574.git.rich.tollerton@ni.com>
Download mbox | patch
Permalink /patch/78833/
State Accepted
Commit 8c423bf995dc829c4bbb286e5f1c020fc053e6fc
Headers show

Comments

Richard Tollerton - Aug. 22, 2014, 9:30 p.m.
$DEVCACHE is observed to be 100k uncompressed; compressing it reduces
its size to ~5k. But compress it outside of `tar` so that archival
operation takes as little time as possible, to minimize the risk of
devices being created/removed during execution.

Signed-off-by: Richard Tollerton <rich.tollerton@ni.com>
---
 meta/recipes-core/udev/udev/udev-cache         | 3 ++-
 meta/recipes-core/udev/udev/udev-cache.default | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

Patch

diff --git a/meta/recipes-core/udev/udev/udev-cache b/meta/recipes-core/udev/udev/udev-cache
index c08cef2..ec07f50 100644
--- a/meta/recipes-core/udev/udev/udev-cache
+++ b/meta/recipes-core/udev/udev/udev-cache
@@ -27,7 +27,8 @@  fi
 if [ "$DEVCACHE" != "" -a -e /dev/shm/udev.cache ]; then
 	echo "Populating dev cache"
 	(cd /; tar cf "${DEVCACHE_TMP}" dev)
-	mv -f "${DEVCACHE_TMP}" "$DEVCACHE"
+	gzip < "${DEVCACHE_TMP}" > "$DEVCACHE"
+	rm -f "${DEVCACHE_TMP}"
 	mv /dev/shm/udev.cache /etc/udev/cache.data
 fi
 
diff --git a/meta/recipes-core/udev/udev/udev-cache.default b/meta/recipes-core/udev/udev/udev-cache.default
index 2093336..909ec87 100644
--- a/meta/recipes-core/udev/udev/udev-cache.default
+++ b/meta/recipes-core/udev/udev/udev-cache.default
@@ -1,5 +1,5 @@ 
 # Default for /etc/init.d/udev
 
 # Comment this out to disable device cache
-DEVCACHE="/etc/dev.tar"
+DEVCACHE="/etc/dev.tar.gz"
 PROBE_PLATFORM_BUS="yes"