Bug 161897

Summary: [zfs] [patch] zfs partition probing causing long delay at BTX loader
Product: Base System Reporter: Steven Hartland <steven.hartland>
Component: kernAssignee: Andrey V. Elsukov <ae>
Status: Closed FIXED    
Severity: Affects Only Me Flags: bugmeister: mfc-stable10?
bugmeister: mfc-stable9?
bugmeister: mfc-stable8?
Priority: Normal    
Version: 8.2-RELEASE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Steven Hartland freebsd_committer freebsd_triage 2011-10-22 14:10:09 UTC
Installing a new machine here which has 10+ disks
we're seeing BTX loader take 50+ seconds to enumerate
the disks.

After doing some digging I found the following thread
on the forums which hinted that r198420 maybe the
cause.
http://forums.freebsd.org/showthread.php?t=12705

A quick change to zfs.c reverting the change to
support 128 partitions back to 4 and BTX completes
instantly like it used to.

svn commit which introduced this delay is:-
http://svnweb.freebsd.org/base?view=revision&revision=198420

the specific file in that changeset:-
http://svnweb.freebsd.org/base/head/sys/boot/zfs/zfs.c?r1=198420&r2=198419&pathrev=198420

So the questions are:-

1. Can this be optimised so it doesn't have to test all
of the possible 128 GPT partitions?

2. If a optimisation isn't possible or is too complex to
achieve would it be better to have the partitions defined
as an option which can be increased if needed as I suspect
99.99% if not 100% of users won't be making use of more
than 4 partitions even with GPT, such as what the attached
patch against 8.2-RELEASE achieves.

Fix: Reduce the number of probed partitions from the GPT max of 128 back to the MBR max of 4 "by default" as done by the attached patch.

Patch attached with submission follows:
How-To-Repeat: Boot a machine with a large number of disks attached using zfs
Comment 1 Nali Toja 2011-10-22 14:53:23 UTC
Steven Hartland <steven.hartland@FreeBSD.org> writes:

>>Description:
> Installing a new machine here which has 10+ disks
> we're seeing BTX loader take 50+ seconds to enumerate
> the disks.
>
> After doing some digging I found the following thread
> on the forums which hinted that r198420 maybe the
> cause.
> http://forums.freebsd.org/showthread.php?t=12705
[...]

It was later reported in bin/148296 with a bit different fix and then
closed for an unrelated reason[1].

[1] http://docs.freebsd.org/cgi/mid.cgi?alpine.BSF.2.00.1109160414460.24280
Comment 2 Mark Linimon freebsd_committer freebsd_triage 2011-10-22 17:05:13 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-fs

Over to maintainer(s).
Comment 3 Steven Hartland & 2012-02-07 09:26:07 UTC
Any update on this?
Comment 4 Andrey V. Elsukov freebsd_committer freebsd_triage 2012-08-06 04:59:23 UTC
State Changed
From-To: open->patched

Patched in head/ with r239068.
Comment 5 Andrey V. Elsukov freebsd_committer freebsd_triage 2012-11-19 13:14:00 UTC
Responsible Changed
From-To: freebsd-fs->ae

Take it.
Comment 6 Andrey V. Elsukov freebsd_committer freebsd_triage 2015-06-02 02:19:32 UTC
This should be fixed in head/, stable/10 and stable/9. But it won't be MFCed to stable/8. Sorry.