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
This commit is contained in:
Ryan Moeller 2021-08-13 16:37:46 -04:00 committed by Tony Hutter
parent cc55271681
commit cacc48702b
1 changed files with 10 additions and 2 deletions

View File

@ -14,6 +14,7 @@ fi
PROG=zfs.sh PROG=zfs.sh
VERBOSE="no" VERBOSE="no"
UNLOAD="no" UNLOAD="no"
LOAD="yes"
STACK_TRACER="no" STACK_TRACER="no"
ZED_PIDFILE=${ZED_PIDFILE:-/var/run/zed.pid} ZED_PIDFILE=${ZED_PIDFILE:-/var/run/zed.pid}
@ -44,12 +45,13 @@ DESCRIPTION:
OPTIONS: OPTIONS:
-h Show this message -h Show this message
-v Verbose -v Verbose
-r Reload modules
-u Unload modules -u Unload modules
-S Enable kernel stack tracer -S Enable kernel stack tracer
EOF EOF
} }
while getopts 'hvuS' OPTION; do while getopts 'hvruS' OPTION; do
case $OPTION in case $OPTION in
h) h)
usage usage
@ -58,8 +60,13 @@ while getopts 'hvuS' OPTION; do
v) v)
VERBOSE="yes" VERBOSE="yes"
;; ;;
r)
UNLOAD="yes"
LOAD="yes"
;;
u) u)
UNLOAD="yes" UNLOAD="yes"
LOAD="no"
;; ;;
S) S)
STACK_TRACER="yes" STACK_TRACER="yes"
@ -262,7 +269,8 @@ if [ "$UNLOAD" = "yes" ]; then
unload_modules_linux unload_modules_linux
;; ;;
esac esac
else fi
if [ "$LOAD" = "yes" ]; then
case $UNAME in case $UNAME in
FreeBSD) FreeBSD)
load_modules_freebsd load_modules_freebsd