summaryrefslogtreecommitdiffstats
path: root/sys/boot/i386
diff options
context:
space:
mode:
authorae <ae@FreeBSD.org>2012-09-29 16:47:56 +0000
committerae <ae@FreeBSD.org>2012-09-29 16:47:56 +0000
commit75dfd50beb9ad0d46f0492739cbccf5795eb36a2 (patch)
tree403dd8dac6f6bc3959207afde75dad0ebb383086 /sys/boot/i386
parenta7f869fbc12c7a8560ce1231243042ee05c6b86a (diff)
downloadFreeBSD-src-75dfd50beb9ad0d46f0492739cbccf5795eb36a2.zip
FreeBSD-src-75dfd50beb9ad0d46f0492739cbccf5795eb36a2.tar.gz
Almost each time when loader opens a file, this leads to calling
disk_open(). Very often this is called several times for one file. This leads to reading partition table metadata for each call. To reduce the number of disk I/O we have a simple block cache, but it is very dumb and more than half of I/O operations related to reading metadata, misses this cache. Introduce new cache layer to resolve this problem. It is independent and doesn't need initialization like bcache, and will work by default for all loaders which use the new DISK API. A successful disk_open() call to each new disk or partition produces new entry in the cache. Even more, when disk was already open, now opening of any nested partitions does not require reading top level partition table. So, if without this cache, partition table metadata was read around 20-50 times during boot, now it reads only once. This affects the booting from GPT and MBR from the UFS.
Diffstat (limited to 'sys/boot/i386')
-rw-r--r--sys/boot/i386/libi386/biosdisk.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/sys/boot/i386/libi386/biosdisk.c b/sys/boot/i386/libi386/biosdisk.c
index 53e7e6a..36bde12 100644
--- a/sys/boot/i386/libi386/biosdisk.c
+++ b/sys/boot/i386/libi386/biosdisk.c
@@ -106,6 +106,7 @@ static int bd_open(struct open_file *f, ...);
static int bd_close(struct open_file *f);
static int bd_ioctl(struct open_file *f, u_long cmd, void *data);
static void bd_print(int verbose);
+static void bd_cleanup(void);
struct devsw biosdisk = {
"disk",
@@ -116,7 +117,7 @@ struct devsw biosdisk = {
bd_close,
bd_ioctl,
bd_print,
- NULL
+ bd_cleanup
};
/*
@@ -181,6 +182,13 @@ bd_init(void)
return(0);
}
+static void
+bd_cleanup(void)
+{
+
+ disk_cleanup(&biosdisk);
+}
+
/*
* Try to detect a device supported by the legacy int13 BIOS
*/
OpenPOWER on IntegriCloud