summaryrefslogtreecommitdiffstats
path: root/sys/boot/common/bootstrap.h
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/common/bootstrap.h
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/common/bootstrap.h')
-rw-r--r--sys/boot/common/bootstrap.h30
1 files changed, 8 insertions, 22 deletions
diff --git a/sys/boot/common/bootstrap.h b/sys/boot/common/bootstrap.h
index 7efc2c2..cbfc6f0 100644
--- a/sys/boot/common/bootstrap.h
+++ b/sys/boot/common/bootstrap.h
@@ -33,24 +33,6 @@
#include <sys/queue.h>
#include <sys/linker_set.h>
-/*
- * Generic device specifier; architecture-dependant
- * versions may be larger, but should be allowed to
- * overlap.
- */
-struct devdesc
-{
- struct devsw *d_dev;
- int d_type;
-#define DEVT_NONE 0
-#define DEVT_DISK 1
-#define DEVT_NET 2
-#define DEVT_CD 3
-#define DEVT_ZFS 4
- int d_unit;
- void *d_opendata;
-};
-
/* Commands and return values; nonzero return sets command_errmsg != NULL */
typedef int (bootblk_cmd_t)(int argc, char *argv[]);
extern char *command_errmsg;
@@ -90,9 +72,11 @@ int kern_pread(int fd, vm_offset_t dest, size_t len, off_t off);
void *alloc_pread(int fd, off_t off, size_t len);
/* bcache.c */
-int bcache_init(u_int nblks, size_t bsize);
-void bcache_flush(void);
-int bcache_strategy(void *devdata, int unit, int rw, daddr_t blk,
+void bcache_init(u_int nblks, size_t bsize);
+void bcache_add_dev(int);
+void *bcache_allocate(void);
+void bcache_free(void *);
+int bcache_strategy(void *devdata, int rw, daddr_t blk, size_t offset,
size_t size, char *buf, size_t *rsize);
/*
@@ -100,8 +84,10 @@ int bcache_strategy(void *devdata, int unit, int rw, daddr_t blk,
*/
struct bcache_devdata
{
- int (*dv_strategy)(void *devdata, int rw, daddr_t blk, size_t size, char *buf, size_t *rsize);
+ int (*dv_strategy)(void *devdata, int rw, daddr_t blk,
+ size_t offset, size_t size, char *buf, size_t *rsize);
void *dv_devdata;
+ void *dv_cache;
};
/*
OpenPOWER on IntegriCloud