public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Robin H. Johnson" <robbat2@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/genkernel:master commit in: doc/, defaults/
Date: Tue, 12 Jun 2018 21:26:20 +0000 (UTC)	[thread overview]
Message-ID: <1528264955.5c5c32aa7261a29a3ac48035086bb59449d3804d.robbat2@gentoo> (raw)

commit:     5c5c32aa7261a29a3ac48035086bb59449d3804d
Author:     Georgy Yakovlev <ya <AT> sysdump <DOT> net>
AuthorDate: Wed Jun  6 02:33:07 2018 +0000
Commit:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Wed Jun  6 06:02:35 2018 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=5c5c32aa

Add option to force importing zpool using cache

Add simple option to pass to kernel via loader.

dozfs=cache will use /etc/zfs/zpool.cache
avoiding 30+ second wait for udev in zpool import

Also it's possible to use both cache and force
at the same time:
dozfs=force,cache (order is not important) will
force import and use cache.

Closes: https://bugs.gentoo.org/627320
Signed-off-by: Georgy Yakovlev <ya <AT> sysdump.net>

 defaults/initrd.scripts |  6 +++---
 defaults/linuxrc        | 19 +++++++++++++++----
 doc/genkernel.8.txt     |  6 +++---
 3 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
index 2fb0eb4..f8f9825 100644
--- a/defaults/initrd.scripts
+++ b/defaults/initrd.scripts
@@ -1181,7 +1181,7 @@ startVolumes() {
 		then
 			good_msg "Importing ZFS pools"
 
-			/sbin/zpool import -N -a ${ZPOOL_FORCE}
+			/sbin/zpool import -N -a ${ZPOOL_CACHE} ${ZPOOL_FORCE}
 
 			if [ "$?" = '0' ]
 			then
@@ -1199,12 +1199,12 @@ startVolumes() {
 				then
 					good_msg "LUKS detected. Reimporting ${ZFS_POOL}"
 					/sbin/zpool export -f "${ZFS_POOL}"
-					/sbin/zpool import -N ${ZPOOL_FORCE} "${ZFS_POOL}"
+					/sbin/zpool import -N ${ZPOOL_CACHE} ${ZPOOL_FORCE} "${ZFS_POOL}"
 				fi
 			else
 				good_msg "Importing ZFS pool ${ZFS_POOL}"
 
-				/sbin/zpool import -N ${ZPOOL_FORCE} "${ZFS_POOL}"
+				/sbin/zpool import -N ${ZPOOL_CACHE} ${ZPOOL_FORCE} "${ZFS_POOL}"
 
 				if [ "$?" = '0' ]
 				then

diff --git a/defaults/linuxrc b/defaults/linuxrc
index d58ef06..81e7799 100644
--- a/defaults/linuxrc
+++ b/defaults/linuxrc
@@ -111,10 +111,21 @@ do
 		dozfs*)
 			USE_ZFS=1
 
-			if [ "${x#*=}" = 'force' ]
-			then
-				ZPOOL_FORCE=-f
-			fi
+			case "${x#*=}" in
+				*force*)
+					ZPOOL_FORCE=-f
+				;;
+			esac
+
+			case "${x#*=}" in
+				*cache*)
+					if [ -s "/etc/zfs/zpool.cache" ]; then
+						ZPOOL_CACHE="-c /etc/zfs/zpool.cache"
+					else
+						bad_msg "zpool.cache not found or empty, zpool import will be slow"
+					fi
+				;;
+			esac
 		;;
 		dobtrfs*)
 			USE_BTRFS=1

diff --git a/doc/genkernel.8.txt b/doc/genkernel.8.txt
index 908212e..ca84816 100644
--- a/doc/genkernel.8.txt
+++ b/doc/genkernel.8.txt
@@ -522,9 +522,9 @@ recognized by the kernel itself.
 *domdadm*::
     Scan for RAID arrays on bootup
 
-*dozfs*[=force]::
-    Scan for bootable ZFS pools on bootup. Optionally force import if
-    necessary.
+*dozfs*[=cache,force]::
+    Scan for bootable ZFS pools on bootup. Optionally use cachefile or force import if
+    necessary or perform both actions.
 
 *dobtrfs*::
     Scan for attached Btrfs devices on bootup.


             reply	other threads:[~2018-06-12 21:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-12 21:26 Robin H. Johnson [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-03-14 20:05 [gentoo-commits] proj/genkernel:master commit in: doc/, defaults/ Thomas Deutschmann
2021-03-14 20:05 Thomas Deutschmann
2020-01-29 22:28 Thomas Deutschmann
2020-01-14  1:36 Thomas Deutschmann
2019-07-18 20:15 Thomas Deutschmann
2016-05-16  6:55 Robin H. Johnson
2013-04-29  8:56 Fabio Erculiani
2013-04-25  6:22 Fabio Erculiani
2013-03-31 12:47 Peter Hjalmarsson
2012-11-20  0:59 Robin H. Johnson
2012-01-05 16:51 Sebastian Pipping

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1528264955.5c5c32aa7261a29a3ac48035086bb59449d3804d.robbat2@gentoo \
    --to=robbat2@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox