Gentoo Archives: gentoo-commits

From: "Robin H. Johnson" <robbat2@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/genkernel:master commit in: doc/, defaults/
Date: Tue, 12 Jun 2018 21:26:25
Message-Id: 1528264955.5c5c32aa7261a29a3ac48035086bb59449d3804d.robbat2@gentoo
1 commit: 5c5c32aa7261a29a3ac48035086bb59449d3804d
2 Author: Georgy Yakovlev <ya <AT> sysdump <DOT> net>
3 AuthorDate: Wed Jun 6 02:33:07 2018 +0000
4 Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
5 CommitDate: Wed Jun 6 06:02:35 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=5c5c32aa
7
8 Add option to force importing zpool using cache
9
10 Add simple option to pass to kernel via loader.
11
12 dozfs=cache will use /etc/zfs/zpool.cache
13 avoiding 30+ second wait for udev in zpool import
14
15 Also it's possible to use both cache and force
16 at the same time:
17 dozfs=force,cache (order is not important) will
18 force import and use cache.
19
20 Closes: https://bugs.gentoo.org/627320
21 Signed-off-by: Georgy Yakovlev <ya <AT> sysdump.net>
22
23 defaults/initrd.scripts | 6 +++---
24 defaults/linuxrc | 19 +++++++++++++++----
25 doc/genkernel.8.txt | 6 +++---
26 3 files changed, 21 insertions(+), 10 deletions(-)
27
28 diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
29 index 2fb0eb4..f8f9825 100644
30 --- a/defaults/initrd.scripts
31 +++ b/defaults/initrd.scripts
32 @@ -1181,7 +1181,7 @@ startVolumes() {
33 then
34 good_msg "Importing ZFS pools"
35
36 - /sbin/zpool import -N -a ${ZPOOL_FORCE}
37 + /sbin/zpool import -N -a ${ZPOOL_CACHE} ${ZPOOL_FORCE}
38
39 if [ "$?" = '0' ]
40 then
41 @@ -1199,12 +1199,12 @@ startVolumes() {
42 then
43 good_msg "LUKS detected. Reimporting ${ZFS_POOL}"
44 /sbin/zpool export -f "${ZFS_POOL}"
45 - /sbin/zpool import -N ${ZPOOL_FORCE} "${ZFS_POOL}"
46 + /sbin/zpool import -N ${ZPOOL_CACHE} ${ZPOOL_FORCE} "${ZFS_POOL}"
47 fi
48 else
49 good_msg "Importing ZFS pool ${ZFS_POOL}"
50
51 - /sbin/zpool import -N ${ZPOOL_FORCE} "${ZFS_POOL}"
52 + /sbin/zpool import -N ${ZPOOL_CACHE} ${ZPOOL_FORCE} "${ZFS_POOL}"
53
54 if [ "$?" = '0' ]
55 then
56
57 diff --git a/defaults/linuxrc b/defaults/linuxrc
58 index d58ef06..81e7799 100644
59 --- a/defaults/linuxrc
60 +++ b/defaults/linuxrc
61 @@ -111,10 +111,21 @@ do
62 dozfs*)
63 USE_ZFS=1
64
65 - if [ "${x#*=}" = 'force' ]
66 - then
67 - ZPOOL_FORCE=-f
68 - fi
69 + case "${x#*=}" in
70 + *force*)
71 + ZPOOL_FORCE=-f
72 + ;;
73 + esac
74 +
75 + case "${x#*=}" in
76 + *cache*)
77 + if [ -s "/etc/zfs/zpool.cache" ]; then
78 + ZPOOL_CACHE="-c /etc/zfs/zpool.cache"
79 + else
80 + bad_msg "zpool.cache not found or empty, zpool import will be slow"
81 + fi
82 + ;;
83 + esac
84 ;;
85 dobtrfs*)
86 USE_BTRFS=1
87
88 diff --git a/doc/genkernel.8.txt b/doc/genkernel.8.txt
89 index 908212e..ca84816 100644
90 --- a/doc/genkernel.8.txt
91 +++ b/doc/genkernel.8.txt
92 @@ -522,9 +522,9 @@ recognized by the kernel itself.
93 *domdadm*::
94 Scan for RAID arrays on bootup
95
96 -*dozfs*[=force]::
97 - Scan for bootable ZFS pools on bootup. Optionally force import if
98 - necessary.
99 +*dozfs*[=cache,force]::
100 + Scan for bootable ZFS pools on bootup. Optionally use cachefile or force import if
101 + necessary or perform both actions.
102
103 *dobtrfs*::
104 Scan for attached Btrfs devices on bootup.