summaryrefslogtreecommitdiffstats
path: root/sys/boot/usb
diff options
context:
space:
mode:
authorallanjude <allanjude@FreeBSD.org>2016-04-18 23:09:22 +0000
committerallanjude <allanjude@FreeBSD.org>2016-04-18 23:09:22 +0000
commit2b75f57932d5da46b59518aea907b6f346debbf0 (patch)
tree09b85948491446b199b7aadf2471642aeaad77f6 /sys/boot/usb
parentc2c4e0063764efa28c4eebf08439db13c4a2f575 (diff)
downloadFreeBSD-src-2b75f57932d5da46b59518aea907b6f346debbf0.zip
FreeBSD-src-2b75f57932d5da46b59518aea907b6f346debbf0.tar.gz
A new implementation of the loader block cache
The block cache implementation in loader has proven to be almost useless, and in worst case even slowing down the disk reads due to insufficient cache size and extra memory copy. Also the current cache implementation does not cache reads from CDs, or work with zfs built on top of multiple disks. Instead of an LRU, this code uses a simple hash (O(1) read from cache), and instead of a single global cache, a separate cache per block device. The cache also implements limited read-ahead to increase performance. To simplify read ahead management, the read ahead will not wrap over bcache end, so in worst case, single block physical read will be performed to fill the last block in bcache. Booting from a virtual CD over IPMI: 0ms latency, before: 27 second, after: 7 seconds 60ms latency, before: over 12 minutes, after: under 5 minutes. Submitted by: Toomas Soome <tsoome@me.com> Reviewed by: delphij (previous version), emaste (previous version) Relnotes: yes Differential Revision: https://reviews.freebsd.org/D4713
Diffstat (limited to 'sys/boot/usb')
-rw-r--r--sys/boot/usb/storage/umass_loader.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/boot/usb/storage/umass_loader.c b/sys/boot/usb/storage/umass_loader.c
index 4311b2b..85b89e8 100644
--- a/sys/boot/usb/storage/umass_loader.c
+++ b/sys/boot/usb/storage/umass_loader.c
@@ -48,7 +48,8 @@ static int umass_disk_open(struct open_file *,...);
static int umass_disk_close(struct open_file *);
static void umass_disk_cleanup(void);
static int umass_disk_ioctl(struct open_file *, u_long, void *);
-static int umass_disk_strategy(void *, int, daddr_t, size_t, char *, size_t *);
+static int umass_disk_strategy(void *, int, daddr_t, size_t, size_t, char *,
+ size_t *);
static void umass_disk_print(int);
struct devsw umass_disk = {
@@ -84,8 +85,8 @@ umass_disk_init(void)
}
static int
-umass_disk_strategy(void *devdata, int flag, daddr_t dblk, size_t size,
- char *buf, size_t *rsizep)
+umass_disk_strategy(void *devdata, int flag, daddr_t dblk, size_t offset,
+ size_t size, char *buf, size_t *rsizep)
{
if (umass_uaa.device == NULL)
return (ENXIO);
OpenPOWER on IntegriCloud