From 6daf036ab5065120888308e8e7505229ebfd4aee Mon Sep 17 00:00:00 2001 From: Ryan Moeller <ryan@iXsystems.com> Date: Fri, 13 Aug 2021 16:37:46 -0400 Subject: [PATCH] Add zfs.sh -r flag to reload modules zfs.sh already can load and unload, so why not both? This is convenient when developing changes to the module and you want to rapidly make some changes, rebuild the module, reload the module, and test the changes. Reviewed-by: George Melikov <mail@gmelikov.ru> Reviewed-by: Tony Hutter <hutter2@llnl.gov> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ryan Moeller <ryan@iXsystems.com> Closes #12450 --- scripts/zfs.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/scripts/zfs.sh b/scripts/zfs.sh index 39c49d71e5..7870b8930c 100755 --- a/scripts/zfs.sh +++ b/scripts/zfs.sh @@ -14,6 +14,7 @@ fi PROG=zfs.sh VERBOSE="no" UNLOAD="no" +LOAD="yes" STACK_TRACER="no" ZED_PIDFILE=${ZED_PIDFILE:-/var/run/zed.pid} @@ -44,12 +45,13 @@ DESCRIPTION: OPTIONS: -h Show this message -v Verbose + -r Reload modules -u Unload modules -S Enable kernel stack tracer EOF } -while getopts 'hvuS' OPTION; do +while getopts 'hvruS' OPTION; do case $OPTION in h) usage @@ -58,8 +60,13 @@ while getopts 'hvuS' OPTION; do v) VERBOSE="yes" ;; + r) + UNLOAD="yes" + LOAD="yes" + ;; u) UNLOAD="yes" + LOAD="no" ;; S) STACK_TRACER="yes" @@ -262,7 +269,8 @@ if [ "$UNLOAD" = "yes" ]; then unload_modules_linux ;; esac -else +fi +if [ "$LOAD" = "yes" ]; then case $UNAME in FreeBSD) load_modules_freebsd