From acc4c9b3fc8cfac4a5306ec07bdb705395bdfc39 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Thu, 15 Sep 2011 18:06:25 -0400 Subject: [PATCH] cros_sdk: optimize fuse loading Running `sudo` at all is a bit poky, so let's avoid modprobing fuse when we know it already exists because it's listed in /proc/filesystems. The relative speed: time sudo modprobe fuse -> 0.164s time grep -q fuse /proc/filesystems -> 0.002s BUG=None TEST=enable `set -x`; run `sudo modprobe fuse`; run `cros_sdk true`; see modprobe skipped Change-Id: I07213e7b0607ca65df2a8a3ae22eb4a49c8bb888 Reviewed-on: http://gerrit.chromium.org/gerrit/7824 Commit-Ready: Mike Frysinger Reviewed-by: Mike Frysinger Tested-by: Mike Frysinger --- sdk_lib/enter_chroot.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sdk_lib/enter_chroot.sh b/sdk_lib/enter_chroot.sh index 6dd210a65e..a9d12c3f71 100755 --- a/sdk_lib/enter_chroot.sh +++ b/sdk_lib/enter_chroot.sh @@ -273,8 +273,9 @@ function setup_env { fi fi - # Install fuse module. - if [ -c "${FUSE_DEVICE}" ]; then + # Install fuse module. Skip modprobe when possible for slight + # speed increase when initializing the env. + if [ -c "${FUSE_DEVICE}" ] && ! grep -q fuse /proc/filesystems; then sudo modprobe fuse 2> /dev/null ||\ warn "-- Note: modprobe fuse failed. gmergefs will not work" fi