From 75dfd50beb9ad0d46f0492739cbccf5795eb36a2 Mon Sep 17 00:00:00 2001 From: ae Date: Sat, 29 Sep 2012 16:47:56 +0000 Subject: 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. --- sys/boot/uboot/lib/disk.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sys/boot/uboot/lib') diff --git a/sys/boot/uboot/lib/disk.c b/sys/boot/uboot/lib/disk.c index 13f913a..5dc9a5a 100644 --- a/sys/boot/uboot/lib/disk.c +++ b/sys/boot/uboot/lib/disk.c @@ -142,6 +142,7 @@ stor_cleanup(void) for (i = 0; i < stor_info_no; i++) if (stor_info[i].opened > 0) ub_dev_close(stor_info[i].handle); + disk_cleanup(&uboot_storage); } static int -- cgit v1.1