opnsense-src/sys/boot/i386
Peter Wemm 99cbd70f0b The read-ahead code from r298230 made it likely the boot code would read
beyond the end of disk. r298900 added code to prevent this.  Some BIOSes
cause significant delays if asked to read past end-of-disk.

We never trusted the BIOS to accurately report the sectorsize of disks
before and this set of changes.  Unfortuately they interact badly with
the infamous >2TB wraparound bugs.  We have a number of relatively-recent
machines in the FreeBSD.org cluster where the BIOS reports 3TB disks as 1TB.

With pre-r298900 they work just fine.  After r298900 they stop working if
the boot environment attempts to access anything outside the first 1TB on
the disk.  'ZFS: I/O error, all block copies unavailable' etc.  It affects
both UFS and ZFS if they try to boot from large volumes.

This change replaces the blind trust of the BIOS end-of-disk reporting
with a read-ahead clip to prevent reads crossing the of end-of-disk
boundary.  Since 2^32 (2TB) size reporting truncation is not uncommon,
the clipping is done on 2TB aliases of the reported end-of-disk.
ie: a 3TB disk reported as 1TB has readahead clipped at 1TB, 3TB, 5TB, ...
as one of them is likely to be the real end-of-disk.

This should make the loader on these broken machines behave the same as
traditional pre-r298900 loader behavior, without disabling read-ahead.

PR:		212139
Discussed with:	tsoome, allanjude
2016-08-28 20:39:33 +00:00
..
boot0 Implement (ACFLAGS|CFLAGS|CXXFLAGS).SRC globally. 2016-03-26 03:46:12 +00:00
boot0sio META_MODE: Remove DEP_MACHINE from Makefile.depend files. 2015-09-25 19:44:01 +00:00
boot2 Add SHA512, skein, large blocks support for loader zfs. 2016-08-18 00:37:07 +00:00
btx Add the missing space between .asciz directive and opening quote for some 2016-08-11 15:00:55 +00:00
cdboot Implement (ACFLAGS|CFLAGS|CXXFLAGS).SRC globally. 2016-03-26 03:46:12 +00:00
common Add missing prototype for getchar(..) 2016-05-13 10:59:46 +00:00
gptboot Add SHA512, skein, large blocks support for loader zfs. 2016-08-18 00:37:07 +00:00
gptzfsboot Add SHA512, skein, large blocks support for loader zfs. 2016-08-18 00:37:07 +00:00
kgzldr META MODE: Update dependencies with 'the-lot' and add missing directories. 2015-12-01 05:23:19 +00:00
libfirewire sys/boot: spelling fixes in comments. 2016-04-30 00:26:38 +00:00
libi386 The read-ahead code from r298230 made it likely the boot code would read 2016-08-28 20:39:33 +00:00
loader A new implementation of the loader block cache 2016-04-18 23:09:22 +00:00
mbr META MODE: Update dependencies with 'the-lot' and add missing directories. 2015-12-01 05:23:19 +00:00
pmbr META MODE: Update dependencies with 'the-lot' and add missing directories. 2015-12-01 05:23:19 +00:00
pxeldr Implement (ACFLAGS|CFLAGS|CXXFLAGS).SRC globally. 2016-03-26 03:46:12 +00:00
zfsboot Add SHA512, skein, large blocks support for loader zfs. 2016-08-18 00:37:07 +00:00
zfsloader DIRDEPS_BUILD: Update dependencies. 2016-03-21 18:02:26 +00:00
Makefile Restore kgzldr on i386 only 2016-02-08 16:59:52 +00:00
Makefile.inc Use CFLAGS_NO_SIMD in preference to varying lists of -mno-xxxx flags. 2015-08-27 23:46:42 +00:00